Exemplo n.º 1
0
int Dialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setInteger(); break;
        case 1: setDouble(); break;
        case 2: setItem(); break;
        case 3: setText(); break;
        case 4: setColor(); break;
        case 5: setFont(); break;
        case 6: setExistingDirectory(); break;
        case 7: setOpenFileName(); break;
        case 8: setOpenFileNames(); break;
        case 9: setSaveFileName(); break;
        case 10: criticalMessage(); break;
        case 11: informationMessage(); break;
        case 12: questionMessage(); break;
        case 13: warningMessage(); break;
        case 14: errorMessage(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Exemplo n.º 2
0
 void DataStore::setDefaultInteger(int32_t value, const char *key)
 {
     if(contains(key))
         return;
     
     setInteger(value, key);
 }
/**
 * \brief Setter function for integers.
 *
 * Used by OMSIC or OMSICpp library.
 *
 * \param [in,out]  omsu    Central data structure containing all informations.
 * \param [in]      vr      Array of value references for integer variables to set.
 * \param [in]      nvr     Length of array `vr`.
 * \param [in]      value   Contains integers to be set.
 * \return                  `omsi_status omsi_ok` if successful <br>
 *                          `omsi_status omsi_error` if something went wrong.
 */
omsi_status omsi_set_integer(omsi_t*                    omsu,
                             const omsi_unsigned_int*   vr,
                             omsi_unsigned_int          nvr,
                             const omsi_int*            value) {

    /* Variables */
    omsi_unsigned_int i;

    if (!model_variables_allocated(omsu, "fmi2SetInteger"))
        return omsi_error;

    if (nvr>0 && vr==NULL) {
        filtered_base_logger(global_logCategories, log_statuserror, omsi_error,
                "fmi2SetInteger: Invalid argument vr[] = NULL.");
        return omsi_error;
    }
    if (nvr>0 && value==NULL) {
        filtered_base_logger(global_logCategories, log_statuserror, omsi_error,
                "fmi2SetInteger: Invalid argument value[] = NULL.");
        return omsi_error;
    }

    filtered_base_logger(global_logCategories, log_all, omsi_ok,
        "fmi2SetInteger: nvr = %d", nvr);

    for (i = 0; i < nvr; i++) {
        if (omsi_vr_out_of_range(omsu, "fmi2SetInteger", vr[i], omsu->sim_data->model_vars_and_params->n_ints))
            return omsi_error;
        filtered_base_logger(global_logCategories, log_all, omsi_ok,
            "fmi2SetInteger: #i%d# = %d", vr[i], value[i]);
        setInteger(omsu, vr[i], value[i]);
    }

    return omsi_ok;
}
void RemoteInspectorServer::sendMessageToFrontend(const Event& event)
{
    if (!m_clientConnection)
        return;

    ASSERT(isMainThread());

    if (!event.targetID || !event.message)
        return;

    auto sendEvent = JSON::Object::create();
    sendEvent->setString("event"_s, "SendMessageToFrontend"_s);
    sendEvent->setInteger("targetID"_s, event.targetID.value());
    sendEvent->setInteger("connectionID"_s, event.clientID);
    sendEvent->setString("message"_s, event.message.value());
    sendWebInspectorEvent(m_clientConnection.value(), sendEvent->toJSONString());
}
bool DirectAccessSymbolicValues::getBoolean(QString name)
{
    // If this name is not known, generate a default value and save it.
    if (!mBooleanVars.contains(name)) {
        setInteger(name, generateDefaultBoolean());
    }
    return mBooleanVars[name];
}
Exemplo n.º 6
0
int Settings::integer(QString key, int default_value)
{
  int value = valueWithFallback(key, default_value).toInt();
  if (value==default_value)
  {
    setInteger(key, default_value);
  }
  return value;
}
void RemoteInspectorServer::sendCloseEvent(uint64_t connectionID, uint64_t targetID)
{
    ASSERT(isMainThread());

    auto closeEvent = JSON::Object::create();
    closeEvent->setString("event"_s, "FrontendDidClose"_s);
    closeEvent->setInteger("targetID"_s, targetID);
    sendWebInspectorEvent(connectionID, closeEvent->toJSONString());
}
Exemplo n.º 8
0
	Rationel& Rationel::addin(Rationel& res, const Integer& n)
	{
		if (Givaro::isZero(n)) return res;
		Rationel nn ;
		setInteger(nn,n);
		if (isZero(res)) return res = nn;
		mpq_add( (mpq_ptr)&res.gmp_rep, (mpq_srcptr)&res.gmp_rep, (mpq_srcptr)&nn.gmp_rep );
		return res;
	}
Exemplo n.º 9
0
Drawbar::Drawbar(QWidget* parent)
   : Slider(parent)
      {
      _sliderColor = Qt::darkGray;
      setOrientation(Qt::Vertical);
      setInvertedAppearance(true);
      setRange(0.0, 8.0);
      setLineStep(1.0);
      setPageStep(1.0);
      setInteger(true);
      }
Exemplo n.º 10
0
bool coSliderToolboxItem::updateContentRange(float min, float max, float value,
                                             bool isInteger, float)
{
    setMax(max);
    setMin(min);
    setValue(value);
    setInteger(isInteger);
    if (listener)
        listener->menuEvent(this);
    return true;
}
void RemoteInspectorServer::setTargetList(const Event& event)
{
    ASSERT(isMainThread());

    if (!m_clientConnection || !event.message)
        return;

    auto targetListEvent = JSON::Object::create();
    targetListEvent->setString("event"_s, "SetTargetList"_s);
    targetListEvent->setInteger("connectionID"_s, event.clientID);
    targetListEvent->setString("message"_s, event.message.value());
    sendWebInspectorEvent(m_clientConnection.value(), targetListEvent->toJSONString());
}
void RemoteInspectorServer::connectionClosed(uint64_t clientID)
{
    ASSERT(isMainThread());

    LockHolder lock(m_connectionsLock);
    if (m_inspectorConnections.removeFirst(clientID) && m_clientConnection) {
        auto closedEvent = JSON::Object::create();
        closedEvent->setString("event"_s, "SetTargetList"_s);
        closedEvent->setInteger("connectionID"_s, clientID);
        auto targetList = JSON::Array::create();
        closedEvent->setString("message"_s, targetList->toJSONString());
        sendWebInspectorEvent(m_clientConnection.value(), closedEvent->toJSONString());
    }
}
void RemoteInspectorServer::setup(const Event& event)
{
    ASSERT(isMainThread());

    if (!event.targetID || !event.connectionID)
        return;

    m_inspectionTargets.add(std::make_pair(event.connectionID.value(), event.targetID.value()));

    auto setupEvent = JSON::Object::create();
    setupEvent->setString("event"_s, "Setup"_s);
    setupEvent->setInteger("targetID"_s, event.targetID.value());
    sendWebInspectorEvent(event.connectionID.value(), setupEvent->toJSONString());
}
int Dialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setInteger(); break;
        case 1: setText(); break;
        case 2: perform_action(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Exemplo n.º 15
0
fmiStatus fmiSetInteger(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiInteger value[])
{
  unsigned int i=0;
  ModelInstance* comp = (ModelInstance *)c;
  if (invalidState(comp, "fmiSetInteger", modelInstantiated|modelInitialized))
    return fmiError;
  if (nvr>0 && nullPointer(comp, "fmiSetInteger", "vr[]", vr))
    return fmiError;
  if (nvr>0 && nullPointer(comp, "fmiSetInteger", "value[]", value))
    return fmiError;
  if (comp->loggingOn)
    comp->functions.logger(c, comp->instanceName, fmiOK, "log", "fmiSetInteger: nvr = %d",  nvr);
  for (i=0; i<nvr; i++) {
    if (vrOutOfRange(comp, "fmiSetInteger", vr[i], NUMBER_OF_INTEGERS))
      return fmiError;
    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
        "fmiSetInteger: #i%d# = %d", vr[i], value[i]);
    if (setInteger(comp, vr[i],value[i]) != fmiOK) // to be implemented by the includer of this file
      return fmiError;
  }

  return fmiOK;
}
Exemplo n.º 16
0
Dialogs::Dialogs(QWidget *parent)
   : QWidget(parent), ui(new Ui::Dialogs)
{
   ui->setupUi(this);
   setWindowTitle(tr("Standard Dialogs"));

   ui->native_checkBox->setChecked(true);

   // signals
   connect(ui->integer_pushButton,    SIGNAL(clicked()), this, SLOT(setInteger()));
   connect(ui->double_pushButton,     SIGNAL(clicked()), this, SLOT(setDouble()));
   connect(ui->getItem_pushButton,    SIGNAL(clicked()), this, SLOT(setItem()));
   connect(ui->getText_pushButton,    SIGNAL(clicked()), this, SLOT(setText()));

   connect(ui->dir_pushButton,        SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
   connect(ui->openFile_pushButton,   SIGNAL(clicked()), this, SLOT(setOpenFileName()));
   connect(ui->openFiles_pushButton,  SIGNAL(clicked()), this, SLOT(setOpenFileNames()));

   connect(ui->critical_pushButton,   SIGNAL(clicked()), this, SLOT(criticalMessage()));
   connect(ui->info_pushButton,       SIGNAL(clicked()), this, SLOT(informationMessage()));
   connect(ui->quest_pushButton,      SIGNAL(clicked()), this, SLOT(questionMessage()));
   connect(ui->warn_pushButton,       SIGNAL(clicked()), this, SLOT(warningMessage()));
   connect(ui->error_pushButton,      SIGNAL(clicked()), this, SLOT(errorMessage()));
}
Exemplo n.º 17
0
	void setInteger(int value) {
		this->setSize(sizeof(int));
		setInteger(0, value);
	}
Exemplo n.º 18
0
void Value::setTime(time value)
{
	time t(value);
	_isNull = false;
	setInteger(t.asInteger());
}
Exemplo n.º 19
0
void CC3GLSLUniform::setBoolean( bool value, GLuint index )
{
	setBooleanVectorAt( value, false, false, false, index );
	setInteger( (value != 0), index );
}
Exemplo n.º 20
0
void Fujimap::setString(const char* kbuf, const size_t klen, 
			const char* vbuf, const size_t vlen, 
			const bool searchable){
  setInteger(kbuf, klen, getCode(string(vbuf, vlen)), searchable);
}
Exemplo n.º 21
0
Dialog::Dialog(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QToolBox *toolbox = new QToolBox;
    mainLayout->addWidget(toolbox);

    errorMessageDialog = new QErrorMessage(this);

    int frameStyle = QFrame::Sunken | QFrame::Panel;

    integerLabel = new QLabel;
    integerLabel->setFrameStyle(frameStyle);
    QPushButton *integerButton =
            new QPushButton(tr("QInputDialog::get&Int()"));

    doubleLabel = new QLabel;
    doubleLabel->setFrameStyle(frameStyle);
    QPushButton *doubleButton =
            new QPushButton(tr("QInputDialog::get&Double()"));

    itemLabel = new QLabel;
    itemLabel->setFrameStyle(frameStyle);
    QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));

    textLabel = new QLabel;
    textLabel->setFrameStyle(frameStyle);
    QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));

    multiLineTextLabel = new QLabel;
    multiLineTextLabel->setFrameStyle(frameStyle);
    QPushButton *multiLineTextButton = new QPushButton(tr("QInputDialog::get&MultiLineText()"));

    colorLabel = new QLabel;
    colorLabel->setFrameStyle(frameStyle);
    QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));

    fontLabel = new QLabel;
    fontLabel->setFrameStyle(frameStyle);
    QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));

    directoryLabel = new QLabel;
    directoryLabel->setFrameStyle(frameStyle);
    QPushButton *directoryButton =
            new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

    openFileNameLabel = new QLabel;
    openFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNameButton =
            new QPushButton(tr("QFileDialog::get&OpenFileName()"));

    openFileNamesLabel = new QLabel;
    openFileNamesLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNamesButton =
            new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

    saveFileNameLabel = new QLabel;
    saveFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *saveFileNameButton =
            new QPushButton(tr("QFileDialog::get&SaveFileName()"));

    criticalLabel = new QLabel;
    criticalLabel->setFrameStyle(frameStyle);
    QPushButton *criticalButton =
            new QPushButton(tr("QMessageBox::critica&l()"));

    informationLabel = new QLabel;
    informationLabel->setFrameStyle(frameStyle);
    QPushButton *informationButton =
            new QPushButton(tr("QMessageBox::i&nformation()"));

    questionLabel = new QLabel;
    questionLabel->setFrameStyle(frameStyle);
    QPushButton *questionButton =
            new QPushButton(tr("QMessageBox::&question()"));

    warningLabel = new QLabel;
    warningLabel->setFrameStyle(frameStyle);
    QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));

    errorLabel = new QLabel;
    errorLabel->setFrameStyle(frameStyle);
    QPushButton *errorButton =
            new QPushButton(tr("QErrorMessage::showM&essage()"));

    connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
    connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
    connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
    connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
    connect(multiLineTextButton, SIGNAL(clicked()), this, SLOT(setMultiLineText()));
    connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
    connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(directoryButton, SIGNAL(clicked()),
            this, SLOT(setExistingDirectory()));
    connect(openFileNameButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileName()));
    connect(openFileNamesButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileNames()));
    connect(saveFileNameButton, SIGNAL(clicked()),
            this, SLOT(setSaveFileName()));
    connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
    connect(informationButton, SIGNAL(clicked()),
            this, SLOT(informationMessage()));
    connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
    connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
    connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

    QWidget *page = new QWidget;
    QGridLayout *layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->setColumnMinimumWidth(1, 250);
    layout->addWidget(integerButton, 0, 0);
    layout->addWidget(integerLabel, 0, 1);
    layout->addWidget(doubleButton, 1, 0);
    layout->addWidget(doubleLabel, 1, 1);
    layout->addWidget(itemButton, 2, 0);
    layout->addWidget(itemLabel, 2, 1);
    layout->addWidget(textButton, 3, 0);
    layout->addWidget(textLabel, 3, 1);
    layout->addWidget(multiLineTextButton, 4, 0);
    layout->addWidget(multiLineTextLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Input Dialogs"));

    const QString doNotUseNativeDialog = tr("Do not use native dialog");

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(colorButton, 0, 0);
    layout->addWidget(colorLabel, 0, 1);
    colorDialogOptionsWidget = new DialogOptionsWidget;
    colorDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QColorDialog::DontUseNativeDialog);
    colorDialogOptionsWidget->addCheckBox(tr("Show alpha channel") , QColorDialog::ShowAlphaChannel);
    colorDialogOptionsWidget->addCheckBox(tr("No buttons") , QColorDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(colorDialogOptionsWidget, 2, 0, 1 ,2);

    toolbox->addItem(page, tr("Color Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(fontButton, 0, 0);
    layout->addWidget(fontLabel, 0, 1);
    fontDialogOptionsWidget = new DialogOptionsWidget;
    fontDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFontDialog::DontUseNativeDialog);
    fontDialogOptionsWidget->addCheckBox(tr("No buttons") , QFontDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(fontDialogOptionsWidget, 2, 0, 1 ,2);
    toolbox->addItem(page, tr("Font Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(directoryButton, 0, 0);
    layout->addWidget(directoryLabel, 0, 1);
    layout->addWidget(openFileNameButton, 1, 0);
    layout->addWidget(openFileNameLabel, 1, 1);
    layout->addWidget(openFileNamesButton, 2, 0);
    layout->addWidget(openFileNamesLabel, 2, 1);
    layout->addWidget(saveFileNameButton, 3, 0);
    layout->addWidget(saveFileNameLabel, 3, 1);
    fileDialogOptionsWidget = new DialogOptionsWidget;
    fileDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFileDialog::DontUseNativeDialog);
    fileDialogOptionsWidget->addCheckBox(tr("Show directories only"), QFileDialog::ShowDirsOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Do not resolve symlinks"), QFileDialog::DontResolveSymlinks);
    fileDialogOptionsWidget->addCheckBox(tr("Do not confirm overwrite"), QFileDialog::DontConfirmOverwrite);
    fileDialogOptionsWidget->addCheckBox(tr("Do not use sheet"), QFileDialog::DontUseSheet);
    fileDialogOptionsWidget->addCheckBox(tr("Readonly"), QFileDialog::ReadOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Hide name filter details"), QFileDialog::HideNameFilterDetails);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 4, 0);
    layout->addWidget(fileDialogOptionsWidget, 5, 0, 1 ,2);
    toolbox->addItem(page, tr("File Dialogs"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(criticalButton, 0, 0);
    layout->addWidget(criticalLabel, 0, 1);
    layout->addWidget(informationButton, 1, 0);
    layout->addWidget(informationLabel, 1, 1);
    layout->addWidget(questionButton, 2, 0);
    layout->addWidget(questionLabel, 2, 1);
    layout->addWidget(warningButton, 3, 0);
    layout->addWidget(warningLabel, 3, 1);
    layout->addWidget(errorButton, 4, 0);
    layout->addWidget(errorLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Message Boxes"));

    setWindowTitle(tr("Standard Dialogs"));
}
Exemplo n.º 22
0
Dialog::Dialog(QWidget *parent)
	: QDialog(parent)
{
	errorMessageDialog = new QErrorMessage(this);
	
	int frameStyle = QFrame::Sunken | QFrame::Panel;
	
	integerLabel = new QLabel;
	integerLabel->setFrameStyle(frameStyle);
	
	QPushButton *integerButton = new QPushButton(tr("QInputDialog::get&Integer()"));
	
	doubleLabel = new QLabel;
	doubleLabel->setFrameStyle(frameStyle);
	QPushButton *doubleButton = new QPushButton(tr("QInputDialog::get&Double()"));
	
	itemLabel = new QLabel;
	itemLabel->setFrameStyle(frameStyle);
	QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));
	
	textLabel = new QLabel;
	textLabel->setFrameStyle(frameStyle);
	QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));
	
	colorLabel= new QLabel;
	colorLabel->setFrameStyle(frameStyle);
	QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));
	
	fontLabel = new QLabel;
	fontLabel->setFrameStyle(frameStyle);
	QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));
	
	directoryLabel = new QLabel;
	directoryLabel->setFrameStyle(frameStyle);
	QPushButton *directoryButton = new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

	openFileNameLabel = new QLabel;
	openFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNameButton = new QPushButton(tr("QFileDialog::get&OpenFileName()"));
	
	openFileNamesLabel = new QLabel;
	openFileNamesLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNamesButton = new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

	
	saveFileNameLabel = new QLabel;
	saveFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *saveFileNameButton = new QPushButton(tr("QFileDialog::get&SaveFileName()"));

	criticalLabel = new QLabel;
	criticalLabel->setFrameStyle(frameStyle);
	QPushButton *criticalButton = new QPushButton(tr("QMessageBox::critica&l()"));

	informationLabel = new QLabel;
	informationLabel->setFrameStyle(frameStyle);
	QPushButton *informationButton = new QPushButton(tr("QMessageBox::i&nformation()"));

	questionLabel = new QLabel;
	questionLabel->setFrameStyle(frameStyle);
	QPushButton *questionButton = new QPushButton(tr("QMessageBox::&question()"));

	warningLabel = new QLabel;
	warningLabel->setFrameStyle(frameStyle);
	QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
	
	errorLabel = new QLabel;
	errorLabel->setFrameStyle(frameStyle);
	QPushButton *errorButton = new QPushButton(tr("QMessageBox::&error()"));
	
	connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
	connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
	connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
	connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
	connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
	connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(directoryButton, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
	connect(openFileNameButton, SIGNAL(clicked()), this, SLOT(setOpenFileName()));
	connect(openFileNamesButton, SIGNAL(clicked()), this, SLOT(setOpenFileNames()));
	connect(saveFileNameButton, SIGNAL(clicked()), this, SLOT(setSaveFileName()));
	connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
	connect(informationButton, SIGNAL(clicked()), this, SLOT(informationMessage()));
	connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
	connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
	connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

	native = new QCheckBox(this);
	native->setText("Use native file dialog");
	native->setChecked(true);

#ifndef Q_WS_WIN
#ifndef Q_OS_MAC

	native->hide();
#endif
#endif

	QGridLayout *layout = new QGridLayout;
	layout->setColumnStretch(1, 1);		
	layout->setColumnMinimumWidth(1, 250);
	layout->addWidget(integerButton, 0, 0);
	layout->addWidget(integerLabel, 0, 1);
	layout->addWidget(doubleButton, 1, 0);
	layout->addWidget(doubleLabel, 1, 1);
	layout->addWidget(itemButton, 2, 0);
	layout->addWidget(itemLabel, 2, 1);
	layout->addWidget(textButton, 3, 0);
	layout->addWidget(textLabel, 3, 1);
	layout->addWidget(colorButton, 4, 0);
	layout->addWidget(colorLabel, 4, 1);
	layout->addWidget(fontButton, 5, 0);
	layout->addWidget(fontLabel, 5, 1);
	layout->addWidget(directoryButton, 6, 0);
	layout->addWidget(directoryLabel, 6, 1);
	layout->addWidget(openFileNameButton, 7, 0);
	layout->addWidget(openFileNameLabel, 7, 1);
	layout->addWidget(openFileNamesButton, 8, 0);
	layout->addWidget(openFileNamesLabel, 8, 1);
	layout->addWidget(saveFileNameButton, 9, 0);
	layout->addWidget(saveFileNameLabel, 9, 1);
	layout->addWidget(criticalButton, 10, 0);
	layout->addWidget(criticalLabel, 10, 1);
	layout->addWidget(informationButton, 11, 0);
	layout->addWidget(informationLabel, 11, 1);
	layout->addWidget(questionButton, 12, 0);
	layout->addWidget(questionLabel, 12, 1);
	layout->addWidget(warningButton, 13, 0);
	layout->addWidget(warningLabel, 13, 1);
	layout->addWidget(errorButton, 14, 0);
	layout->addWidget(errorLabel, 14, 1);

	layout->addWidget(native, 15, 0);

	setLayout(layout);

	setWindowTitle("Standard Dialogs");
}
Exemplo n.º 23
0
void Record::setInteger(Field& field, integer value)
{
	setInteger(field.getName(),value);
}
Exemplo n.º 24
0
void Record::setInteger(string fieldName, integer value)
{
	if (Field* field = fieldByName(fieldName))
		setInteger(field->getIndex(), value);
}
Exemplo n.º 25
0
void Config::setBool(const char *name, bool val){
	setInteger(name, val);
}
Exemplo n.º 26
0
void CC3GLSLUniform::setInteger( GLint value )
{
	setInteger( value, 0 ); 
}
Exemplo n.º 27
0
Item::e_sercode Item::deserialize( Stream *file, VMachine *vm )
{
   byte type = FLC_ITEM_NIL;
   if ( file->read((byte *) &type, 1 ) == 0 )
      return sc_eof;

   if( ! file->good() )
      return sc_ferror;

   switch( type )
   {
      case FLC_ITEM_NIL:
         setNil();
      return sc_ok;

      case FLC_ITEM_UNB:
         setUnbound();
         return sc_ok;

      case FLC_ITEM_BOOL:
      {
         byte bval;
         file->read( (byte *) &bval, sizeof( bval ) );
         if ( file->good() ) {
            setBoolean( bval != 0 );
            return sc_ok;
         }
         return sc_ferror;
      }
      return sc_ok;

      case FLC_ITEM_INT:
      {
         int64 val;
         file->read( (byte *) &val, sizeof( val ) );
         if ( file->good() ) {
            setInteger(endianInt64(val) );
            return sc_ok;
         }
         return sc_ferror;
      }
      break;

      case FLC_ITEM_RANGE:
      {
         int64 val1;
         int64 val2;
         int64 val3;
         //byte isOpen;

         file->read( (byte *) &val1, sizeof( val1 ) );
         file->read( (byte *) &val2, sizeof( val2 ) );
         file->read( (byte *) &val3, sizeof( val3 ) );
         //file->read( (byte *) &isOpen, sizeof( isOpen ) );

         val1 = endianInt64( val1 );
         val2 = endianInt64( val2 );
         val3 = endianInt64( val3 );

         if ( file->good() ) {
            setRange( new CoreRange( val1, val2, val3 ) );
            return sc_ok;
         }
         return sc_ferror;
      }
      break;

      case FLC_ITEM_NUM:
      {
         numeric val;
         file->read( (byte *) &val, sizeof( val ) );
         if ( file->good() ) {
            setNumeric( endianNum( val ) );
            return sc_ok;
         }
         return sc_ferror;
      }
      break;

      case FLC_ITEM_LBIND:
      {
         int32 id;
         file->read( (byte*) &id, sizeof(id) );
         String name;
         if ( ! name.deserialize( file ) )
            return file->bad() ? sc_ferror : sc_invformat;

         setLBind( new CoreString( name ) );
      }
      break;

      case FLC_ITEM_STRING:
      {
         CoreString *cs = new CoreString;
         setString( cs );

         if ( ! cs->deserialize( file ) )
         {
            return file->bad() ? sc_ferror : sc_invformat;
         }

         if ( file->good() ) {
            return sc_ok;
         }

         return sc_ferror;
      }
      break;

      case FLC_ITEM_MEMBUF |0x80:
      {
         // get the function pointer in the stream
         /*MemBuf *(*deserializer)( VMachine *, Stream * );
         file->read( &deserializer, sizeof( deserializer ) );
         if ( ! file->good() ) {
            return sc_ferror;
         }

         MemBuf *mb = deserializer( vm, file );
         if( mb == 0 )
         {
            return sc_invformat;
         }*/

         MemBuf* mb;
         if( file->read( &mb, sizeof( mb ) ) == sizeof(mb) )
         {
            setMemBuf( mb );
            return sc_ok;
         }
         return sc_eof;
      }

      case FLC_ITEM_MEMBUF:
      {
         MemBuf *mb = MemBuf::deserialize( vm, file );
         if ( file->good() && mb != 0 ) {
            setMemBuf( mb );
            return sc_ok;
         }

         return sc_ferror;
      }
      break;


      case FLC_ITEM_ARRAY:
      {
         int32 val;
         file->read( (byte *) &val, sizeof( val ) );
         e_sercode retval = sc_ok;

         if ( file->good() )
         {
            val = endianInt32(val);
            CoreArray *array = new CoreArray();
            array->resize(val);

            for( int i = 0; i < val; i ++ )
            {
               retval = array->items()[i].deserialize( file, vm );
               if( retval != sc_ok ) {
                  break;
               }

            }

            if ( retval == sc_ok ) {
               setArray( array );
               return sc_ok;
            }

            return retval;
         }
      }
      break;

      case FLC_ITEM_DICT:
      {
         byte blessed;
         file->read( &blessed, 1 );

         int32 val;
         file->read( (byte *) &val, sizeof( val ) );

         if ( file->good() )
         {
            val = endianInt32(val);
            LinearDict *dict = new LinearDict( val );
            LinearDictEntry *elems = dict->entries();
            e_sercode retval = sc_ok;
            for( int i = 0; i < val; i ++ ) {
               LinearDictEntry *entry = elems + i;
               retval = entry->key().deserialize( file, vm );
               if( retval == sc_ok )
                    retval = entry->value().deserialize( file, vm );

               if ( retval != sc_ok )
                  break;
               dict->length( i + 1 );
            }

            if( retval == sc_ok ) {
               CoreDict* cdict = new CoreDict( dict );
               cdict->bless( blessed ? true : false );
               setDict( cdict );

               return sc_ok;
            }
            else
               delete dict;

            return retval;
         }
      }
      break;

      case FLC_ITEM_FUNC | 0x80:
      case FLC_ITEM_FUNC:
      {
         if( vm == 0 )
            return sc_missvm;

         return deserialize_function( file, vm );
      }
     break;

      case FLC_ITEM_METHOD:
      {
         if( vm == 0 )
            return sc_missvm;

         Item obj;
         Item func;
         e_sercode sc;
         sc = obj.deserialize( file, vm );
         if ( sc != sc_ok )
            return sc;

         sc = func.deserialize( file, vm );
         if ( sc != sc_ok )
            return sc;
         if ( func.isFunction() )
            setMethod( obj, func.asMethodFunc() );
         else if ( func.isArray() && func.isCallable() )
         {
            setMethod( obj, func.asArray() );
         }
         else
            return sc_invformat;

         return sc_ok;
      }


      case FLC_ITEM_OBJECT | 0x80:
      case FLC_ITEM_OBJECT:
      {
         bool bLive = type != FLC_ITEM_OBJECT;

         if( vm == 0 )
            return sc_missvm;

         // read the module name
         Symbol *sym;
         LiveModule *lmod;
         e_sercode sc = deserialize_symbol( file, vm, &sym, &lmod );
         if ( sc != sc_ok  )
            return sc;

         Item *clitem = &lmod->globals()[ sym->itemId() ];

         // Create the core object, but don't fill attribs.
         CoreObject *object = clitem->dereference()->asClass()->createInstance(0, true);
         if ( ! object->deserialize( file, bLive ) )
         {
            return sc_missclass;
         }

         setObject( object );
         return file->good() ? sc_ok : sc_ferror;
      }
      break;

      case FLC_ITEM_CLASS:
         return deserialize_class( file, vm );


       case FLC_ITEM_CLSMETHOD:
       {
         e_sercode sc = deserialize_class( file, vm );
         if ( sc != sc_ok )
            return sc;
         return deserialize_function( file, vm );
      }
      break;

      default:
         return sc_invformat;
   }

   return sc_ferror;
}
Exemplo n.º 28
0
	Register(int val) {
		setInteger(val);
	};
Exemplo n.º 29
0
Variant::Variant(int integer)
{
	setInteger( integer );
}