本文整理汇总了C++中setOptions函数的典型用法代码示例。如果您正苦于以下问题:C++ setOptions函数的具体用法?C++ setOptions怎么用?C++ setOptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setOptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trainBackgroundModel
void trainBackgroundModel(CvCapture* capture)
{
CvSize frame_size;
frame_size.height = (int) cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT );
frame_size.width = (int) cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH );
if(background_model != NULL)
delete background_model;
background_model = new pixel_data*[frame_size.height];
for(int i = 0; i < frame_size.height; i++)
background_model[i] = new pixel_data[frame_size.width];
const char* title = "Training Background Model";
std::vector<const char*> lines;
for(int i = 5; i >= 0; i--)
{
char buffer[400];
sprintf(buffer, "Starting training in %d ...", i);
lines.clear();
lines.push_back(buffer);
setOptions(title, lines);
cvWaitKey(1000);
}
for(int num_frames = 0; num_frames < NUM_BACKGROUND_TRAINING_FRAMES; num_frames++)
{
char buffer[400];
sprintf(buffer, "%g%%", ((double)num_frames/NUM_BACKGROUND_TRAINING_FRAMES*100.0));
lines.clear();
lines.push_back(buffer);
setOptions(title, lines);
/* get a frame */
IplImage* frame = cvQueryFrame( capture );
RgbImage img(frame);
for(int i = 0; i < frame->height; i++)
{
for(int j = 0; j < frame->width; j++)
{
background_model[i][j].addDataPoint(img[i][j].r, img[i][j].g, img[i][j].b);
}
}
/* always check */
if( !frame ) break;
cvShowImage(MAIN_WINDOW, frame);
cvWaitKey(10);
}
lines.push_back("Done");
setOptions(title, lines);
cvWaitKey(3000);
}
示例2: switch
BOOL SettingsDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
switch(message)
{
case WM_INITDIALOG:
_hSelf = hWnd;
initialiseOptions();
return TRUE;
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDOK:
setOptions();
case IDCANCEL:
::EndDialog(hWnd, 0);
}
return TRUE;
}
default:
return FALSE;
}
}
示例3: setName
GameMode::GameMode(std::string name, std::string description, std::vector<std::string> options)
{
setName(name);
setDescription(description);
setOptions(options);
setType("multiChoice");
}
示例4: main
int main(int argc, char *argv[])
{
register int n;
int Nlambda, result;
double *lambda;
FILE *fp;
/* --- Read input data and initialize -- -------------- */
setOptions(argc, argv);
SetFPEtraps();
readInput();
MULTIatmos(&atmos, &geometry);
readAtomicModels();
readMolecularModels();
if ((fp = fopen(CONTR_INPUT_FILE, "r")) == NULL) {
sprintf(messageStr, "Unable to open inputfile %s", CONTR_INPUT_FILE);
Error(ERROR_LEVEL_2, argv[0], messageStr);
}
result = fscanf(fp, "%d", &Nlambda);
lambda = (double *) malloc(Nlambda * sizeof(double));
for (n = 0; n < Nlambda; n++)
result = fscanf(fp, "%lf", &lambda[n]);
fclose(fp);
backgrOpac(Nlambda, lambda);
free(lambda);
}
示例5: parseOptions
bool parseOptions(int ac, char** av, ProgramOptions& options) {
po::positional_options_description positional_options;
po::options_description desc;
positional_options.add("compress", 1);
desc.add_options()
("help,h", "this help message")
("output,o", po::value<std::string>(),
"for compression: output file (default is 'output.arch'), for extraction: output directory (current directory by default).")
("extract,x", po::value<std::string>(), "extract archive")
("compress", po::value<std::string>(), "compress file or folder");
std::stringstream ss;
ss << desc;
options.setHelpString(ss.str());
po::variables_map vm;
try {
po::store(
po::command_line_parser(ac, av).options(desc).positional(
positional_options).run(), vm);
po::notify(vm);
return setOptions(vm, options);
} catch (std::exception & ex) {
std::cerr << ex.what() << std::endl;
return false;
}
}
示例6: QWizard
GeneratedObjectsWizard::GeneratedObjectsWizard(
GeneratedObjectsWizardPage * page, QWidget * parent):
QWizard(parent), page_(page) {
setWindowTitle(
tr("Generated") +" "+ page_->objectTypePlural() +
" | " + MAIN_WINDOW->windowTitle() );
page_->setTitle(tr("Random generated")+" "+
page_->objectTypePlural() );
page_->setSubTitle(
tr( "Change count of generated objects of some kinds and"
" confirm the settings. If there is not the object"
" you want, try load new object, but remember that"
" in this page are viewed only")+" "+
page_->objectTypePlural() +".");
setOptions( QWizard::NoBackButtonOnStartPage |
QWizard::HaveCustomButton1);
setButtonText(QWizard::CustomButton1, tr("Load new map object"));
connect(this, SIGNAL(customButtonClicked(int)),
this, SLOT(loadMapObject()) );
addPage(page);
connect(this, SIGNAL(accepted()),
page, SLOT(setCountInMap()) );
}
示例7: optionInit
void optionInit(int *pArgc, char *argv[], struct optionSpec *optionSpecs)
/* Read options in command line into options hash.
* Options come in three forms:
* -option words starting with dash
* option=val words with = in the middle
* -option=val combining the two.
* The resulting hash will be keyed by the option name with the val
* string for value. For '-option' types the value is 'on'.
* The words in argv are parsed in assending order. If a word of
* "--" is encountered, argument parsing stops.
* If optionSpecs is not NULL, it is an array of optionSpec that are
* used to validate the options. An option must exist in the array
* and the value must be convertable to the type specified in flags.
* Boolean options must no value, all other options must have one.
* Array is terminated by a optionSpec with a NULL name.
* If array NULL, no validation is done.
*/
{
if (options == NULL)
{
struct hash *hash = parseOptions(pArgc, argv, FALSE, optionSpecs);
setOptions(hash);
optionSpecification = optionSpecs;
}
}
示例8: QMediaPlayer
PlanetC_VideoPlayer::PlanetC_VideoPlayer(QGraphicsView* p_view)
: QMediaPlayer(0, QMediaPlayer::VideoSurface)
{
posX = 0;
posY = 0;
sizeW = 100;
sizeH = 100;
rotationAngle = 0.;
//Create a QGraphicsVideoItem object to display the videow
video = new QGraphicsVideoItem();
video->setVisible(true);
video->setAspectRatioMode(Qt::KeepAspectRatio);
//Add QGraphicsVideoItem object to the main scene
view = p_view;
view->scene()->addItem(video);
//Connect the player to the video item
setVideoOutput(video);
video->setVisible(true);
//Once geometry properties are available (width, height) set the GraphicsVideoItem geometry
connect(this, SIGNAL(metaDataChanged(QString,QVariant)), this, SLOT(setOptions(QString,QVariant)));
}
示例9: m_type
UIWizard::UIWizard(QWidget *pParent, UIWizardType type, UIWizardMode mode)
: QIWithRetranslateUI<QWizard>(pParent)
, m_type(type)
, m_mode(mode == UIWizardMode_Auto ? loadModeForType(m_type) : mode)
{
#ifdef Q_WS_WIN
/* Hide window icon: */
setWindowIcon(QIcon());
#endif /* Q_WS_WIN */
#ifdef Q_WS_MAC
/* Since wizards are now represented as Mac OS X Sheets
* we would like to have possibility to cancel them. */
setOption(QWizard::NoCancelButton, false);
/* I'm really not sure why there shouldn't be any default button on Mac OS X.
* This prevents the using of Enter to jump to the next page. */
setOptions(options() ^ QWizard::NoDefaultButton);
#endif /* Q_WS_MAC */
/* All our wizards would like to have window-modality,
* Under Mac OS it will be represented as Mac OS Sheet. */
setWindowModality(Qt::WindowModal);
/* Setup connections: */
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(sltCurrentIdChanged(int)));
connect(this, SIGNAL(customButtonClicked(int)), this, SLOT(sltCustomButtonClicked(int)));
}
示例10: setOptions
void LayerListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem opt = setOptions(index, option);
painter->save();
const auto &layer = index.data().value<paintcore::LayerInfo>();
const int myId = static_cast<const canvas::LayerListModel*>(index.model())->myId();
if(layer.isLockedFor(myId))
opt.state &= ~QStyle::State_Enabled;
drawBackground(painter, option, index);
QRect textrect = opt.rect;
// Draw layer opacity glyph
QRect stylerect(opt.rect.topLeft() + QPoint(0, opt.rect.height()/2-12), QSize(24,24));
drawOpacityGlyph(stylerect, painter, layer.opacity, layer.hidden);
// Draw layer name
textrect.setLeft(stylerect.right());
QString title;
if(m_showNumbers)
title = QString("%1 - %2").arg(index.model()->rowCount() - index.row() - 1).arg(layer.title);
else
title = layer.title;
drawDisplay(painter, opt, textrect, title);
painter->restore();
}
示例11: setOptions
void SslContext::updateProtocol(int method)
{
setOptions(SSL_OP_NO_SSLv2);
if (!(method & SSL_v3))
setOptions(SSL_OP_NO_SSLv3);
if (!(method & SSL_TLSv1))
setOptions(SSL_OP_NO_TLSv1);
#ifdef SSL_OP_NO_TLSv1_1
if (!(method & SSL_TLSv11))
setOptions(SSL_OP_NO_TLSv1_1);
#endif
#ifdef SSL_OP_NO_TLSv1_2
if (!(method & SSL_TLSv12))
setOptions(SSL_OP_NO_TLSv1_2);
#endif
}
示例12: setOptions
void AVFilterSubtitle::onPlayerStart()
{
setOptions(QString());
if (!autoLoad())
return;
findAndSetFile(m_player->file());
}
示例13: main
/*
* Main function
*/
int main(int argc, char* argv[])
{
cout << " Producers-Consumers demo running" << endl
<< " --------------------------------" << endl << endl;
// create an object to store and handle options
run_options opt;
// default parameters are set here
opt.num_of_producers = 10; // threads
opt.num_of_consumers = 10; // threads
opt.production_duration = 500; // milliseconds
opt.consumption_duration = 500; // milliseconds
opt.market_buffer_size = 1000; // integers
// parse and assign user-defined options (if any)
setOptions(argc, argv, &opt);
// display options
showOptions(&opt);
// create an object to simulate the producers-consumers problem
Market MyMarket(&opt);
// trigger the simulation
MyMarket.run();
return 0;
}
示例14: main
int main(int argc, char **argv)
{
// Statup wx
wxInitialize();
wxString executable;
executable = wxString::FromAscii(argv[0]);
if (argc < 2)
{
usage(executable);
return 1;
}
argc--;
argv++;
setOptions(argc, argv, executable);
if (!runInForeground)
daemonize();
MainLoop();
return 0;
}
示例15: sizeof
bool Socket::getTCPNoDelay( bool &noDelay ) {
bool result;
int tcpNoDelay=noDelay;
result=setOptions( IPPROTO_TCP, TCP_NODELAY, &tcpNoDelay, sizeof(int));
noDelay=tcpNoDelay ? true : false;
return result;
}