예제 #1
0
void TextEdit::focusOutEvent(QFocusEvent*)
{
  if (isVisible()) {
    emit editingFinished(toPlainText());
  }
}
예제 #2
0
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
  GenericPanel(parent, model, generalSettings, firmware),
  functions(model ? model->customFn : generalSettings.customFn)
#if defined(PHONON)
  ,
  phononCurrent(-1),
  clickObject(NULL),
  clickOutput(NULL)
#endif
{
  Stopwatch s1("CustomFunctionsPanel - populate"); 
  lock = true;
  int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);

  if (!firmware->getCapability(VoicesAsNumbers)) {
    tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (functions[i].func==FuncPlayPrompt || functions[i].func==FuncBackgroundMusic) {
        QString temp = functions[i].paramarm;
        if (!temp.isEmpty()) {
          tracksSet.insert(temp);
        }
      }
    }
  }

  s1.report("get tracks");

  if (IS_TARANIS(firmware->getBoard())) {
    scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (functions[i].func==FuncPlayScript) {
        QString temp = functions[i].paramarm;
        if (!temp.isEmpty()) {
          scriptsSet.insert(temp);
        }
      }
    }
  }
  s1.report("get scripts");

  CompanionIcon playIcon("play.png");

  QStringList headerLabels;
  headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable");
  TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels);

  for (int i=0; i<num_fsw; i++) {
    // The label
    QLabel * label = new QLabel(this);
    label->setContextMenuPolicy(Qt::CustomContextMenu);
    label->setMouseTracking(true);
    label->setProperty("index", i);
    if (model)
      label->setText(tr("SF%1").arg(i+1));
    else
      label->setText(tr("GF%1").arg(i+1));
    label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
    connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
    tableLayout->addWidget(i, 0, label);
    // s1.report("label");

    // The switch
    fswtchSwtch[i] = new QComboBox(this);
    fswtchSwtch[i]->setProperty("index", i);
    populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
    fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
    fswtchSwtch[i]->setMaxVisibleItems(10);
    connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    tableLayout->addWidget(i, 1, fswtchSwtch[i]);
    // s1.report("switch");

    // The function
    fswtchFunc[i] = new QComboBox(this);
    fswtchFunc[i]->setProperty("index", i);
    populateFuncCB(fswtchFunc[i], functions[i].func);
    connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
    tableLayout->addWidget(i, 2, fswtchFunc[i]);
    // s1.report("func");

    // The parameters
    QHBoxLayout * paramLayout = new QHBoxLayout();
    tableLayout->addLayout(i, 3, paramLayout);

    fswtchGVmode[i] = new QComboBox(this);
    fswtchGVmode[i]->setProperty("index", i);
    populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
    fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchGVmode[i]);

    fswtchParamGV[i] = new QCheckBox(this);
    fswtchParamGV[i]->setProperty("index", i);
    fswtchParamGV[i]->setText("GV");
    fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamGV[i]);

    fswtchParam[i] = new QDoubleSpinBox(this);
    fswtchParam[i]->setProperty("index", i);
    fswtchParam[i]->setAccelerated(true);
    fswtchParam[i]->setDecimals(0);
    connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParam[i]);

    fswtchParamTime[i] = new QTimeEdit(this);
    fswtchParamTime[i]->setProperty("index", i);
    fswtchParamTime[i]->setAccelerated(true);
    fswtchParamTime[i]->setDisplayFormat("hh:mm:ss");
    connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamTime[i]);

    fswtchParamT[i] = new QComboBox(this);
    fswtchParamT[i]->setProperty("index", i);
    populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
    paramLayout->addWidget(fswtchParamT[i]);
    fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));

    fswtchParamArmT[i] = new QComboBox(this);
    fswtchParamArmT[i]->setProperty("index", i);
    fswtchParamArmT[i]->setEditable(true);
    fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    paramLayout->addWidget(fswtchParamArmT[i]);

    connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));

    fswtchBLcolor[i] = new QSlider(this);
    fswtchBLcolor[i]->setProperty("index", i);
    fswtchBLcolor[i]->setMinimum(0);
    fswtchBLcolor[i]->setMaximum(100);
    fswtchBLcolor[i]->setSingleStep(1);
    fswtchBLcolor[i]->setOrientation(Qt::Horizontal);
    paramLayout->addWidget(fswtchBLcolor[i]);
    connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));

#ifdef PHONON
    playBT[i] = new QPushButton(this);
    playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    playBT[i]->setProperty("index", i);
    playBT[i]->setIcon(playIcon);
    paramLayout->addWidget(playBT[i]);
    connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif

    QHBoxLayout * repeatLayout = new QHBoxLayout();
    tableLayout->addLayout(i, 4, repeatLayout);
    fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam);
    repeatLayout->addWidget(fswtchRepeat[i], i+1);
    connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));

    fswtchEnable[i] = new QCheckBox(this);
    fswtchEnable[i]->setProperty("index", i);
    fswtchEnable[i]->setText(tr("ON"));
    fswtchEnable[i]->setFixedWidth(200);
    repeatLayout->addWidget(fswtchEnable[i], i+1);
    connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
  }
  s1.report("add items");

  disableMouseScrolling();
  s1.report("disableMouseScrolling");

  lock = false;

  update();
  s1.report("update");
  tableLayout->resizeColumnsToContents();
  s1.report("resizeColumnsToContents");
  tableLayout->setColumnWidth(3, 300);
  tableLayout->pushRowsUp(num_fsw+1);
  s1.report("end");
}
예제 #3
0
GeneralForm::GeneralForm(SettingsWidget *myParent) :
    GenericForm(QPixmap(":/img/settings/general.png"))
{
    parent = myParent;

    bodyUI = new Ui::GeneralSettings;
    bodyUI->setupUi(this);

    bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
    bodyUI->checkUpdates->setChecked(Settings::getInstance().getCheckUpdates());

    bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
    for (int i = 0; i < langs.size(); i++)
        bodyUI->transComboBox->insertItem(i, langs[i]);

    bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
    bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
#if defined(__APPLE__) && defined(__MACH__)
    bodyUI->cbAutorun->setEnabled(false);
#endif

    bool showSystemTray = Settings::getInstance().getShowSystemTray();

    bodyUI->showSystemTray->setChecked(showSystemTray);
    bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray());
    bodyUI->startInTray->setEnabled(showSystemTray);
    bodyUI->closeToTray->setChecked(Settings::getInstance().getCloseToTray());
    bodyUI->closeToTray->setEnabled(showSystemTray);
    bodyUI->minimizeToTray->setChecked(Settings::getInstance().getMinimizeToTray());
    bodyUI->minimizeToTray->setEnabled(showSystemTray);
    bodyUI->lightTrayIcon->setChecked(Settings::getInstance().getLightTrayIcon());
    bodyUI->lightTrayIcon->setEnabled(showSystemTray);

    bodyUI->statusChanges->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
    bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
    bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
    bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
    bodyUI->showWindow->setChecked(Settings::getInstance().getShowWindow());
    bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
    bodyUI->notifySound->setChecked(Settings::getInstance().getNotifySound());
    bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
    bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
    bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
    bodyUI->cbSeparateWindow->setChecked(Settings::getInstance().getSeparateWindow());
    bodyUI->cbDontGroupWindows->setChecked(Settings::getInstance().getDontGroupWindows());
    bodyUI->cbDontGroupWindows->setEnabled(bodyUI->cbSeparateWindow->isChecked());
    bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());

    for (auto entry : SmileyPack::listSmileyPacks())
        bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);

    bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
    reloadSmiles();
    bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());

    bodyUI->styleBrowser->addItem(tr("None"));
    bodyUI->styleBrowser->addItems(QStyleFactory::keys());
    if (QStyleFactory::keys().contains(Settings::getInstance().getStyle()))
        bodyUI->styleBrowser->setCurrentText(Settings::getInstance().getStyle());
    else
        bodyUI->styleBrowser->setCurrentText(tr("None"));

    for (QString color : Style::getThemeColorNames())
        bodyUI->themeColorCBox->addItem(color);

    bodyUI->themeColorCBox->setCurrentIndex(Settings::getInstance().getThemeColor());

    bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());

    QStringList timestamps;
    for (QString timestamp : timeFormats)
        timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));

    bodyUI->timestamp->addItems(timestamps);

    QLocale ql;
    QStringList datestamps;
    dateFormats.append(ql.dateFormat());
    dateFormats.append(ql.dateFormat(QLocale::LongFormat));
    dateFormats.removeDuplicates();
    timeFormats.append(ql.timeFormat());
    timeFormats.append(ql.timeFormat(QLocale::LongFormat));
    timeFormats.removeDuplicates();

    for (QString datestamp : dateFormats)
        datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));

    bodyUI->dateFormats->addItems(datestamps);

    bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getTimestampFormat(), QTime::currentTime().toString(Settings::getInstance().getTimestampFormat())));

    bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getDateFormat(), QDate::currentDate().toString(Settings::getInstance().getDateFormat())));

    bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime());

    bodyUI->cbEnableUDP->setChecked(!Settings::getInstance().getForceTCP());
    bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
    int port = Settings::getInstance().getProxyPort();
    if (port != -1)
        bodyUI->proxyPort->setValue(port);

    bodyUI->proxyType->setCurrentIndex(static_cast<int>(Settings::getInstance().getProxyType()));
    onUseProxyUpdated();

    //general
    connect(bodyUI->checkUpdates, &QCheckBox::stateChanged, this, &GeneralForm::onCheckUpdateChanged);
    connect(bodyUI->transComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTranslationUpdated()));
    connect(bodyUI->cbAutorun, &QCheckBox::stateChanged, this, &GeneralForm::onAutorunUpdated);
    connect(bodyUI->lightTrayIcon, &QCheckBox::stateChanged, this, &GeneralForm::onSetLightTrayIcon);
    connect(bodyUI->showSystemTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowSystemTray);
    connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray);
    connect(bodyUI->closeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
    connect(bodyUI->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
    connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
    connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
    connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
    connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
    connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
    connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
    connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
    connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
    //theme
    connect(bodyUI->useEmoticons, &QCheckBox::stateChanged, this, &GeneralForm::onUseEmoticonsChange);
    connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
    connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
    connect(bodyUI->themeColorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeColorChanged(int)));
    connect(bodyUI->emoticonSize, SIGNAL(editingFinished()), this, SLOT(onEmoticonSizeChanged()));
    connect(bodyUI->timestamp, SIGNAL(currentIndexChanged(int)), this, SLOT(onTimestampSelected(int)));
    connect(bodyUI->dateFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(onDateFormatSelected(int)));
    //connection
    connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &GeneralForm::onEnableIPv6Updated);
    connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
    connect(bodyUI->proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onUseProxyUpdated()));
    connect(bodyUI->proxyAddr, &QLineEdit::editingFinished, this, &GeneralForm::onProxyAddrEdited);
    connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
    connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
    connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
    connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
    connect(bodyUI->cbSeparateWindow, &QCheckBox::stateChanged, this, &GeneralForm::onSeparateWindowChanged);
    connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged);
    connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);

    // prevent stealing mouse whell scroll
    // scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
    // you can scroll through general settings without accidentially chaning theme/skin/icons etc.
    // @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
    for (QComboBox* cb : findChildren<QComboBox*>())
    {
            cb->installEventFilter(this);
            cb->setFocusPolicy(Qt::StrongFocus);
    }

    for (QSpinBox* sp : findChildren<QSpinBox*>())
    {
            sp->installEventFilter(this);
            sp->setFocusPolicy(Qt::WheelFocus);
    }

#ifndef QTOX_PLATFORM_EXT
    bodyUI->autoAwayLabel->setEnabled(false);   // these don't seem to change the appearance of the widgets,
    bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
#endif

    Translator::registerHandler(std::bind(&GeneralForm::retranslateUi, this), this);
}
예제 #4
0
enum SetResponse creditMemoItem::set(const ParameterList &pParams)
{
  XSqlQuery creditet;
  XDialog::set(pParams);
  QVariant param;
  bool     valid;
  bool     vrestrict = FALSE;

  param = pParams.value("cmhead_id", &valid);
  if (valid)
  {
    _cmheadid = param.toInt();
    creditet.prepare("SELECT cmhead_cust_id, cmhead_shipto_id, "
			  "       cmhead_number, COALESCE(cmhead_invcnumber, '-1') AS cmhead_invcnumber, "
			  "       cmhead_docdate, cmhead_curr_id, "
			  "       cmhead_taxzone_id, cmhead_rsncode_id "
              "FROM cmhead "
              "WHERE (cmhead_id=:cmhead_id);");
    creditet.bindValue(":cmhead_id", _cmheadid);
    creditet.exec();
    if (creditet.first())
    {
      _custid = creditet.value("cmhead_cust_id").toInt();
      _shiptoid = creditet.value("cmhead_shipto_id").toInt();
      _orderNumber->setText(creditet.value("cmhead_number").toString());
	  _invoiceNumber = creditet.value("cmhead_invcnumber").toInt();
	  if ( (_invoiceNumber != -1) && (_metrics->boolean("RestrictCreditMemos")) )
        vrestrict = TRUE;
      _taxzoneid = creditet.value("cmhead_taxzone_id").toInt();
      _tax->setId(creditet.value("cmhead_curr_id").toInt());
      _tax->setEffective(creditet.value("cmhead_docdate").toDate());
      _netUnitPrice->setId(creditet.value("cmhead_curr_id").toInt());
      _netUnitPrice->setEffective(creditet.value("cmhead_docdate").toDate());
      _rsnCode->setId(creditet.value("cmhead_rsncode_id").toInt());
    }
    else if (creditet.lastError().type() != QSqlError::NoError)
    {
      systemError(this, creditet.lastError().databaseText(), __FILE__, __LINE__);
      return UndefinedError;
    }
  }

  param = pParams.value("cmitem_id", &valid);
  if (valid)
  {
    _cmitemid = param.toInt();
    populate();
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      creditet.prepare( "SELECT (COALESCE(MAX(cmitem_linenumber), 0) + 1) AS n_linenumber "
                 "FROM cmitem "
                 "WHERE (cmitem_cmhead_id=:cmhead_id);" );
      creditet.bindValue(":cmhead_id", _cmheadid);
      creditet.exec();
      if (creditet.first())
        _lineNumber->setText(creditet.value("n_linenumber").toString());
      else if (creditet.lastError().type() == QSqlError::NoError)
      {
	      systemError(this, creditet.lastError().databaseText(), __FILE__, __LINE__);
	      return UndefinedError;
      }

      connect(_discountFromSale, SIGNAL(editingFinished()), this, SLOT(sCalculateFromDiscount()));
      connect(_item, SIGNAL(valid(bool)), _listPrices, SLOT(setEnabled(bool)));
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      _item->setReadOnly(TRUE);
      _warehouse->setEnabled(FALSE);

      connect(_discountFromSale, SIGNAL(editingFinished()), this, SLOT(sCalculateFromDiscount()));
      connect(_item, SIGNAL(valid(bool)), _listPrices, SLOT(setEnabled(bool)));
    }
    else if (param.toString() == "view")
    {
      _mode = cView;

      _item->setReadOnly(TRUE);
      _warehouse->setEnabled(FALSE);
      _qtyReturned->setEnabled(FALSE);
      _qtyToCredit->setEnabled(FALSE);
      _netUnitPrice->setEnabled(FALSE);
      _discountFromSale->setEnabled(FALSE);
      _comments->setReadOnly(TRUE);
      _taxType->setEnabled(FALSE);
      _rsnCode->setEnabled(FALSE);

      _save->hide();
      _close->setText(tr("&Close"));
    }
  }

  if (vrestrict)
    _item->setQuery( QString( "SELECT DISTINCT item_id, item_number,"
                              "                (item_descrip1 || ' ' || item_descrip2) AS itemdescrip,"
                              "                item_upccode,"
                              "                item_descrip1, item_descrip2,"
                              "                item_active, item_config, item_type, uom_name, item_upccode "
                              "FROM invchead, invcitem, item, uom "
                              "WHERE ( (invcitem_invchead_id=invchead_id)"
                              " AND (invcitem_item_id=item_id)"
                              " AND (item_inv_uom_id=uom_id)"
                              " AND (invchead_invcnumber='%1') ) "
                              "ORDER BY item_number" )
                     .arg(_invoiceNumber) );
  else
    _item->addExtraClause( QString("(item_id IN (SELECT custitem FROM custitem(%1, %2) ) )").arg(_custid).arg(_shiptoid) );

  return NoError;
}
예제 #5
0
void CMainFrame::_connectWidgets()
{
	connect(ui.actionOuvrir, SIGNAL(triggered()), this, SLOT(OpenFile()));
	connect(ui.actionFermer, SIGNAL(triggered()), this, SLOT(CloseFile()));
	connect(ui.actionFusionner, SIGNAL(triggered()), this, SLOT(MergeFile()));
	connect(ui.actionPlein_cran, SIGNAL(triggered(bool)), this, SLOT(SwitchFullscreen(bool)));
	connect(ui.actionStop, SIGNAL(triggered()), this, SLOT(Stop()));
	connect(ui.actionJouer, SIGNAL(triggered(bool)), this, SLOT(Play(bool)));
	connect(ui.action_propos, SIGNAL(triggered()), this, SLOT(About()));
	connect(ui.actionQt, SIGNAL(triggered()), this, SLOT(AboutQt()));
	connect(ui.actionGrille, SIGNAL(triggered(bool)), this, SLOT(ShowGrid(bool)));
	connect(ui.actionModel_3D, SIGNAL(triggered(bool)), m_modelViewer, SLOT(ShowModel3D(bool)));
	connect(ui.actionEnregistrer, SIGNAL(triggered()), this, SLOT(SaveFile()));
	connect(ui.actionEnregistrer_sous, SIGNAL(triggered()), this, SLOT(SaveFileAs()));
	connect(ui.actionCouleur_du_fond, SIGNAL(triggered()), this, SLOT(SetBackgroundColor()));
	connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(SetLanguage(QAction*)));

	connect(m_timeline, SIGNAL(CurrentFrameChanged(int)), m_modelViewer, SLOT(SetFrame(int)));
	connect(m_timeline, SIGNAL(SelectionChanged(int, int)), this, SLOT(EditKey(int, int)));
	connect(m_timeline, SIGNAL(KeyModified(int, int, bool)), this, SLOT(EditKeyModified(int, int, bool)));
	connect(ui.listParts, SIGNAL(currentRowChanged(int)), this, SLOT(ListPartChanged(int)));

	connect(ui.actionAjouter_une_partie, SIGNAL(triggered()), this, SLOT(AddPart()));
	connect(ui.actionSupprimer_la_partie, SIGNAL(triggered()), this, SLOT(RemovePart()));
	connect(ui.btnRemovePart, SIGNAL(clicked()), this, SLOT(RemovePart()));
	connect(ui.btnAddPart, SIGNAL(clicked()), this, SLOT(AddPart()));

	connect(ui.editKeyPosX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosX(double)));
	connect(ui.editKeyPosY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosY(double)));
	connect(ui.editKeyPosZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosZ(double)));
	connect(ui.editKeyPosRotX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotX(double)));
	connect(ui.editKeyPosRotY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotY(double)));
	connect(ui.editKeyPosRotZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotZ(double)));
	connect(ui.editKeyRotX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotX(double)));
	connect(ui.editKeyRotY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotY(double)));
	connect(ui.editKeyRotZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotZ(double)));
	connect(ui.editKeyScaleX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleX(double)));
	connect(ui.editKeyScaleY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleY(double)));
	connect(ui.editKeyScaleZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleZ(double)));
	connect(ui.editKeyAlpha, SIGNAL(valueChanged(int)), this, SLOT(EditKeyAlpha(int)));

	connect(ui.editPartName, SIGNAL(textEdited(const QString&)), this, SLOT(EditPartName(const QString&)));
	connect(ui.editPartVisible, SIGNAL(toggled(bool)), this, SLOT(EditPartVisible(bool)));
	connect(ui.editPartBill, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(EditPartBill(const QString&)));
	connect(ui.editPartBlend, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(EditPartAlpha(const QString&)));
	connect(ui.editPartTexture, SIGNAL(editingFinished()), this, SLOT(EditPartTextureName()));
	connect(ui.btnSetPartTexture, SIGNAL(clicked()), this, SLOT(EditPartTexture()));
	connect(ui.editPartTexFrame, SIGNAL(valueChanged(int)), this, SLOT(EditPartTexFrame(int)));
	connect(ui.editPartTexLoop, SIGNAL(valueChanged(int)), this, SLOT(EditPartTexLoop(int)));
	connect(ui.editCustomMeshPointCount, SIGNAL(valueChanged(int)), this, SLOT(EditPartPointCount(int)));
	connect(ui.editParticleCreate, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleCreate(int)));
	connect(ui.editParticleCreateNum, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleCreateNum(int)));
	connect(ui.editParticleFrameAppear, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameAppear(int)));
	connect(ui.editParticleFrameKeep, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameKeep(int)));
	connect(ui.editParticleFrameDisappear, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameDisappear(int)));
	connect(ui.editParticleStartPosVar, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleStartPosVar(double)));
	connect(ui.editParticleStartPosVarY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleStartPosVarY(double)));
	connect(ui.editParticleYLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleYLow(double)));
	connect(ui.editParticleYHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleYHigh(double)));
	connect(ui.editParticleXZLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleXZLow(double)));
	connect(ui.editParticleXZHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleXZHigh(double)));
	connect(ui.editParticleAccelX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelX(double)));
	connect(ui.editParticleAccelY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelY(double)));
	connect(ui.editParticleAccelZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelZ(double)));
	connect(ui.editParticleScaleX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleX(double)));
	connect(ui.editParticleScaleY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleY(double)));
	connect(ui.editParticleScaleZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleZ(double)));
	connect(ui.editParticleRotationLowX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowX(double)));
	connect(ui.editParticleRotationLowY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowY(double)));
	connect(ui.editParticleRotationLowZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowZ(double)));
	connect(ui.editParticleRotationHighX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighX(double)));
	connect(ui.editParticleRotationHighY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighY(double)));
	connect(ui.editParticleRotationHighZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighZ(double)));
	connect(ui.editParticleScalSpeedXLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedXLow(double)));
	connect(ui.editParticleScalSpeedYLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedYLow(double)));
	connect(ui.editParticleScalSpeedZLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedZLow(double)));
	connect(ui.editParticleScalSpeedXHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedXHigh(double)));
	connect(ui.editParticleScalSpeedYHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedYHigh(double)));
	connect(ui.editParticleScalSpeedZHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedZHigh(double)));
	connect(ui.editParticleRepeatScale, SIGNAL(toggled(bool)), this, SLOT(EditPartParticleRepeatScale(bool)));
	connect(ui.editParticleRepeat, SIGNAL(toggled(bool)), this, SLOT(EditPartParticleRepeat(bool)));
	connect(ui.editParticleScaleEndX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndX(double)));
	connect(ui.editParticleScaleEndY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndY(double)));
	connect(ui.editParticleScaleEndZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndZ(double)));
	connect(ui.editParticleScaleSpeedX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedX(double)));
	connect(ui.editParticleScaleSpeedY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedY(double)));
	connect(ui.editParticleScaleSpeedZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedZ(double)));
}
예제 #6
0
파일: mount.cpp 프로젝트: cardinot/kstars
Mount::Mount()
{
    setupUi(this);
    new MountAdaptor(this);
    QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Mount",  this);

    currentTelescope = NULL;

    stopB->setIcon(QIcon::fromTheme("process-stop"));
    northB->setIcon(QIcon::fromTheme("go-up"));
    westB->setIcon(QIcon::fromTheme("go-previous"));
    eastB->setIcon(QIcon::fromTheme("go-next"));
    southB->setIcon(QIcon::fromTheme("go-down"));

    abortDispatch = -1;

    minAltLimit->setValue(Options::minimumAltLimit());
    maxAltLimit->setValue(Options::maximumAltLimit());


    QFile tempFile;

    if (KSUtils::openDataFile( tempFile, "go-nw.png" ) )
    {
        northwestB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-ne.png" ) )
    {
        northeastB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-sw.png" ) )
    {
        southwestB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-se.png" ) )
    {
        southeastB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    connect(northB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northB, SIGNAL(released()), this, SLOT(stop()));
    connect(westB, SIGNAL(pressed()), this, SLOT(move()));
    connect(westB, SIGNAL(released()), this, SLOT(stop()));
    connect(southB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southB, SIGNAL(released()), this, SLOT(stop()));
    connect(eastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(eastB, SIGNAL(released()), this, SLOT(stop()));
    connect(northeastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northeastB, SIGNAL(released()), this, SLOT(stop()));
    connect(northwestB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northwestB, SIGNAL(released()), this, SLOT(stop()));
    connect(southeastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southeastB, SIGNAL(released()), this, SLOT(stop()));
    connect(southwestB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southwestB, SIGNAL(released()), this, SLOT(stop()));
    connect(stopB, SIGNAL(clicked()), this, SLOT(stop()));
    connect(saveB, SIGNAL(clicked()), this, SLOT(save()));

    connect(minAltLimit, SIGNAL(editingFinished()), this, SLOT(saveLimits()));
    connect(maxAltLimit, SIGNAL(editingFinished()), this, SLOT(saveLimits()));

    connect(enableLimitsCheck, SIGNAL(toggled(bool)), this, SLOT(enableAltitudeLimits(bool)));
    enableLimitsCheck->setChecked(Options::enableAltitudeLimits());
    altLimitEnabled = enableLimitsCheck->isChecked();
}
VESPERS2DScanConfigurationView::VESPERS2DScanConfigurationView(VESPERS2DScanConfiguration *config, QWidget *parent)
	: VESPERSScanConfigurationView(parent)
{
	configuration_ = config;
	AMTopFrame *frame = new AMTopFrame("VESPERS 2D Map Configuration");

	// Setup the group box for setting the start and end points.
	QGroupBox *positionsBox = new QGroupBox("Positions");

	hStart_ = createPositionDoubleSpinBox("H: ", " mm", configuration_->scanAxisAt(0)->regionAt(0)->regionStart(), 3);
	connect(hStart_, SIGNAL(editingFinished()), this, SLOT(onXStartChanged()));
	connect(configuration_->scanAxisAt(0)->regionAt(0), SIGNAL(regionStartChanged(AMNumber)), this, SLOT(setXAxisStart(AMNumber)));

	vStart_ = createPositionDoubleSpinBox("V: ", " mm", configuration_->scanAxisAt(1)->regionAt(0)->regionStart(), 3);
	connect(vStart_, SIGNAL(editingFinished()), this, SLOT(onYStartChanged()));
	connect(configuration_->scanAxisAt(1)->regionAt(0), SIGNAL(regionStartChanged(AMNumber)), this, SLOT(setYAxisStart(AMNumber)));

	QPushButton *startUseCurrentButton = new QPushButton("Use Current");
	connect(startUseCurrentButton, SIGNAL(clicked()), this, SLOT(onSetStartPosition()));

	QHBoxLayout *startPointLayout = new QHBoxLayout;
	startPointLayout->addWidget(new QLabel("Start:"));
	startPointLayout->addWidget(hStart_);
	startPointLayout->addWidget(vStart_);
	startPointLayout->addWidget(startUseCurrentButton);

	hEnd_ = createPositionDoubleSpinBox("H: ", " mm", configuration_->scanAxisAt(0)->regionAt(0)->regionEnd(), 3);
	connect(hEnd_, SIGNAL(editingFinished()), this, SLOT(onXEndChanged()));
	connect(configuration_->scanAxisAt(0)->regionAt(0), SIGNAL(regionEndChanged(AMNumber)), this, SLOT(setXAxisEnd(AMNumber)));

	vEnd_ = createPositionDoubleSpinBox("V: ", " mm", configuration_->scanAxisAt(1)->regionAt(0)->regionEnd(), 3);
	connect(vEnd_, SIGNAL(editingFinished()), this, SLOT(onYEndChanged()));
	connect(configuration_->scanAxisAt(1)->regionAt(0), SIGNAL(regionEndChanged(AMNumber)), this, SLOT(setYAxisEnd(AMNumber)));

	QPushButton *endUseCurrentButton = new QPushButton("Use Current");
	connect(endUseCurrentButton, SIGNAL(clicked()), this, SLOT(onSetEndPosition()));

	QHBoxLayout *endPointLayout = new QHBoxLayout;
	endPointLayout->addWidget(new QLabel("End:"));
	endPointLayout->addWidget(hEnd_);
	endPointLayout->addWidget(vEnd_);
	endPointLayout->addWidget(endUseCurrentButton);

	hStep_ = createPositionDoubleSpinBox("H: ", QString(" %1").arg(QString::fromUtf8("µm")), double(configuration_->scanAxisAt(0)->regionAt(0)->regionStep())*1000, 1);	// xStep needs to be in mm.
	connect(hStep_, SIGNAL(editingFinished()), this, SLOT(onXStepChanged()));
	connect(configuration_->scanAxisAt(0)->regionAt(0), SIGNAL(regionStepChanged(AMNumber)), this, SLOT(setXAxisStep(AMNumber)));

	vStep_ = createPositionDoubleSpinBox("V: ", QString(" %1").arg(QString::fromUtf8("µm")), double(configuration_->scanAxisAt(1)->regionAt(0)->regionStep())*1000, 1);	// yStep needs to be in mm.
	connect(vStep_, SIGNAL(editingFinished()), this, SLOT(onYStepChanged()));
	connect(configuration_->scanAxisAt(1)->regionAt(0), SIGNAL(regionStepChanged(AMNumber)), this, SLOT(setYAxisStep(AMNumber)));

	QHBoxLayout *stepSizeLayout = new QHBoxLayout;
	stepSizeLayout->addWidget(new QLabel("Step Size:"));
	stepSizeLayout->addWidget(hStep_);
	stepSizeLayout->addWidget(vStep_);
	stepSizeLayout->addStretch();

	normalPosition_ = createPositionDoubleSpinBox("N: ", " mm", configuration_->normalPosition(), 3);
	connect(normalPosition_, SIGNAL(editingFinished()), this, SLOT(onNormalPositionChanged()));
	connect(configuration_->dbObject(), SIGNAL(normalPositionChanged(double)), normalPosition_, SLOT(setValue(double)));

	QPushButton *updateNormalPosition = new QPushButton("Set Normal");
	connect(updateNormalPosition, SIGNAL(clicked()), this, SLOT(onSetNormalPosition()));

	QHBoxLayout *normalLayout = new QHBoxLayout;
	normalLayout->addWidget(new QLabel("Focus Position:"));
	normalLayout->addWidget(normalPosition_);
	normalLayout->addWidget(updateNormalPosition);

	mapInfo_ = new QLabel;
	updateMapInfo();

	QVBoxLayout *positionsLayout = new QVBoxLayout;
	positionsLayout->addLayout(startPointLayout);
	positionsLayout->addLayout(endPointLayout);
	positionsLayout->addLayout(stepSizeLayout);
	positionsLayout->addLayout(normalLayout);
	positionsLayout->addWidget(mapInfo_);

	positionsBox->setLayout(positionsLayout);

	// Dwell time.
	dwellTime_ = createDwellTimeSpinBox(configuration_->scanAxisAt(0)->regionAt(0)->regionTime());
	connect(dwellTime_, SIGNAL(editingFinished()), this, SLOT(onDwellTimeChanged()));
	connect(configuration_->scanAxisAt(0)->regionAt(0), SIGNAL(regionTimeChanged(AMNumber)), this, SLOT(setDwellTime(AMNumber)));
	connect(configuration_->scanAxisAt(0)->regionAt(0), SIGNAL(regionTimeChanged(AMNumber)), configuration_->scanAxisAt(1)->regionAt(0), SLOT(setRegionTime(AMNumber)));

	QHBoxLayout *timeLayout = new QHBoxLayout;
	timeLayout->addWidget(new QLabel("Dwell Time:"));
	timeLayout->addWidget(dwellTime_);

	// The estimated scan time.
	estimatedTime_ = new QLabel;
	connect(configuration_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged()));
	onEstimatedTimeChanged();

	QVBoxLayout *timeBoxLayout = new QVBoxLayout;
	timeBoxLayout->addLayout(timeLayout);
	timeBoxLayout->addWidget(estimatedTime_);

	QGroupBox *timeGroupBox = new QGroupBox("Time");
	timeGroupBox->setLayout(timeBoxLayout);

	// CCD label.
	ccdText_ = new QLabel;
	ccdHelpText_ = new QLabel;
	ccdTextBox_ = new QGroupBox("CCD Detector Info");
	QVBoxLayout *ccdTextLayout = new QVBoxLayout;
	ccdTextLayout->addWidget(ccdText_);
	ccdTextLayout->addWidget(ccdHelpText_);
	ccdTextBox_->setLayout(ccdTextLayout);
	ccdTextBox_->setVisible(configuration_->ccdDetector() != VESPERS::NoCCD);

	// Using the CCD.
	ccdComboBox_ = createCCDComboBox();
	connect(ccdComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onCCDDetectorChanged(int)));
	connect(configuration_->dbObject(), SIGNAL(ccdDetectorChanged(int)), this, SLOT(updateCCDDetectorComboBox(int)));

	// The fluorescence detector setup
	fluorescenceDetectorComboBox_  = createFluorescenceComboBox();
	connect(fluorescenceDetectorComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onFluorescenceChoiceChanged(int)));
	connect(configuration_->dbObject(), SIGNAL(fluorescenceDetectorChanged(int)), this, SLOT(updateFluorescenceDetectorComboBox(int)));

	// Ion chamber selection
	i0ComboBox_ = createIonChamberComboBox();
	connect(i0ComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onI0Clicked(int)));
	connect(configuration_->dbObject(), SIGNAL(incomingChoiceChanged(int)), this, SLOT(updateI0ComboBox(int)));

	// Motor selection.
	motorSelectionComboBox_ = createMotorSelectionComboBox(
				QStringList() << "H & V" << "X & Z" << "Atto H & V" << "Atto X & Z" << "Big Beam X & Z",
				QList<int>() << (VESPERS::H | VESPERS::V) << (VESPERS::X | VESPERS::Z) << (VESPERS::AttoH | VESPERS::AttoV) << (VESPERS::AttoX | VESPERS::AttoZ) << (VESPERS::BigBeamX | VESPERS::BigBeamZ));
	connect(motorSelectionComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onMotorChanged(int)));
	connect(configuration_->dbObject(), SIGNAL(motorChanged(int)), this, SLOT(updateMotorSelectionComboBox(int)));

	// Scan name selection
	scanName_ = createScanNameView(configuration_->name());
	connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited()));
	connect(configuration_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString)));
	// Only connecting this signal because it is the only CCD available currently.  It would need some logic for switching which CCD it was actually connected to.
	connect(VESPERSBeamline::vespers()->vespersPilatusAreaDetector(), SIGNAL(ccdPathChanged(QString)), this, SLOT(onScanNameEdited()));
	onScanNameEdited();

	QFormLayout *scanNameLayout = new QFormLayout;
	scanNameLayout->addRow("Scan Name:", scanName_);

	QGroupBox *scanNameGroupBox = new QGroupBox("Scan Name");
	scanNameGroupBox->setLayout(scanNameLayout);

	// Label showing where the data will be saved.
	QLabel *exportPath = addExportPathLabel();

	QGroupBox *timeOffsetBox = addTimeOffsetLabel(configuration_->timeOffset());
	connect(timeOffset_, SIGNAL(valueChanged(double)), this, SLOT(setTimeOffset(double)));

	// Auto-export option.
	QGroupBox *autoExportGroupBox = addExporterOptionsView(QStringList() << "Ascii" << "SMAK", configuration_->exportSpectraSources(), configuration_->exportSpectraInRows());
	connect(autoExportButtonGroup_, SIGNAL(buttonClicked(int)), this, SLOT(updateAutoExporter(int)));
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), configuration_, SLOT(setExportSpectraSources(bool)));
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), exportSpectraInRows_, SLOT(setEnabled(bool)));
	connect(exportSpectraInRows_, SIGNAL(toggled(bool)), this, SLOT(updateExportSpectraInRows(bool)));
	autoExportButtonGroup_->button(configuration_->exportAsAscii() ? 0 : 1)->click();

	ccdComboBox_->setCurrentIndex(ccdComboBox_->findData(int(configuration_->ccdDetector())));
	i0ComboBox_->setCurrentIndex((int)configuration_->incomingChoice());
	fluorescenceDetectorComboBox_->setCurrentIndex((int)configuration_->fluorescenceDetector());
	motorSelectionComboBox_->setCurrentIndex(motorSelectionComboBox_->findData(int(configuration_->motor())));

	disableStandardFluorescenceOptions();
	disableStandardXRDOptions();
	disableStandardI0Options();

	QFormLayout *detectorLayout = new QFormLayout;
	detectorLayout->addRow("XRF:", fluorescenceDetectorComboBox_);
	detectorLayout->addRow("XRD:", ccdComboBox_);
	detectorLayout->addRow("I0:", i0ComboBox_);
	detectorLayout->addRow("Stage:", motorSelectionComboBox_);

	QGroupBox *detectorGroupBox = new QGroupBox("Detectors");
	detectorGroupBox->setLayout(detectorLayout);

	QGroupBox *afterScanBox = createAfterScanOptionsBox(configuration_->closeFastShutter(), configuration_->returnToOriginalPosition(), configuration_->cleanupScaler());
	connect(closeFastShutterCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCloseFastShutter(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setReturnToOriginalPosition(bool)));
	connect(cleanupScalerCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCleanupScaler(bool)));

	// Setting up the layout.
	QGridLayout *contentsLayout = new QGridLayout;
	contentsLayout->addWidget(positionsBox, 0, 0, 2, 3);
	contentsLayout->addWidget(timeGroupBox, 2, 0, 1, 3);
	contentsLayout->addWidget(scanNameGroupBox, 3, 0, 1, 3);
	contentsLayout->addWidget(ccdTextBox_, 4, 0, 1, 3);
	contentsLayout->addWidget(timeOffsetBox, 5, 0, 1, 3);
	contentsLayout->addWidget(detectorGroupBox, 0, 3, 2, 1);
	contentsLayout->addWidget(autoExportGroupBox, 2, 3, 2, 1);
	contentsLayout->addWidget(afterScanBox, 4, 3, 1, 1);

	QHBoxLayout *squeezeContents = new QHBoxLayout;
	squeezeContents->addStretch();
	squeezeContents->addLayout(contentsLayout);
	squeezeContents->addStretch();

	QVBoxLayout *configViewLayout = new QVBoxLayout;
	configViewLayout->addWidget(frame);
	configViewLayout->addStretch();
	configViewLayout->addLayout(squeezeContents);
	configViewLayout->addStretch();
	configViewLayout->addWidget(exportPath, 0, Qt::AlignCenter);
	configViewLayout->addSpacing(30);

	setLayout(configViewLayout);
}
예제 #8
0
MeshifyPopup::MeshifyPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "MeshifyPopup"), m_r(-1), m_c(-1)
{
	setWindowTitle(tr("Create Mesh"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(topWidget); // Needed to justify at top
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	int row = 0;

	QLabel *edgesLengthLabel = new QLabel(tr("Mesh Edges Length:"));
	topLayout->addWidget(edgesLengthLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_edgesLength = new DVGui::MeasuredDoubleField;
	m_edgesLength->setMeasure("length.x");
	m_edgesLength->setRange(0.0, 1.0); // In inches (standard unit)
	m_edgesLength->setValue(0.2);

	topLayout->addWidget(m_edgesLength, row++, 1);

	QLabel *rasterizationDpiLabel = new QLabel(tr("Rasterization DPI:"));
	topLayout->addWidget(rasterizationDpiLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_rasterizationDpi = new DVGui::DoubleLineEdit;
	m_rasterizationDpi->setRange(1.0, (std::numeric_limits<double>::max)());
	m_rasterizationDpi->setValue(300.0);

	topLayout->addWidget(m_rasterizationDpi, row++, 1);

	QLabel *shapeMarginLabel = new QLabel(tr("Mesh Margin (pixels):"));
	topLayout->addWidget(shapeMarginLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_margin = new DVGui::IntLineEdit;
	m_margin->setRange(2, (std::numeric_limits<int>::max)());
	m_margin->setValue(5);

	topLayout->addWidget(m_margin, row++, 1);

	connect(m_edgesLength, SIGNAL(valueChanged(bool)), this, SLOT(onParamsChanged(bool)));
	connect(m_rasterizationDpi, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));
	connect(m_margin, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));

	topLayout->setRowStretch(row, 1);

	//------------------------- View Widget -------------------------

	// NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	// used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);

	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	// Finally, acquire current selection
	onCellSwitched();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
예제 #9
0
FLineEdit::FLineEdit(QWidget * parent) : QLineEdit(parent)
{
	editingFinishedSlot();
	connect(this, SIGNAL(editingFinished()), this, SLOT(editingFinishedSlot()));
}
예제 #10
0
PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
	ui.setupUi(this);

	QSettings s;
	QStringList rebreater_modes;
	s.beginGroup("Planner");
	prefs.last_stop = s.value("last_stop", prefs.last_stop).toBool();
	prefs.verbatim_plan = s.value("verbatim_plan", prefs.verbatim_plan).toBool();
	prefs.display_duration = s.value("display_duration", prefs.display_duration).toBool();
	prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool();
	prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
	prefs.deco_mode = deco_mode(s.value("deco_mode", prefs.deco_mode).toInt());
	prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool();
	prefs.reserve_gas = s.value("reserve_gas", prefs.reserve_gas).toInt();
	prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
	prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
	prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
	prefs.ascratelast6m = s.value("ascratelast6m", prefs.ascratelast6m).toInt();
	prefs.descrate = s.value("descrate", prefs.descrate).toInt();
	prefs.bottompo2 = s.value("bottompo2", prefs.bottompo2).toInt();
	prefs.decopo2 = s.value("decopo2", prefs.decopo2).toInt();
	prefs.doo2breaks = s.value("doo2breaks", prefs.doo2breaks).toBool();
	prefs.switch_at_req_stop = s.value("switch_at_req_stop", prefs.switch_at_req_stop).toBool();
	prefs.min_switch_duration = s.value("min_switch_duration", prefs.min_switch_duration).toInt();
	prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool();
	prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt();
	prefs.decosac = s.value("decosac", prefs.decosac).toInt();
	plannerModel->getDiveplan().bottomsac = prefs.bottomsac;
	plannerModel->getDiveplan().decosac = prefs.decosac;
	s.endGroup();

	updateUnitsUI();
	ui.lastStop->setChecked(prefs.last_stop);
	ui.verbatim_plan->setChecked(prefs.verbatim_plan);
	ui.display_duration->setChecked(prefs.display_duration);
	ui.display_runtime->setChecked(prefs.display_runtime);
	ui.display_transitions->setChecked(prefs.display_transitions);
	ui.safetystop->setChecked(prefs.safetystop);
	ui.reserve_gas->setValue(prefs.reserve_gas / 1000);
	ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
	ui.decopo2->setValue(prefs.decopo2 / 1000.0);
	ui.backgasBreaks->setChecked(prefs.doo2breaks);
	ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
	ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
	ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
	ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL);
	ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN);
	ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB);

	// should be the same order as in dive_comp_type!
	rebreater_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");
	ui.rebreathermode->insertItems(0, rebreater_modes);

	modeMapper = new QSignalMapper(this);
	connect(modeMapper, SIGNAL(mapped(int)) , plannerModel, SLOT(setDecoMode(int)));
	modeMapper->setMapping(ui.recreational_deco, int(RECREATIONAL));
	modeMapper->setMapping(ui.buehlmann_deco, int(BUEHLMANN));
	modeMapper->setMapping(ui.vpmb_deco, int(VPMB));
	
	connect(ui.recreational_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
	connect(ui.buehlmann_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
	connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
	
	connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
	connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
	connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
	connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
	connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
	connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
	connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
	connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
	connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
	connect(ui.ascRate50, SIGNAL(valueChanged(int)), this, SLOT(setAscRate50(int)));
	connect(ui.ascRate50, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
	connect(ui.ascRateStops, SIGNAL(valueChanged(int)), this, SLOT(setAscRateStops(int)));
	connect(ui.ascRateStops, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
	connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), this, SLOT(setAscRateLast6m(int)));
	connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
	connect(ui.descRate, SIGNAL(valueChanged(int)), this, SLOT(setDescRate(int)));
	connect(ui.descRate, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
	connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double)));
	connect(ui.decopo2, SIGNAL(valueChanged(double)), this, SLOT(setDecoPo2(double)));
	connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
	connect(ui.bottomSAC, SIGNAL(valueChanged(double)), this, SLOT(bottomSacChanged(double)));
	connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), this, SLOT(decoSacChanged(double)));
	connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
	connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
	connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
	connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
	connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
	connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
	connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int)));
	connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
	connect(plannerModel, SIGNAL(recreationChanged(bool)), this, SLOT(disableDecoElements(bool)));

	settingsChanged();
	ui.gflow->setValue(prefs.gflow);
	ui.gfhigh->setValue(prefs.gfhigh);

	setMinimumWidth(0);
	setMinimumHeight(0);
}
예제 #11
0
void ColorLabel::mousePressEvent(QMouseEvent *e)
{
    setColor();
    emit editingFinished();
}
예제 #12
0
ModelWindow::ModelWindow(Context *context) :
    GcChartWindow(context), context(context), ride(NULL), current(NULL)
{
    QWidget *c = new QWidget(this);
    HelpWhatsThis *helpConfig = new HelpWhatsThis(c);
    c->setWhatsThis(helpConfig->getWhatsThisText(HelpWhatsThis::ChartRides_3D));
    QFormLayout *cl = new QFormLayout(c);
    setControls(c);

    // the plot widget
    QHBoxLayout *mainLayout = new QHBoxLayout;
    modelPlot= new ModelPlot(context, this);
    zpane = new QSlider(Qt::Vertical);
    zpane->setTickInterval(1);
    zpane->setMinimum(0);
    zpane->setMaximum(100);
    zpane->setValue(0);
    mainLayout->addWidget(zpane);
    mainLayout->addWidget(modelPlot);
    setChartLayout(mainLayout);

    HelpWhatsThis *help = new HelpWhatsThis(modelPlot);
    modelPlot->setWhatsThis(help->getWhatsThisText(HelpWhatsThis::ChartRides_3D));

    // preset Values
    presetLabel = new QLabel(tr("Analyse"), this);
    presetValues = new QComboBox;
    fillPresets(presetValues);
    presetValues->setCurrentIndex(1);
    cl->addRow(presetLabel, presetValues);

    // labels
    xLabel = new QLabel(tr("X-Axis:"), this);
    xSelector = new QComboBox;
    addStandardChannels(xSelector);
    xSelector->setCurrentIndex(0); // power
    cl->addRow(xLabel, xSelector);

    yLabel = new QLabel(tr("Y-Axis:"), this);
    ySelector = new QComboBox;
    addStandardChannels(ySelector);
    ySelector->setCurrentIndex(1); // cadence
    cl->addRow(yLabel, ySelector);

    zLabel = new QLabel(tr("Z-Axis:"), this);
    zSelector = new QComboBox;
    addStandardChannels(zSelector);
    zSelector->addItem(tr("Time at X&Y"), MODEL_XYTIME);
    zSelector->setCurrentIndex(12); // time at xy
    cl->addRow(zLabel, zSelector);

    colorLabel = new QLabel(tr("Color:"), this);
    colorSelector = new QComboBox;
    addStandardChannels(colorSelector);
    colorSelector->addItem(tr("Power Zone"), MODEL_POWERZONE);
    colorSelector->addItem(tr("Time at X&Y"), MODEL_XYTIME);
    colorSelector->setCurrentIndex(12); // power zone
    cl->addRow(colorLabel, colorSelector);

    binLabel = new QLabel(tr("Bin Width:"), this);
    binWidthLineEdit = new QLineEdit(this);
    binWidthLineEdit->setFixedWidth(30);
    binWidthLineEdit->setText("5");
    cl->addRow(binLabel, binWidthLineEdit);

    binWidthSlider = new QSlider(Qt::Horizontal);
    binWidthSlider->setTickPosition(QSlider::TicksBelow);
    binWidthSlider->setTickInterval(1);
    binWidthSlider->setMinimum(3);
    binWidthSlider->setMaximum(100);
    binWidthSlider->setValue(5);
    cl->addRow(binWidthSlider);

    // selectors
    styleSelector = new QComboBox;
    styleSelector->addItem(tr("Bar"));
    styleSelector->addItem(tr("Grid"));
    styleSelector->addItem(tr("Surface"));
    styleSelector->addItem(tr("Dots"));
    styleSelector->setCurrentIndex(0);
    cl->addRow(styleSelector);

    ignore = new QCheckBox(tr("Ignore Zero"));
    ignore->setChecked(true);
    cl->addRow(ignore);

    grid = new QCheckBox(tr("Show Grid"));
    grid->setChecked(true);
    cl->addRow(grid);

    frame = new QCheckBox(tr("Frame Intervals"));
    frame->setChecked(true);
    cl->addRow(frame);

    legend = new QCheckBox(tr("Legend"));
    legend->setChecked(true);
    cl->addRow(legend);

    // now connect up the widgets
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    connect(presetValues, SIGNAL(currentIndexChanged(int)), this, SLOT(applyPreset(int)));
    connect(xSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(ySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(zSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(colorSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(grid, SIGNAL(stateChanged(int)), this, SLOT(setGrid()));
    connect(legend, SIGNAL(stateChanged(int)), this, SLOT(setLegend()));
    connect(frame, SIGNAL(stateChanged(int)), this, SLOT(setFrame()));
    connect(styleSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(styleSelected(int)));
    connect(ignore, SIGNAL(stateChanged(int)), this, SLOT(setDirty()));
    connect(binWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(setBinWidthFromSlider()));
    connect(binWidthLineEdit, SIGNAL(editingFinished()), this, SLOT(setBinWidthFromLineEdit()));
    connect(zpane, SIGNAL(valueChanged(int)), this, SLOT(setZPane(int)));
    connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));

    // set colors on first run
    configChanged(CONFIG_APPEARANCE);
}
예제 #13
0
파일: widget.cpp 프로젝트: sanool/qTox
Widget::Widget(QWidget *parent)
    : QMainWindow(parent),
      ui(new Ui::MainWindow),
      activeChatroomWidget{nullptr}
{
    ui->setupUi(this);

    ui->statusbar->hide();
    ui->menubar->hide();

    //restore window state
    restoreGeometry(Settings::getInstance().getWindowGeometry());
    restoreState(Settings::getInstance().getWindowState());
    ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());

    if (Settings::getInstance().getUseNativeDecoration())
    {
        ui->titleBar->hide();
        this->layout()->setContentsMargins(0, 0, 0, 0);

        ui->friendList->setObjectName("friendList");
        ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css"));
    }
    else
    {
        this->setObjectName("activeWindow");
        this->setStyleSheet(Style::get(":ui/window/window.css"));
        ui->statusPanel->setStyleSheet(QString(""));
        ui->friendList->setStyleSheet(QString(""));

        ui->friendList->setObjectName("friendList");
        ui->friendList->setStyleSheet(Style::get(":ui/friendList/friendList.css"));

        ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png"));
        ui->pbMin->setObjectName("minimizeButton");
        ui->pbMax->setObjectName("maximizeButton");
        ui->pbClose->setObjectName("closeButton");

        setWindowFlags(Qt::CustomizeWindowHint);
        setWindowFlags(Qt::FramelessWindowHint);

        addAction(ui->actionClose);

        connect(ui->pbMin, SIGNAL(clicked()), this, SLOT(minimizeBtnClicked()));
        connect(ui->pbMax, SIGNAL(clicked()), this, SLOT(maximizeBtnClicked()));
        connect(ui->pbClose, SIGNAL(clicked()), this, SLOT(close()));

        m_titleMode = FullTitle;
        moveWidget = false;
        inResizeZone = false;
        allowToResize = false;
        resizeVerSup = false;
        resizeHorEsq = false;
        resizeDiagSupEsq = false;
        resizeDiagSupDer = false;

        if (isMaximized())
        {
            showMaximized();
            ui->pbMax->setObjectName("restoreButton");
        }
    }

    isWindowMinimized = 0;

    ui->mainContent->setLayout(new QVBoxLayout());
    ui->mainHead->setLayout(new QVBoxLayout());
    ui->mainHead->layout()->setMargin(0);
    ui->mainHead->layout()->setSpacing(0);

    contactListWidget = new FriendListWidget();
    ui->friendList->setWidget(contactListWidget);
    ui->friendList->setLayoutDirection(Qt::RightToLeft);

    ui->nameLabel->setEditable(true);
    ui->statusLabel->setEditable(true);

    // delay setting username and message until Core inits
    //ui->nameLabel->setText(core->getUsername());
    ui->nameLabel->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}");
    //ui->statusLabel->setText(core->getStatusMessage());
    ui->statusLabel->setStyleSheet("QLabel { color : white; font-size: 8pt;}");

    ui->statusButton->setStyleSheet(Style::get(":/ui/statusButton/statusButton.css"));

    QMenu *statusButtonMenu = new QMenu(ui->statusButton);
    QAction* setStatusOnline = statusButtonMenu->addAction(Widget::tr("Online","Button to set your status to 'Online'"));
    setStatusOnline->setIcon(QIcon(":ui/statusButton/dot_online.png"));
    QAction* setStatusAway = statusButtonMenu->addAction(Widget::tr("Away","Button to set your status to 'Away'"));
    setStatusAway->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
    QAction* setStatusBusy = statusButtonMenu->addAction(Widget::tr("Busy","Button to set your status to 'Busy'"));
    setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
    ui->statusButton->setMenu(statusButtonMenu);

    ui->titleBar->setMouseTracking(true);
    ui->LTitle->setMouseTracking(true);
    ui->tbMenu->setMouseTracking(true);
    ui->pbMin->setMouseTracking(true);
    ui->pbMax->setMouseTracking(true);
    ui->pbClose->setMouseTracking(true);
    ui->statusHead->setMouseTracking(true);

    //ui->friendList->viewport()->installEventFilter(this);

    // disable proportional scaling
    ui->mainSplitter->setStretchFactor(0,0);
    ui->mainSplitter->setStretchFactor(1,1);

    ui->statusButton->setObjectName("offline");
    ui->statusButton->style()->polish(ui->statusButton);

    camera = new Camera;
    camview = new SelfCamView(camera);

    // Disable some widgets until we're connected to the DHT
    ui->statusButton->setEnabled(false);

    qRegisterMetaType<Status>("Status");
    qRegisterMetaType<vpx_image>("vpx_image");
    qRegisterMetaType<uint8_t>("uint8_t");
    qRegisterMetaType<int32_t>("int32_t");
    qRegisterMetaType<int64_t>("int64_t");
    qRegisterMetaType<ToxFile>("ToxFile");
    qRegisterMetaType<ToxFile::FileDirection>("ToxFile::FileDirection");

    coreThread = new QThread(this);
    core = new Core(camera, coreThread);
    core->moveToThread(coreThread);
    connect(coreThread, &QThread::started, core, &Core::start);

    connect(core, &Core::connected, this, &Widget::onConnected);
    connect(core, &Core::disconnected, this, &Widget::onDisconnected);
    connect(core, &Core::failedToStart, this, &Widget::onFailedToStartCore);
    connect(core, &Core::statusSet, this, &Widget::onStatusSet);
    connect(core, &Core::usernameSet, this, &Widget::setUsername);
    connect(core, &Core::statusMessageSet, this, &Widget::setStatusMessage);
    connect(core, &Core::friendAddressGenerated, &settingsForm, &SettingsForm::setFriendAddress);
    connect(core, SIGNAL(fileDownloadFinished(const QString&)), &filesForm, SLOT(onFileDownloadComplete(const QString&)));
    connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
    connect(core, &Core::friendAdded, this, &Widget::addFriend);
    connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed);
    connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged);
    connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged);
    connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged);
    connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged);
    connect(core, &Core::friendUsernameLoaded, this, &Widget::onFriendUsernameLoaded);
    connect(core, &Core::friendStatusMessageLoaded, this, &Widget::onFriendStatusMessageLoaded);
    connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived);
    connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived);
    connect(core, &Core::groupInviteReceived, this, &Widget::onGroupInviteReceived);
    connect(core, &Core::groupMessageReceived, this, &Widget::onGroupMessageReceived);
    connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged);
    connect(core, &Core::emptyGroupCreated, this, &Widget::onEmptyGroupCreated);

    connect(this, &Widget::statusSet, core, &Core::setStatus);
    connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
    connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);

    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
    connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
    connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
    connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
    connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString)));
    connect(ui->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString)));
    connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
    connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
    connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
    connect(&settingsForm.name, SIGNAL(editingFinished()), this, SLOT(onUsernameChanged()));
    connect(&settingsForm.statusText, SIGNAL(editingFinished()), this, SLOT(onStatusMessageChanged()));
    connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));

    coreThread->start();

    friendForm.show(*ui);
}
예제 #14
0
ProductDetailsWidget::ProductDetailsWidget(QWidget *parent, DatabaseManager *database)
    : QDialog(parent)
{
    numberOfErrors = 0;
    error = 0;

    db = database;

    productNameLabel       =    new QLabel(trUtf8("Terméknév"));
    ownPartNumberLabel     =    new QLabel(trUtf8("Saját cikkszám"));
    foreignPartNumberLabel =    new QLabel(trUtf8("Idegen cikkszám"));
    descriptionLabel       =    new QLabel(trUtf8("Termékleírás"));
    categoryLabel          =    new QLabel(trUtf8("Kategória"));
    categorySub1Label      =    new QLabel(trUtf8("Alkategória 1"));
    categorySub2Label      =    new QLabel(trUtf8("Alkategória 2"));
    packageUnitLabel       =    new QLabel(trUtf8("Csomagolási egység"));
    weightLabel            =    new QLabel(trUtf8("Súly (kg)"));
    purchasePriceLabel     =    new QLabel(trUtf8("Beszerzési ár (HUF)"));
    priceLabel             =    new QLabel(trUtf8("Ár (HUF)"));
    profitMarginLabel      =    new QLabel(trUtf8("Haszonkulcs"));
    discountLabel          =    new QLabel(trUtf8("Akció (%)"));
    discountValueLabel     =    new QLabel(trUtf8("Akció (%)"));
    discountedPriceLabel   =    new QLabel(trUtf8("Akciós ár (HUF)"));


    productNameLineEdit = new QLineEdit;
    ownProductIdLineEdit = new QLineEdit;

    foreignProductIdLineEdit = new QLineEdit;

    categoryComboBox = new QComboBox;
    categoryComboBox->setEditable(false);
    categorySub1ComboBox = new QComboBox;
    categorySub2ComboBox = new QComboBox;

    categoryComboBox->setModel(&categoryListModel);
    categorySub1ComboBox->setModel(&categorySub1ListModel);
    categorySub2ComboBox->setModel(&categorySub2ListModel);

    descriptionTextEdit = new QTextEdit;
    descriptionTextEdit->setFixedHeight(100);
    descriptionTextEdit->setAcceptRichText(false);

    packageUnitLineEdit = new QLineEdit;

    weightSpinBox = new QDoubleSpinBox;
    //weightSpinBox->setMaximum(200);
    weightSpinBox->setMinimum(0);
//    weightSpinBox->setSuffix(" kg");

    purchasePriceSpinBox = new QDoubleSpinBox;
    purchasePriceSpinBox->setMaximum(999999.99);
    purchasePriceSpinBox->setMinimum(0);
//    purchasePriceSpinBox->setSuffix(" Ft");

    roundingUpButton = new QPushButton("Kerekítés");

    //QRegExp numberRegExp("[1-9]\\.?[0-9]{0,6}");
    //ownPartNumberLineEdit->setValidator((new QRegExpValidator(numberRegExp, this)));
    //priceLineEdit->setValidator(new QRegExpValidator(numberRegExp, this));

    priceSpinBox = new QDoubleSpinBox;
//    priceSpinBox->setSuffix(" Ft");
    priceSpinBox->setMaximum(999999.99);
    priceSpinBox->setMinimum(0.00);

    profitMarginSpinBox = new QDoubleSpinBox;
    profitMarginSpinBox->setSuffix("%");
    profitMarginSpinBox->setMaximum(999999.99);
    profitMarginSpinBox->setMinimum(-100.00);
    //profitMarginSpinBox->setDecimals(2);

    discountCheckBox = new QCheckBox;
    discountValueSpinBox = new QSpinBox;
    discountValueSpinBox->setMaximum(99);
    discountValueSpinBox->setMinimum(0);
//    discountValueSpinBox->setSuffix("%");
    discountValueSpinBox->setMinimumWidth(50);
    discountedPriceSpinBox = new QDoubleSpinBox;
    discountedPriceSpinBox->setMaximum(999999.99);
    discountedPriceSpinBox->setMinimum(0.00);

    okButton = new QPushButton("Ok");
    cancelButton = new QPushButton("Cancel");

    errorDescriptionLabel = new QLabel;
    errorDescriptionLabel->setText("");
    errorDescriptionLabel->setStyleSheet("QLabel { color : red; }");


    errorIcon = new QLabel;
    errorIcon->setPixmap(QPixmap(":/images/error_icon.png").scaledToHeight(30, Qt::SmoothTransformation));

    //QMetaObject::connectSlotsByName(this);

    buttonHLayout = new QHBoxLayout;

    buttonHLayout->addWidget(okButton);
    buttonHLayout->addWidget(cancelButton);

    productGridLayout = new QGridLayout;

    int rowNum = 0;

    productGridLayout->addWidget(productNameLabel, rowNum, 0);
    productGridLayout->addWidget(productNameLineEdit, rowNum++, 1);

    productGridLayout->addWidget(ownPartNumberLabel, rowNum, 0);
    productGridLayout->addWidget(ownProductIdLineEdit, rowNum++, 1);

    productGridLayout->addWidget(foreignPartNumberLabel, rowNum, 0);
    productGridLayout->addWidget(foreignProductIdLineEdit, rowNum++, 1);

    productGridLayout->addWidget(categoryLabel, rowNum, 0);
    productGridLayout->addWidget(categoryComboBox, rowNum++, 1);
    productGridLayout->addWidget(categorySub1Label, rowNum, 0);
    productGridLayout->addWidget(categorySub1ComboBox, rowNum++, 1);
    productGridLayout->addWidget(categorySub2Label, rowNum, 0);
    productGridLayout->addWidget(categorySub2ComboBox, rowNum++, 1);

    categorySub1Label->setHidden(true);
    categorySub1ComboBox->setHidden(true);
    categorySub2Label->setHidden(true);
    categorySub2ComboBox->setHidden(true);

    productGridLayout->addWidget(descriptionLabel, rowNum, 0);
    productGridLayout->addWidget(descriptionTextEdit, rowNum++, 1);

    productGridLayout->addWidget(packageUnitLabel, rowNum, 0);
    productGridLayout->addWidget(packageUnitLineEdit, rowNum++, 1);

    productGridLayout->addWidget(weightLabel, rowNum, 0);
    productGridLayout->addWidget(weightSpinBox, rowNum++, 1);

    priceGridLayout = new QGridLayout;
    rowNum = 0;

    priceGridLayout->addWidget(purchasePriceLabel, rowNum, 0);
    priceGridLayout->addWidget(purchasePriceSpinBox, rowNum++, 1);

    //priceGridLayout->addWidget(roundingUpButton, rowNum++, 1);

    priceGridLayout->addWidget(profitMarginLabel, rowNum, 0);
    priceGridLayout->addWidget(profitMarginSpinBox, rowNum++, 1);

    priceGridLayout->addWidget(priceLabel, rowNum, 0);
    priceGridLayout->addWidget(priceSpinBox, rowNum++, 1);

/*
    discountHLayout = new QHBoxLayout;

    discountHLayout->addWidget(discountValueSpinBox);
    discountHLayout->addSpacing(10);
    //discountLayout->addWidget(discountValueLabel);
    discountHLayout->addWidget(discountCheckBox, 0, Qt::AlignHCenter);
    discountHLayout->addStretch();

    //priceGridLayout->addWidget(discountLabel, rowNum, 0);
    //priceGridLayout->addLayout(discountLayout, rowNum++, 1);

    priceGridLayout->addWidget(discountValueLabel, rowNum, 1);
    priceGridLayout->addWidget(discountValueSpinBox, rowNum++, );

    //priceGridLayout->addWidget(discountedPriceLabel, rowNum, 0);
    //priceGridLayout->addWidget(discountedPriceSpinBox, rowNum++, 1);
*/

    //priceGridLayout->addWidget(errorDescriptionLabel, rowNum++, 0, 1, 2, Qt::AlignLeft);

    //priceGridLayout->addLayout(buttonHLayout, rowNum, 1, 2, 1, Qt::AlignBottom);

    QGroupBox *productGroupBox = new QGroupBox(trUtf8("Termék"));
    QGroupBox *priceGroupBox = new QGroupBox(trUtf8("Ár"));

    productGroupBox->setLayout(productGridLayout);
    priceGroupBox->setLayout(priceGridLayout);

    mainVLayout = new QVBoxLayout;

    mainVLayout->addWidget(productGroupBox);
    mainVLayout->addWidget(priceGroupBox);
    mainVLayout->addWidget(errorDescriptionLabel);
    mainVLayout->addLayout(buttonHLayout);

    this->setLayout(mainVLayout);
    //this->setFixedSize(this->sizeHint());

    connect(okButton, SIGNAL(clicked()), this, SLOT(on_okButton_clicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(on_cancelButton_clicked()));
    connect(categoryComboBox, SIGNAL(currentIndexChanged(int)),
            this,             SLOT(on_currentCategoryChange(int)));
    connect(categorySub1ComboBox, SIGNAL(currentIndexChanged(int)),
            this,                 SLOT(on_currentCategorySub1Change(int)));
    connect(purchasePriceSpinBox, SIGNAL(editingFinished()),
            this,                 SLOT(on_purchasePriceSpinBox_valueChanged()));
    connect(profitMarginSpinBox, SIGNAL(valueChanged(double)),
            this,                SLOT(on_profitMarginSpinBox_valueChanged()));
    connect(priceSpinBox,   SIGNAL(valueChanged(double)),
            this,           SLOT(on_priceSpinBox_valueChanged()));
    connect(roundingUpButton, SIGNAL(clicked()), this, SLOT(on_roundingUpButton_clicked()));
    connect(discountCheckBox, SIGNAL(toggled(bool)),
            this,             SLOT(on_discountCheckBox_toggled(bool)));

}
예제 #15
0
CQLineDash::
CQLineDash(QWidget *parent) :
    QFrame(parent), editable_(false)
{
    setObjectName("line_dash");

    setFrameStyle(QFrame::NoFrame | QFrame::Plain);

    //---

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);

    //---

    // editable controls

    edit_ = new QLineEdit;
    edit_->setObjectName("edit");

    edit_->setToolTip("Line Dash\n(List of Dash Lengths)");

    connect(edit_, SIGNAL(editingFinished()), this, SLOT(dashChangedSlot()));

    layout->addWidget(edit_);

    button_ = new QToolButton;
    button_->setObjectName("button");

    menu_ = new QMenu;

    //menu_->setStyle(new CQLineDashProxyStyle);

    button_->setMenu(menu_);

    connect(menu_, SIGNAL(triggered(QAction *)), this, SLOT(menuItemActivated(QAction *)));

    int is = style()->pixelMetric(QStyle::PM_SmallIconSize);

    button_->setPopupMode(QToolButton::InstantPopup);
    button_->setAutoRaise(true);
    button_->setFixedSize(QSize(is, is + 4));

    layout->addWidget(button_);

    //---

    // combo control

    combo_ = new CQIconCombo;

    combo_->setIconWidth(5*is);

    layout->addWidget(combo_);

    connect(combo_, SIGNAL(currentIndexChanged(int)), this, SLOT(comboItemChanged()));

    //---

    addDashOption("solid" , CLineDash());
    addDashOption("1, 1"  , CLineDash("1, 1"));
    addDashOption("1, 2"  , CLineDash("1, 2"));
    addDashOption("1, 3"  , CLineDash("1, 3"));
    addDashOption("1, 4"  , CLineDash("1, 4"));
    addDashOption("1, 6"  , CLineDash("1, 6"));
    addDashOption("1, 8"  , CLineDash("1, 8"));
    addDashOption("1, 12" , CLineDash("1, 12"));
    addDashOption("1, 24" , CLineDash("1, 24"));
    addDashOption("1, 48" , CLineDash("1, 48"));
    addDashOption("2, 1"  , CLineDash("2, 1"));
    addDashOption("3, 1"  , CLineDash("3, 1"));
    addDashOption("4, 1"  , CLineDash("4, 1"));
    addDashOption("6, 1"  , CLineDash("6, 1"));
    addDashOption("8, 1"  , CLineDash("8, 1"));
    addDashOption("12, 1" , CLineDash("12, 1"));
    addDashOption("24, 1" , CLineDash("24, 1"));
    addDashOption("2, 2"  , CLineDash("2, 2"));
    addDashOption("3, 3"  , CLineDash("3, 3"));
    addDashOption("4, 4"  , CLineDash("4, 4"));
    addDashOption("6, 6"  , CLineDash("6, 6"));
    addDashOption("8, 8"  , CLineDash("8, 8"));
    addDashOption("12, 12", CLineDash("12, 12"));
    addDashOption("24, 24", CLineDash("24, 24"));
    addDashOption("2, 4"  , CLineDash("2, 4"));
    addDashOption("4, 2"  , CLineDash("4, 2"));
    addDashOption("2, 6"  , CLineDash("2, 6"));
    addDashOption("6, 2"  , CLineDash("6, 2"));
    addDashOption("4, 8"  , CLineDash("4, 8"));
    addDashOption("8, 4"  , CLineDash("8, 4"));

    addDashOption("2,1,0.5,1", CLineDash("2,1,0.5,1"));
    addDashOption("4,2,1,2"  , CLineDash("4,2,1,2"));
    addDashOption("8,2,1,2"  , CLineDash("8,2,1,2"));
    addDashOption("0.5,0.5"  , CLineDash("0.5,0.5"));
    addDashOption("0.25,0.25", CLineDash("0.25,0.25"));
    addDashOption("0.1,0.1"  , CLineDash("0.1,0.1"));

    //---

    updateState();
}
예제 #16
0
파일: firstboot.cpp 프로젝트: baitisj/pcbsd
Installer::Installer(QWidget *parent) : QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint)
{
    setupUi(this);
    //Setup the window
    if(!DEBUG){ this->setGeometry( QApplication::primaryScreen()->geometry() ); }//full screen
    else{ this->setWindowFlags(Qt::Window); } //don't keep on bottom/frameless for testing

    translator = new QTranslator();

    connect(backButton, SIGNAL(clicked()), this, SLOT(slotBack()));
    connect(nextButton, SIGNAL(clicked()), this, SLOT(slotNext()));

    connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp()));
    connect(pushTouchKeyboard, SIGNAL(clicked()), this, SLOT(slotPushVirtKeyboard()));
    connect(pushChangeKeyLayout, SIGNAL(clicked()), this, SLOT(slotPushKeyLayout()));

    connect(lineHostname,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckHost()));
    connect(lineDomainName, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckDomainName()) );

    connect(lineRootPW, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW()));
    connect(lineRootPW2, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW()));

    connect(lineName,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser()));
    connect(lineName,SIGNAL(editingFinished()),this,SLOT(slotSuggestUsername()));
    connect(lineUsername,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser()));
    connect(linePW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser()));
    connect(linePW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser()));
    connect(line_PCpass, SIGNAL(textChanged(const QString)), this, SLOT(slotCheckUser())) ;
    connect(line_PCpass_repeat, SIGNAL(textChanged(const QString)), this, SLOT(slotCheckUser())) ;
    connect(group_usePC, SIGNAL(toggled(bool)), this, SLOT(slotCheckUser()) );
    connect(push_PC_device, SIGNAL(clicked()), this, SLOT(slotGetPCDevice()) );
    
    connect(tool_testAudio, SIGNAL(clicked()), this, SLOT(slotPlayAudioTest()) );
    connect(slider_volume, SIGNAL(valueChanged(int)), this, SLOT(slotAudioVolumeChanged()) );
    connect(combo_audiodevice, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetAudioDev()) );
    backButton->setText(tr("&Back"));
    nextButton->setText(tr("&Next"));


    // Load the keyboard info
    keyModels = Scripts::Backend::keyModels();
    keyLayouts = Scripts::Backend::keyLayouts();

    // If we have a saved keyboard layout from installation, use it first
    QString kD;
    if ( QFile::exists("/var/.wizardKeyboard") ) {
      QFile kFile("/var/.wizardKeyboard");
      if ( kFile.open(QIODevice::ReadOnly | QIODevice::Text) ) {
         kD = kFile.readLine().simplified();
         kFile.close();
         
         kbMod = kD.section(" ", 0, 0);
         kbLay = kD.section(" ", 1, 1);
         kbVar = kD.section(" ", 2, 2);
	 Scripts::Backend::changeKbMap(kbMod, kbLay, kbVar);
      } 
    }

    // Load the timezones
    comboBoxTimezone->clear();
    QString curZone = Scripts::Backend::guessTimezone();
    comboBoxTimezone->addItems(Scripts::Backend::timezones());
    if ( ! curZone.isEmpty() ) {
      int index = comboBoxTimezone->findText(curZone, Qt::MatchStartsWith);
      if (index != -1) {
         comboBoxTimezone->setCurrentIndex(index);
      } else {
        // Set America/New_York to default
        index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith);
        if (index != -1)
           comboBoxTimezone->setCurrentIndex(index);
      }
    } else {
      // Set America/New_York to default
      int index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith);
      if (index != -1)
         comboBoxTimezone->setCurrentIndex(index);
    }

    // Load the hostname
     lineHostname->setText(pcbsd::Utils::getConfFileValue("/etc/rc.conf", "hostname=", 1).section(".",0,0));

    // Load the domain name
    lineDomainName->setText(pcbsd::Utils::getConfFileValue("/etc/rc.conf", "hostname=",1).section(".",1,100));

    //Load the available Services into the UI
    LoadServices();
    
    // Start on the first screen
    installStackWidget->setCurrentIndex(0);
    backButton->setVisible(false);

    // Update the status bar
    // This makes the status text more "visible" instead of using the blue background
    //statusBar()->setStyleSheet("background: white");

    
    //Load the audio settings values
    combo_audiodevice->clear();
    QStringList devs = pcbsd::Utils::runShellCommand("pc-sysconfig list-audiodev").join("").split(", ");
    int def = -1; bool found = false;
    for(int i=0; i<devs.length(); i++){
      combo_audiodevice->addItem(devs[i], devs[i].section(":",0,0)); //<full text>, <pcmID>
      if(devs[i].contains(" default")){ found = true; def = i; }
    }
    if(def<0 && !devs.isEmpty()){ def=0; }
    if(def<0){
      //No audio devices found - disable this functionality
      Page_Audio->setEnabled(false); //just do the whole page - nothing will work
    }else{
      combo_audiodevice->setCurrentIndex(def); //make sure this item is initially selected
      if(!found){ slotSetAudioDev(); } //make sure to run the setup command initially
    }
    slider_volume->setValue(100);
    slotAudioVolumeChanged(); //update the volume % label
    
}
예제 #17
0
bool Perfboard::collectExtraInfo(QWidget * parent, const QString & family, const QString & prop, const QString & value, bool swappingEnabled, QString & returnProp, QString & returnValue, QWidget * & returnWidget)
{
	if (prop.compare("size", Qt::CaseInsensitive) == 0) {
		returnProp = tr("size");
		returnValue = m_size;
		m_propsMap.insert("size", m_size);

		int x, y;
		getXY(x, y, m_size);

		QFrame * frame = new QFrame();
		QVBoxLayout * vboxLayout = new QVBoxLayout();
		vboxLayout->setAlignment(Qt::AlignLeft);
		vboxLayout->setSpacing(1);
		vboxLayout->setContentsMargins(0, 3, 0, 0);
		vboxLayout->setMargin(0);

		QFrame * subframe1 = new QFrame();
		QHBoxLayout * hboxLayout1 = new QHBoxLayout();
		hboxLayout1->setAlignment(Qt::AlignLeft);
		hboxLayout1->setContentsMargins(0, 0, 0, 0);
		hboxLayout1->setSpacing(2);

		QLabel * l1 = new QLabel(getRowLabel());	
		l1->setMargin(0);
		l1->setObjectName("infoViewLabel");	
		m_xEdit = new QLineEdit();
		m_xEdit->setEnabled(swappingEnabled);
		QIntValidator * validator = new QIntValidator(m_xEdit);
		validator->setRange(MinXDimension, MaxXDimension);
		m_xEdit->setObjectName("infoViewLineEdit");	
		m_xEdit->setValidator(validator);
		m_xEdit->setMaxLength(5);
		m_xEdit->setText(QString::number(x));

		QFrame * subframe2 = new QFrame();
		QHBoxLayout * hboxLayout2 = new QHBoxLayout();
		hboxLayout2->setAlignment(Qt::AlignLeft);
		hboxLayout2->setContentsMargins(0, 0, 0, 0);
		hboxLayout2->setSpacing(2);

		QLabel * l2 = new QLabel(getColumnLabel());
		l2->setMargin(0);
		l2->setObjectName("infoViewLabel");	
		m_yEdit = new QLineEdit();
		m_yEdit->setEnabled(swappingEnabled);
		validator = new QIntValidator(m_yEdit);
		validator->setRange(MinYDimension, MaxYDimension);
		m_yEdit->setObjectName("infoViewLineEdit");	
		m_yEdit->setValidator(validator);
		m_yEdit->setMaxLength(5);
		m_yEdit->setText(QString::number(y));

		hboxLayout1->addWidget(l1);
		hboxLayout1->addWidget(m_xEdit);

		hboxLayout2->addWidget(l2);
		hboxLayout2->addWidget(m_yEdit);

		subframe1->setLayout(hboxLayout1);
		subframe2->setLayout(hboxLayout2);

		if (returnWidget != NULL) vboxLayout->addWidget(qobject_cast<QWidget *>(returnWidget));
		vboxLayout->addWidget(subframe1);
		vboxLayout->addWidget(subframe2);

		m_setButton = new QPushButton (tr("set board size"));
		m_setButton->setObjectName("infoViewButton");
		connect(m_setButton, SIGNAL(pressed()), this, SLOT(changeBoardSize()));
		m_setButton->setEnabled(false);

		vboxLayout->addWidget(m_setButton);

		connect(m_xEdit, SIGNAL(editingFinished()), this, SLOT(enableSetButton()));
		connect(m_yEdit, SIGNAL(editingFinished()), this, SLOT(enableSetButton()));

		frame->setLayout(vboxLayout);

		returnWidget = frame;

		return true;
	}

	return Capacitor::collectExtraInfo(parent, family, prop, value, swappingEnabled, returnProp, returnValue, returnWidget);
}
void ColumnPreferencesFrame::on_columnTreeWidget_itemActivated(QTreeWidgetItem *item, int column)
{
    if (!item || cur_line_edit_ || cur_combo_box_) return;

    QWidget *editor = NULL;
    cur_column_ = column;
    saved_combo_idx_ = item->data(type_col_, Qt::UserRole).toInt();

    switch (column) {
    case title_col_:
    {
        cur_line_edit_ = new QLineEdit();
        cur_column_ = column;
        saved_col_string_ = item->text(title_col_);
        connect(cur_line_edit_, SIGNAL(editingFinished()), this, SLOT(columnTitleEditingFinished()));
        editor = cur_line_edit_;
        break;
    }
    case type_col_:
    {
        cur_combo_box_ = new QComboBox();
        for (int i = 0; i < NUM_COL_FMTS; i++) {
            cur_combo_box_->addItem(col_format_desc(i), QVariant(i));
            if (i == saved_combo_idx_) {
                cur_combo_box_->setCurrentIndex(i);
            }
        }
        connect(cur_combo_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(columnTypeCurrentIndexChanged(int)));
        editor = cur_combo_box_;
        break;
    }
    case custom_field_col_:
    {
        SyntaxLineEdit *syntax_edit = new SyntaxLineEdit();
        saved_col_string_ = item->text(custom_field_col_);
        connect(syntax_edit, SIGNAL(textChanged(QString)),
                syntax_edit, SLOT(checkFieldName(QString)));
        connect(syntax_edit, SIGNAL(editingFinished()), this, SLOT(customFieldEditingFinished()));
        editor = cur_line_edit_ = syntax_edit;

        saved_combo_idx_ = item->data(type_col_, Qt::UserRole).toInt();
        item->setText(type_col_, col_format_desc(COL_CUSTOM));
        item->setData(type_col_, Qt::UserRole, QVariant(COL_CUSTOM));
        break;
    }
    case custom_occurrence_col_:
    {
        SyntaxLineEdit *syntax_edit = new SyntaxLineEdit();
        saved_col_string_ = item->text(custom_occurrence_col_);
        connect(syntax_edit, SIGNAL(textChanged(QString)),
                syntax_edit, SLOT(checkInteger(QString)));
        connect(syntax_edit, SIGNAL(editingFinished()), this, SLOT(customOccurrenceEditingFinished()));
        editor = cur_line_edit_ = syntax_edit;

        saved_combo_idx_ = item->data(type_col_, Qt::UserRole).toInt();
        item->setText(type_col_, col_format_desc(COL_CUSTOM));
        item->setData(type_col_, Qt::UserRole, QVariant(COL_CUSTOM));
        break;
    }
    default:
        return;
    }

    if (cur_line_edit_) {
        cur_line_edit_->setText(saved_col_string_);
        cur_line_edit_->selectAll();
        connect(cur_line_edit_, SIGNAL(destroyed()), this, SLOT(lineEditDestroyed()));
    }
    if (cur_combo_box_) {
        connect(cur_combo_box_, SIGNAL(destroyed()), this, SLOT(comboDestroyed()));
    }
    if (editor) {
        QFrame *edit_frame = new QFrame();
        QHBoxLayout *hb = new QHBoxLayout();
        QSpacerItem *spacer = new QSpacerItem(5, 10);

        hb->addWidget(editor, 0);
        hb->addSpacerItem(spacer);
        hb->setStretch(1, 1);
        hb->setContentsMargins(0, 0, 0, 0);

        edit_frame->setLineWidth(0);
        edit_frame->setFrameStyle(QFrame::NoFrame);
        // The documentation suggests setting autoFillbackground. That looks silly
        // so we clear the item text instead.
        item->setText(cur_column_, "");
        edit_frame->setLayout(hb);
        ui->columnTreeWidget->setItemWidget(item, cur_column_, edit_frame);
        editor->setFocus();
    }
}
예제 #19
0
ImportList::ImportList(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ImportList), selectedFile(NULL)
{
    ui->setupUi(this);

    //Set up preview table
    ui->twPreview->setHidden(true);
    ui->pbRefresh->setHidden(true);

    connect(ui->gbPreview, SIGNAL(clicked()), this, SLOT(togglePreview()));
    connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(ui->pbImport, SIGNAL(clicked()), this, SLOT(import()));

    //Browse File and Preview Related
    connect(ui->pbBrowse, SIGNAL(clicked()), this, SLOT(browseListFile()));
    connect(ui->leFilePath, SIGNAL(editingFinished()), this, SLOT(reloadSelectedFile()));
    connect(ui->leFilePath, SIGNAL(returnPressed()), this, SLOT(reloadSelectedFile()));
    connect(ui->pbRefresh, SIGNAL(clicked()), this, SLOT(reloadSelectedFile()));

    //Column Management Related
    connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(addSelectedColumns()));
    connect(ui->pbRemove, SIGNAL(clicked()), this, SLOT(removeSelectedColumns()));
    connect(ui->pbMoveUp, SIGNAL(clicked()), this, SLOT(moveSelectedUp()));
    connect(ui->pbMoveDown, SIGNAL(clicked()), this, SLOT(moveSelectedDown()));


    QListWidgetItem *item = new QListWidgetItem("Name", ui->lwAvailableColumns);
    item->setToolTip("Movie Title; Can contain any character");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Name)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("Year", ui->lwAvailableColumns);
    item->setToolTip("Year when the movie came out; format: YYYY");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("([0-9]*)"), UserRoleData::Year)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("Quality", ui->lwAvailableColumns);
    item->setToolTip("Should be one of the following string: \"Xvid\", \"BDRIP\", \"720p\", or \"1080p\"");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Quality)));
    ui->lwAvailableColumns->addItem(item);

    item = new QListWidgetItem("IMDB Link", ui->lwAvailableColumns);
    item->setToolTip("Valid link to IMDB Page.");
    item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::IMDB)));
    ui->lwAvailableColumns->addItem(item);

    QStringList selectedColumns;
    m_settings.beginGroup(IMPORT_GROUP);

    int size = m_settings.beginReadArray(SELECTED_COLUMNS_ARRAY);
    for(int i = 0; i < size; i++)
    {
        m_settings.setArrayIndex(i);
        selectedColumns.push_front(m_settings.value(SELECTED_COLUMNS_COLUMN_KEY).toString());
    }
    m_settings.endArray();

    ui->leFilePath->setText(m_settings.value(LAST_SELECTED_FILE_KEY).toString());
    reloadSelectedFile();

    m_settings.endGroup();

    QStringList::iterator itr = selectedColumns.begin();
    for(; itr != selectedColumns.end(); ++itr)
    {
        for(int i = 0; i < ui->lwAvailableColumns->count(); i++)
        {
            if(ui->lwAvailableColumns->item(i)->text() == *itr)
            {
                ui->lwColumnOrder->insertItem(0, ui->lwAvailableColumns->takeItem(i));
                break;
            }
        }
    }
}
예제 #20
0
void StarEditor::mouseReleaseEvent(QMouseEvent* /* event */) {
    emit editingFinished();
}
예제 #21
0
QWidget* BusPortsDelegate::createEditor( QWidget* parent, 
										const QStyleOptionViewItem& option,
										const QModelIndex& index ) const {

	switch (index.column()) {
		// name and comment need only normal QLineEdit
		case 0:
		case 8: {
			QLineEdit* line = new QLineEdit(parent);
			connect(line, SIGNAL(editingFinished()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return line;
			  }
		// qualifier
		case 1: {
			QComboBox* box = new QComboBox(parent);
			QStringList list;
			list.append(QString("address"));
			list.append(QString("data"));
			list.append(QString("clock"));
			list.append(QString("reset"));
			list.append(QString("any"));
			box->addItems(list);
			return box;
				}
		// width
		case 2: {
            QLineEdit* line = new QLineEdit(parent);

            // the validator for editor input
            QRegExpValidator* validator = new QRegExpValidator(QRegExp("[0-9]{0,5}"), line);

            line->setValidator(validator);

            connect(line, SIGNAL(editingFinished()),
                this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
            return line;
				}
		// default value
		case 3: {
			// the editor
			QLineEdit* line = new QLineEdit(parent);

			// the validator for editor input
			QIntValidator* validator = new QIntValidator(line);
			validator->setRange(0, 99999);

			line->setValidator(validator);

			connect(line, SIGNAL(editingFinished()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return line;
				}
		// mode
		case 4: {
			QComboBox* box = new QComboBox(parent);
			QStringList list;
			list.append(QString("master"));
			list.append(QString("slave"));
			list.append(QString("system"));
			list.append(QString("any"));
			box->addItems(list);
			connect(box, SIGNAL(destroyed()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return box;
				}
		// direction of the port
		case 5: {
			QComboBox* box = new QComboBox(parent);
			QStringList list;
			list.append(QString("in"));
			list.append(QString("out"));
			list.append(QString("inout"));
			box->addItems(list);
			connect(box, SIGNAL(destroyed()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return box;
				}
		// presence
		case 6: {
			QComboBox* box = new QComboBox(parent);
			QStringList list;
			list.append(QString("required"));
			list.append(QString("optional"));
			list.append(QString("illegal"));
			box->addItems(list);
			connect(box, SIGNAL(destroyed()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return box;
				}
		// driver
		case 7: {
			QComboBox* box = new QComboBox(parent);
			QStringList list;
			list.append(QString("none"));
			list.append(QString("any"));
			list.append(QString("clock"));
			list.append(QString("singleshot"));
			box->addItems(list);
			connect(box, SIGNAL(destroyed()),
				this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
			return box;
				}
		
		default: {
			return QStyledItemDelegate::createEditor(parent, option, index);
				 }
	}
}
예제 #22
0
//------------------------- Private -------------------------------------------
void EditCardPage::connect_all()
{
    connect(copy_checkBox_1,SIGNAL(toggled(bool)),
            reciver_lineEd_1,SLOT(setEnabled(bool))
           );
    connect(copy_checkBox_2,SIGNAL(toggled(bool)),
            reciver_lineEd_2,SLOT(setEnabled(bool))
           );
    connect(copy_checkBox_3,SIGNAL(toggled(bool)),
            reciver_lineEd_3,SLOT(setEnabled(bool))
           );
    connect(copy_checkBox_4,SIGNAL(toggled(bool)),
            reciver_lineEd_4,SLOT(setEnabled(bool))
           );
    connect(copy_checkBox_5,SIGNAL(toggled(bool)),
            reciver_lineEd_5,SLOT(setEnabled(bool))
           );

    connect(docName_lineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(punktLineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(mbNumberLineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(executor_lineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(pressman_lineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(invNumber_lineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(pagesCountLineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(telephone_lineEd,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(reciver_lineEd_1,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(reciver_lineEd_2,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(reciver_lineEd_3,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(reciver_lineEd_4,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );
    connect(reciver_lineEd_5,SIGNAL(editingFinished()),
            this,SLOT(checkNext())
           );

    connect(secretCBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(checkNext())
           );

    connect(templatesCBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(checkNext())
           );
    connect(printersCBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(checkNext())
           );

}
예제 #23
0
    _itemdlg = new QueryItem(0, Qt::Dialog);
    if (_itemdlg)
    {
      _itemdlg->setWindowModality(Qt::WindowModal);
      connect(_itemdlg, SIGNAL(closed(bool)), this, SLOT(sFillList()));
    }
  }
  else
    _itemdlg = 0;

  connect(_qryDelete,  SIGNAL(clicked()),         this, SLOT(sDelete()));
  connect(_qryEdit,    SIGNAL(clicked()),         this, SLOT(sEdit()));
  connect(_qryList,    SIGNAL(itemSelected(int)), this, SLOT(sEdit()));
  connect(_qryNew,     SIGNAL(clicked()),         this, SLOT(sNew()));
  connect(_save,       SIGNAL(clicked()),         this, SLOT(sSave()));
  connect(_setName,    SIGNAL(editingFinished()), this, SLOT(sHandleButtons()));

  _qryList->addColumn(tr("Order"),        _seqColumn, Qt::AlignRight, true, "qryitem_order");
  _qryList->addColumn(tr("Name"),        _itemColumn, Qt::AlignLeft,  true, "qryitem_name");
  _qryList->addColumn(tr("Source"),       _seqColumn, Qt::AlignLeft,  true, "qryitem_src");
  _qryList->addColumn(tr("Schema/Group"),_itemColumn, Qt::AlignLeft,  true, "qryitem_group");
  _qryList->addColumn(tr("Table/Name"),           -1, Qt::AlignLeft,  true, "qryitem_detail");

  sHandleButtons();

  _qryheadid = -1;

}

QuerySet::~QuerySet()
{
예제 #24
0
VESPERSSampleStageView::VESPERSSampleStageView(VESPERSSampleStageControl *sampleStage, QWidget *parent)
	: QWidget(parent)
{
	sampleStage_ = sampleStage;
	connect(sampleStage_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
	connect(sampleStage_, SIGNAL(movingChanged(bool)), this, SLOT(onMovingChanged(bool)));
	connect(sampleStage_, SIGNAL(horizontalMoveError(bool)), this, SLOT(onHorizontalMoveError(bool)));
	connect(sampleStage_, SIGNAL(verticalMoveError(bool)), this, SLOT(onVerticalMoveError(bool)));
	connect(sampleStage_, SIGNAL(normalMoveError(bool)), this, SLOT(onNormalMoveError(bool)));

	invertHorizontal_ = false;
	invertVertical_ = false;

	QFont font(this->font());
	font.setBold(true);

	title_ = "";
	horizontalTitle_ = "H";
	verticalTitle_ = "V";

	titleLabel_ = new QLabel("Sample Stage");
	titleLabel_->setFont(font);
	horizontalLabel_ = new QLabel("H :");
	horizontalLabel_->setFont(font);
	verticalLabel_ = new QLabel("V :");
	verticalLabel_->setFont(font);
	QLabel *jog = new QLabel("Jog :");
	jog->setFont(font);

	jog_ = new QDoubleSpinBox;
	jog_->setSuffix(" mm");
	jog_->setSingleStep(0.001);
	jog_->setMaximum(5.0);
	jog_->setMinimum(0.0000);
	jog_->setValue(0.050);
	jog_->setDecimals(3);
	jog_->setAlignment(Qt::AlignCenter);
	jog_->setFixedWidth(110);

	QHBoxLayout *jogLayout = new QHBoxLayout;
	jogLayout->addWidget(jog, 0, Qt::AlignRight);
	jogLayout->addWidget(jog_);

	horizontal_ = new QDoubleSpinBox;
	horizontal_->setSuffix(" mm");
	horizontal_->setSingleStep(0.001);
	horizontal_->setRange(-100, 100);
	horizontal_->setDecimals(3);
	horizontal_->setAlignment(Qt::AlignCenter);
	horizontal_->setFixedWidth(110);
	connect(horizontal_, SIGNAL(editingFinished()), this, SLOT(onHorizontalSetpoint()));
	connect(sampleStage_, SIGNAL(horizontalSetpointChanged(double)), horizontal_, SLOT(setValue(double)));

	QHBoxLayout *hLayout = new QHBoxLayout;
	hLayout->addWidget(horizontalLabel_, 0, Qt::AlignRight);
	hLayout->addWidget(horizontal_);

	vertical_ = new QDoubleSpinBox;
	vertical_->setSuffix(" mm");
	vertical_->setSingleStep(0.001);
	vertical_->setRange(-100, 100);
	vertical_->setDecimals(3);
	vertical_->setAlignment(Qt::AlignCenter);
	vertical_->setFixedWidth(110);
	connect(vertical_, SIGNAL(editingFinished()), this, SLOT(onVerticalSetpoint()));
	connect(sampleStage_, SIGNAL(verticalSetpointChanged(double)), vertical_, SLOT(setValue(double)));

	QHBoxLayout *vLayout = new QHBoxLayout;
	vLayout->addWidget(verticalLabel_, 0, Qt::AlignRight);
	vLayout->addWidget(vertical_);

	status_ = new QLabel;
	status_->setPixmap(QIcon(":/OFF.png").pixmap(25));

	goUp_ = new QToolButton;
	goUp_->setIcon(QIcon(":/go-up.png"));
	connect(goUp_, SIGNAL(clicked()), this, SLOT(onUpClicked()));

	goDown_ = new QToolButton;
	goDown_->setIcon(QIcon(":/go-down.png"));
	connect(goDown_, SIGNAL(clicked()), this, SLOT(onDownClicked()));

	goLeft_ = new QToolButton;
	goLeft_->setIcon(QIcon(":/go-previous.png"));
	connect(goLeft_, SIGNAL(clicked()), this, SLOT(onLeftClicked()));

	goRight_ = new QToolButton;
	goRight_->setIcon(QIcon(":/go-next.png"));
	connect(goRight_, SIGNAL(clicked()), this, SLOT(onRightClicked()));

	buttons_ = new QButtonGroup(this);
	buttons_->addButton(goUp_, 0);
	buttons_->addButton(goDown_, 1);
	buttons_->addButton(goLeft_, 2);
	buttons_->addButton(goRight_, 3);

	QToolButton *stop = new QToolButton;
	stop->setIcon(QIcon(":/stop.png"));
	connect(stop, SIGNAL(clicked()), sampleStage_, SLOT(stopAll()));

	QGridLayout *arrowLayout = new QGridLayout;
	arrowLayout->addWidget(goUp_, 0, 1);
	arrowLayout->addWidget(goDown_, 2, 1);
	arrowLayout->addWidget(goLeft_, 1, 0);
	arrowLayout->addWidget(goRight_, 1, 2);
	arrowLayout->addWidget(stop, 1, 1);
	arrowLayout->addWidget(status_, 0, 0);

	QVBoxLayout *absoluteValueLayout = new QVBoxLayout;
	absoluteValueLayout->addLayout(hLayout);
	absoluteValueLayout->addLayout(vLayout);
	absoluteValueLayout->addLayout(jogLayout);

	QHBoxLayout *sampleStageLayout = new QHBoxLayout;
	sampleStageLayout->addLayout(arrowLayout);
	sampleStageLayout->addLayout(absoluteValueLayout);

	QVBoxLayout *fullLayout = new QVBoxLayout;
	fullLayout->addWidget(titleLabel_);
	fullLayout->addLayout(sampleStageLayout);

	setLayout(fullLayout);
}
예제 #25
0
GeneralTab::GeneralTab(const QString &device, v4l2 &fd, int n, QWidget *parent) :
	QGridLayout(parent),
	v4l2(fd),
	m_row(0),
	m_col(0),
	m_cols(n),
	m_audioInput(NULL),
	m_tvStandard(NULL),
	m_videoPreset(NULL),
	m_freq(NULL),
	m_vidCapFormats(NULL),
	m_frameSize(NULL),
	m_vidOutFormats(NULL)
{
	setSpacing(3);

	setSizeConstraint(QLayout::SetMinimumSize);

	if (querycap(m_querycap)) {
		addLabel("Device:");
		addLabel(device + (useWrapper() ? " (wrapped)" : ""), Qt::AlignLeft);

		addLabel("Driver:");
		addLabel((char *)m_querycap.driver, Qt::AlignLeft);

		addLabel("Card:");
		addLabel((char *)m_querycap.card, Qt::AlignLeft);

		addLabel("Bus:");
		addLabel((char *)m_querycap.bus_info, Qt::AlignLeft);
	}

	g_tuner(m_tuner);

	v4l2_standard vs;
	if (enum_std(vs, true)) {
		addLabel("TV Standard");
		m_tvStandard = new QComboBox(parent);
		do {
			m_tvStandard->addItem((char *)vs.name);
		} while (enum_std(vs));
		addWidget(m_tvStandard);
		connect(m_tvStandard, SIGNAL(activated(int)), SLOT(standardChanged(int)));
		updateStandard();
	}

	v4l2_dv_enum_preset preset;
	if (enum_dv_preset(preset, true)) {
		addLabel("Video Preset");
		m_videoPreset = new QComboBox(parent);
		do {
			m_videoPreset->addItem((char *)preset.name);
		} while (enum_dv_preset(preset));
		addWidget(m_videoPreset);
		connect(m_videoPreset, SIGNAL(activated(int)), SLOT(presetChanged(int)));
		updatePreset();
	}

	v4l2_input vin;
	if (enum_input(vin, true)) {
		addLabel("Input");
		m_videoInput = new QComboBox(parent);
		do {
			m_videoInput->addItem((char *)vin.name);
		} while (enum_input(vin));
		addWidget(m_videoInput);
		connect(m_videoInput, SIGNAL(activated(int)), SLOT(inputChanged(int)));
		updateVideoInput();
	}

	v4l2_output vout;
	if (enum_output(vout, true)) {
		addLabel("Output");
		m_videoOutput = new QComboBox(parent);
		do {
			m_videoOutput->addItem((char *)vout.name);
		} while (enum_output(vout));
		addWidget(m_videoOutput);
		connect(m_videoOutput, SIGNAL(activated(int)), SLOT(outputChanged(int)));
		updateVideoOutput();
	}

	v4l2_audio vaudio;
	if (enum_audio(vaudio, true)) {
		addLabel("Input Audio");
		m_audioInput = new QComboBox(parent);
		do {
			m_audioInput->addItem((char *)vaudio.name);
		} while (enum_audio(vaudio));
		addWidget(m_audioInput);
		connect(m_audioInput, SIGNAL(activated(int)), SLOT(inputAudioChanged(int)));
		updateAudioInput();
	}

	v4l2_audioout vaudout;
	if (enum_audout(vaudout, true)) {
		addLabel("Output Audio");
		m_audioOutput = new QComboBox(parent);
		do {
			m_audioOutput->addItem((char *)vaudout.name);
		} while (enum_audout(vaudout));
		addWidget(m_audioOutput);
		connect(m_audioOutput, SIGNAL(activated(int)), SLOT(outputAudioChanged(int)));
		updateAudioOutput();
	}

	if (m_tuner.type) {
		m_freq = new QSpinBox(parent);
		m_freq->setMinimum(m_tuner.rangelow);
		m_freq->setMaximum(m_tuner.rangehigh);
		m_freq->setWhatsThis(QString("Frequency\nLow: %1\nHigh: %2")
				.arg(m_tuner.rangelow).arg(m_tuner.rangehigh));
		connect(m_freq, SIGNAL(valueChanged(int)), SLOT(freqChanged(int)));
		updateFreq();
		addLabel("Frequency");
		addWidget(m_freq);

		addLabel("Frequency Table");
		m_freqTable = new QComboBox(parent);
		for (int i = 0; v4l2_channel_lists[i].name; i++) {
			m_freqTable->addItem(v4l2_channel_lists[i].name);
		}
		addWidget(m_freqTable);
		connect(m_freqTable, SIGNAL(activated(int)), SLOT(freqTableChanged(int)));

		addLabel("Channels");
		m_freqChannel = new QComboBox(parent);
		m_freqChannel->setSizeAdjustPolicy(QComboBox::AdjustToContents);
		addWidget(m_freqChannel);
		connect(m_freqChannel, SIGNAL(activated(int)), SLOT(freqChannelChanged(int)));
		updateFreqChannel();
	}

	v4l2_fmtdesc fmt;
	addLabel("Capture Image Formats");
	m_vidCapFormats = new QComboBox(parent);
	if (enum_fmt_cap(fmt, true)) {
		do {
			m_vidCapFormats->addItem(pixfmt2s(fmt.pixelformat) +
					" - " + (const char *)fmt.description);
		} while (enum_fmt_cap(fmt));
	}
	addWidget(m_vidCapFormats);
	connect(m_vidCapFormats, SIGNAL(activated(int)), SLOT(vidCapFormatChanged(int)));

	addLabel("Frame Width");
	m_frameWidth = new QSpinBox(parent);
	addWidget(m_frameWidth);
	connect(m_frameWidth, SIGNAL(editingFinished()), SLOT(frameWidthChanged()));
	addLabel("Frame Height");
	m_frameHeight = new QSpinBox(parent);
	addWidget(m_frameHeight);
	connect(m_frameHeight, SIGNAL(editingFinished()), SLOT(frameHeightChanged()));

	addLabel("Frame Size");
	m_frameSize = new QComboBox(parent);
	m_frameSize->setSizeAdjustPolicy(QComboBox::AdjustToContents);
	addWidget(m_frameSize);
	connect(m_frameSize, SIGNAL(activated(int)), SLOT(frameSizeChanged(int)));

	addLabel("Frame Interval");
	m_frameInterval = new QComboBox(parent);
	m_frameInterval->setSizeAdjustPolicy(QComboBox::AdjustToContents);
	addWidget(m_frameInterval);
	connect(m_frameInterval, SIGNAL(activated(int)), SLOT(frameIntervalChanged(int)));

	updateVidCapFormat();

	if (caps() & V4L2_CAP_VIDEO_OUTPUT) {
		addLabel("Output Image Formats");
		m_vidOutFormats = new QComboBox(parent);
		if (enum_fmt_out(fmt, true)) {
			do {
				m_vidOutFormats->addItem(pixfmt2s(fmt.pixelformat) +
						" - " + (const char *)fmt.description);
			} while (enum_fmt_out(fmt));
		}
		addWidget(m_vidOutFormats);
		connect(m_vidOutFormats, SIGNAL(activated(int)), SLOT(vidOutFormatChanged(int)));
	}

	addLabel("Capture Method");
	m_capMethods = new QComboBox(parent);
	if (m_querycap.capabilities & V4L2_CAP_STREAMING) {
		v4l2_requestbuffers reqbuf;

		// Yuck. The videobuf framework does not accept a count of 0.
		// This is out-of-spec, but it means that the only way to test which
		// method is supported is to give it a non-zero count. But non-videobuf
		// drivers like uvc do not allow e.g. S_FMT calls after a REQBUFS call
		// with non-zero counts unless there is a REQBUFS call with count == 0
		// in between. This is actual proper behavior, although somewhat
		// unexpected. So the only way at the moment to do this that works
		// everywhere is to call REQBUFS with a count of 1, and then again with
		// a count of 0.
		if (reqbufs_user_cap(reqbuf, 1)) {
			m_capMethods->addItem("User pointer I/O", QVariant(methodUser));
			reqbufs_user_cap(reqbuf, 0);
		}
		if (reqbufs_mmap_cap(reqbuf, 1)) {
			m_capMethods->addItem("Memory mapped I/O", QVariant(methodMmap));
			reqbufs_mmap_cap(reqbuf, 0);
		}
	}
	if (m_querycap.capabilities & V4L2_CAP_READWRITE) {
		m_capMethods->addItem("read()", QVariant(methodRead));
	}
	addWidget(m_capMethods);

	QGridLayout::addWidget(new QWidget(parent), rowCount(), 0, 1, n);
	setRowStretch(rowCount() - 1, 1);
}
예제 #26
0
void toResultDataSingle::changeSource(toResultModelEdit *model, int _row)
{
    delete Container;
    Container = new QScrollArea(this);
    layout()->addWidget(Container);

    Model = model;
    ProgressBar->setMaximum(Model->rowCount());
    ProgressBar->setValue(_row);

    QWidget *ext = new QWidget(Container);
    Container->setWidget(ext);
    Container->setWidgetResizable(true);

    QGridLayout *grid = new QGridLayout;
    ext->setLayout(grid);

    Value.clear();
    Null.clear();

    const toResultModel::HeaderList Headers = Model->headers();

    int row = 1 + Model->getPriKeys().size();
    int col = 0;

    for (; row < Headers.size(); row++, col = 0)
    {
        QLabel *name = new QLabel(Headers[row].name, this);
        grid->addWidget(name, row, col++);

        QLineEdit *edit = new QLineEdit(this);
        edit->setObjectName(QString::number(row));
        edit->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
                                        QSizePolicy::Minimum));
        grid->addWidget(edit, row, col);
        // edit widget should get the most space
        grid->setColumnStretch(col++, 1);

        QCheckBox *box = new QCheckBox(("NULL"), this);
        connect(box, SIGNAL(toggled(bool)), edit, SLOT(setDisabled(bool)));
        grid->addWidget(box, row, col++);

        toParamGetButton *btn = new toParamGetButton(row, this);
        btn->setText(tr("Edit"));
        btn->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed));
        connect(btn, SIGNAL(clicked(int)), this, SLOT(showMemo(int)));
        connect(box, SIGNAL(toggled(bool)), btn, SLOT(setDisabled(bool)));
        connect(box, SIGNAL(toggled(bool)), this, SLOT(saveRow()));
        connect(edit, SIGNAL(editingFinished()), this, SLOT(saveRow()));
        grid->addWidget(btn, row, col++);

        Value.append(edit);
        Null.append(box);
    }

    // add widget at bottom of grid so it can resize
    grid->addWidget(new QLabel(this), row, 0);
    grid->setRowStretch(row, 1);

    changeRow(Row);

    connect(Model,
            SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
            this,
            SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
}
예제 #27
0
파일: profileform.cpp 프로젝트: 1KoT1/qTox
ProfileForm::ProfileForm(QWidget *parent) :
    QWidget{parent}, qr{nullptr}
{
    bodyUI = new Ui::IdentitySettings;
    bodyUI->setupUi(this);
    core = Core::getInstance();

    head = new QWidget(this);
    QHBoxLayout* headLayout = new QHBoxLayout();
    head->setLayout(headLayout);

    QLabel* imgLabel = new QLabel();
    headLayout->addWidget(imgLabel);

    nameLabel = new QLabel();
    QFont bold;
    bold.setBold(true);
    nameLabel->setFont(bold);
    headLayout->addWidget(nameLabel);
    headLayout->addStretch(1);

    imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));

    // tox
    toxId = new ClickableTE();
    toxId->setReadOnly(true);
    toxId->setFrame(false);
    toxId->setFont(Style::getFont(Style::Small));
    toxId->setToolTip(bodyUI->toxId->toolTip());

    QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout());
    delete toxIdGroup->replaceWidget(bodyUI->toxId, toxId);     // Original toxId is in heap, delete it
    bodyUI->toxId->hide();

    bodyUI->qrLabel->setWordWrap(true);

    profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
    profilePicture->setContextMenuPolicy(Qt::CustomContextMenu);
    profilePicture->setClickable(true);
    profilePicture->installEventFilter(this);
    connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
    connect(profilePicture, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showProfilePictureContextMenu(const QPoint&)));
    QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout());
    publicGrouplayout->insertWidget(0, profilePicture);
    publicGrouplayout->insertSpacing(1, 7);

    timer.setInterval(750);
    timer.setSingleShot(true);
    connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;});

    connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(core, &Core::idSet, this, &ProfileForm::setToxId);
    connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
    connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
    connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked);
    connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked);
    connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked);
    connect(bodyUI->logoutButton, &QPushButton::clicked, this, &ProfileForm::onLogoutClicked);
    connect(bodyUI->deletePassButton, &QPushButton::clicked, this, &ProfileForm::onDeletePassClicked);
    connect(bodyUI->changePassButton, &QPushButton::clicked, this, &ProfileForm::onChangePassClicked);
    connect(bodyUI->saveQr, &QPushButton::clicked, this, &ProfileForm::onSaveQrClicked);
    connect(bodyUI->copyQr, &QPushButton::clicked, this, &ProfileForm::onCopyQrClicked);

    connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
    connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });

    for (QComboBox* cb : findChildren<QComboBox*>())
    {
            cb->installEventFilter(this);
            cb->setFocusPolicy(Qt::StrongFocus);
    }

    retranslateUi();
    Translator::registerHandler(std::bind(&ProfileForm::retranslateUi, this), this);
}
예제 #28
0
	CGeorgesNewDialog::CGeorgesNewDialog(QStringList& result, QWidget *parent)
		: QDialog(parent),
		_result(result),
		_descriptionTemplate(QString())
	{
		_ui.setupUi(this);

		setWindowIcon(QIcon(":/images/georges_logo.png"));

		_ui.parentLineEdit->setEnabled(false);
		_ui.addParentButton->setEnabled(true);

		// wizard page
		connect(_ui.wizardBtn, SIGNAL(clicked(bool)),
			this, SLOT(wizardBtnClicked(bool)));
		connect(_ui.wizardList, SIGNAL(itemClicked(QListWidgetItem*)),
			this, SLOT(wizardItemActivated(QListWidgetItem *)));
		
		// form page
		connect(_ui.formBtn, SIGNAL(clicked(bool)),
			this, SLOT(formBtnClicked(bool)));
		connect(_ui.addParentButton, SIGNAL(clicked()),
			this, SLOT(addParentClicked()));
		connect(_ui.deleteParentButton, SIGNAL(clicked()),
			this, SLOT(deleteParentClicked()));
		connect(_ui.formList, SIGNAL(itemActivated(QListWidgetItem*)),
			this, SLOT(formItemActivated(QListWidgetItem *)));
		connect(_ui.formList, SIGNAL(itemClicked(QListWidgetItem*)),
			this, SLOT(formItemActivated(QListWidgetItem *)));
		connect(_ui.parentLineEdit, SIGNAL(editingFinished()),
			this, SLOT(validateParentCombo()));

		// dfn page
		connect(_ui.dfnTypeBtn, SIGNAL(clicked(bool)),
			this, SLOT(dfnTypeClicked(bool)));

		connect(_ui.buttonBox, SIGNAL(accepted()),
			this, SLOT(buttonBoxAccepted()));
		connect(_ui.buttonBox, SIGNAL(rejected()),
			this, SLOT(buttonBoxRejected()));

		// wizard list
		QListWidgetItem *mpWiz = new QListWidgetItem(QIcon(":/images/mp_generic.png"),tr("Raw Material Generator"));
		_ui.wizardList->addItem(mpWiz);

		// form list
		QString path = Modules::mainWin().leveldesignPath();
		QStringList typelist;
		//nlinfo ("Searching files in directory '%s'...", dir.c_str());
		NLMISC::CPath::getPathContent(path.toUtf8().constData(),true,false,true,_files);

		getTypes( /* path.toUtf8() // incompatible parameter type */ );
		//nlinfo ("%d supported file types :",FileTypeToId.size());
		for ( std::map<std::string,uint8>::iterator it = FileTypeToId.begin(); it != FileTypeToId.end(); ++it )
		{
			typelist.append(QString((*it).first.c_str()));
			//nlinfo("%s",(*it).first.c_str());
		}
		_ui.formList->addItems(typelist);

		for(uint i = 0; i < _files.size(); i++)
		{
			std::string extStr = NLMISC::CFile::getExtension( _files[i] );

			// filter files without existing dfn
			if (!NLMISC::CPath::exists(extStr + ".dfn") &&
				!NLMISC::CPath::exists(extStr + ".typ"))
			{
				continue;
			}
			_filelist.append(QString(NLMISC::CFile::getFilename(_files[i]).c_str()));
		}		

		_ui.parentFrame->hide();

		// replace "Heading" and "Descriptive Text" with your string
		_descriptionTemplate = 
			"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"" 
			"\"http://www.w3.org/TR/REC-html40/strict.dtd\">"
			"\n<html><head><meta name=\"qrichtext\" content=\"1\" />"
			"<style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style>"
			"</head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
			"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
			"<span style=\" font-size:8pt; font-weight:600;\">Heading</span></p>"
			"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
			"<span style=\" font-size:8pt;\">Descriptive Text</span></p></body></html>";
	}
예제 #29
0
PlotControlWidget::PlotControlWidget(QWidget *parent) :
    ControlWidget(parent),
    ui(new Ui::PlotControlWidget)
{
    ui->setupUi(this);

    ui->gridLayout->setSpacing(0);
    ui->gridLayout->setMargin(0);
    ui->verticalLayout->setSpacing(0);
    ui->verticalLayout->setMargin(0);
    ui->verticalLayout_3->setSpacing(0);
    ui->verticalLayout_3->setMargin(0);
    ui->verticalLayout_4->setSpacing(0);
    ui->verticalLayout_4->setMargin(0);
    ui->verticalLayout_5->setSpacing(0);
    ui->verticalLayout_5->setMargin(0);
    ui->verticalLayout_6->setSpacing(0);
    ui->verticalLayout_6->setMargin(0);
    ui->verticalLayout_8->setSpacing(0);
    ui->verticalLayout_8->setMargin(0);


    layout()->setSpacing(0);
    layout()->setMargin(0);



    mFastenToolButtonVector << ui->fastenToolButton_0;
    mFastenToolButtonVector << ui->fastenToolButton_1;
    mFastenToolButtonVector << ui->fastenToolButton_2;
    mFastenToolButtonVector << ui->fastenToolButton_3;
    mFastenToolButtonVector << ui->fastenToolButton_4;
    mFastenToolButtonVector << ui->fastenToolButton_5;
    mFastenToolButtonVector << ui->fastenToolButton_6;
    mFastenToolButtonVector << ui->fastenToolButton_7;
    mFastenToolButtonVector << ui->fastenToolButton_8;
    mFastenToolButtonVector << ui->fastenToolButton_9;
    mFastenToolButtonVector << ui->fastenToolButton_10;
    mFastenToolButtonVector << ui->fastenToolButton_11;
    mFastenToolButtonVector << ui->fastenToolButton_12;
    for (int i = 0; i < mFastenToolButtonVector.size(); ++i) {
        mFastenToolButtonVector[i]->setChecked(sTabVisibilityVector[i]);
        connect(mFastenToolButtonVector[i], SIGNAL(toggled(bool)),
                this, SLOT(treatFastenToolButtonPressed()));
    }
    mTabsVector << ui->tab_0;
    mTabsVector << ui->tab_1;
    mTabsVector << ui->tab_2;
    mTabsVector << ui->tab_3;
    mTabsVector << ui->tab_4;
    mTabsVector << ui->tab_5;
    mTabsVector << ui->tab_6;
    mTabsVector << ui->tab_7;
    mTabsVector << ui->tab_8;
    mTabsVector << ui->tab_9;
    mTabsVector << ui->tab_10;
    mTabsVector << ui->tab_11;
    mTabsVector << ui->tab_12;

    for (auto tab : mTabsVector) {
        tab->layout()->setSpacing(0);
        tab->layout()->setMargin(0);
    }


    ui->xGridWidget->setHead("X grid");
    ui->yGridWidget->setHead("Y grid");
    ui->xSubGridWidget->setHead("X sub grid");
    ui->ySubGridWidget->setHead("Y sub grid");

    ui->scaleTypeComboBox->addItem("Linear", PlotLayoutModel::ScaleType::Linear);
    ui->scaleTypeComboBox->addItem("Logarithmic", PlotLayoutModel::ScaleType::Logarithmic);

    ui->timeFormatComboBox->addItem("Number", QCPAxis::ltNumber);
    ui->timeFormatComboBox->addItem("DateTime", QCPAxis::ltDateTime);

    ui->subTickEditingWidget->setSubTickCountVisibility(false);

    connect(ui->xLowMarginLineEdit, SIGNAL(editingFinished()),
            this, SLOT(treatXLowLimitRequest()));
    connect(ui->xHighMarginLineEdit, SIGNAL(editingFinished()),
            this, SLOT(treatXHighLimitRequest()));
    connect(ui->xLabelLineEdit, SIGNAL(editingFinished()),
            this, SLOT(treatXLabelChanging()));
    connect(ui->titleEditingWidget, SIGNAL(titleChanged()),
            this, SLOT(treatTitleChanging()));
    connect(ui->titleEditingWidget, SIGNAL(titlePropertiesChanged()),
            this, SLOT(treatTitlePropertiesChanging()));

    connect(ui->scaleTypeComboBox, SIGNAL(valueActivated(boost::any)),
            this, SLOT(treatScaleTypeChanging()));
    connect(ui->timeFormatComboBox, SIGNAL(valueActivated(boost::any)),
            this, SLOT(treatTimeAxisTypeChanging()));
    connect(ui->xTickRotationDoubleSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(treatXTickRotationChanging()));
    connect(ui->eventLabelRotationDoubleSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(treatCommandLabelRotationChanging()));

    connect(ui->legendLayoutComboBox, SIGNAL(currentLegendLocationChanged(style::LegendLocation)),
            this, SLOT(treatLegendLayoutChanging()));

    connect(ui->legendFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatLegendFontSizeChanging()));
    connect(ui->yLabelFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatUnitsFontSizeChanging()));
    connect(ui->xLabelFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatXLabelFontSizeChanging()));
    connect(ui->xAxisFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatXAxisFontSizeChanging()));
    connect(ui->yAxisFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatYAxisFontSizeChanging()));
//    connect(ui->titleFontSizeSpinBox, SIGNAL(valueChanged(int)),
//            this, SLOT(treatTitleFontSizeChanging()));
    connect(ui->eventFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatEventFontSizeChanging()));
    connect(ui->arrowedTextFontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(treatArrowedTextFontSizeChanging()));

    connect(ui->legendFrameVisibilityCheckBox, SIGNAL(toggled ( bool )),
            this, SLOT(treatLegendFrameVisibilityChanging()));
    connect(ui->legendVisibilityCheckBox, SIGNAL(toggled ( bool )),
            this, SLOT(treatLegendVisibilityChanging()));
    connect(ui->unitsVisibilityCheckBox, SIGNAL(toggled ( bool )),
            this, SLOT(treatUnitsVisibilityChanging()));

    connect(ui->defaultPushButton, SIGNAL(clicked(bool)),
            this, SLOT(initiliazeLayoutPreferencesFromDefault()));


    connect(ui->xGridWidget, SIGNAL(gridChanged(style::Grid)),
            this, SLOT(treatXGridChanging()));
    connect(ui->yGridWidget, SIGNAL(gridChanged(style::Grid)),
            this, SLOT(treatYGridChanging()));
    connect(ui->xSubGridWidget, SIGNAL(gridChanged(style::Grid)),
            this, SLOT(treatXSubGridChanging()));
    connect(ui->ySubGridWidget, SIGNAL(gridChanged(style::Grid)),
            this, SLOT(treatYSubGridChanging()));
    connect(ui->axisRectEditingWidget, SIGNAL(axisRectPropertiesChanged()),
            this, SLOT(treatAxisRectChanging()));
    connect(ui->tickEditingWidget, SIGNAL(tickChanged()),
            this, SLOT(treatTickChanging()));
    connect(ui->subTickEditingWidget, SIGNAL(tickChanged()),
            this, SLOT(treatSubTickChanging()));
    connect(ui->colorSetEdititngWidget, SIGNAL(colorPrefChangedByUser()),
            this, SLOT(treatColorPrefChanging()));

    connect(ui->xAxisPrefWidget, SIGNAL(axisPrefChanged()),
            this, SLOT(treatXAxisPrefChanging()));
    connect(ui->yAxisPrefWidget, SIGNAL(axisPrefChanged()),
            this, SLOT(treatYAxisPrefChanging()));

    //NOTE: To avoid signal valueChanged emitting on each keyboard button pressing. ValueChanged signal will be emitted
    //only after Return is pressed or if widget loses focus.
    ui->xTickRotationDoubleSpinBox->setKeyboardTracking(false);
    ui->eventLabelRotationDoubleSpinBox->setKeyboardTracking(false);
    ui->legendFontSizeSpinBox->setKeyboardTracking(false);
    ui->yLabelFontSizeSpinBox->setKeyboardTracking(false);
    ui->xLabelFontSizeSpinBox->setKeyboardTracking(false);
    ui->xAxisFontSizeSpinBox->setKeyboardTracking(false);
//    ui->titleFontSizeSpinBox->setKeyboardTracking(false);
    ui->eventFontSizeSpinBox->setKeyboardTracking(false);
    ui->arrowedTextFontSizeSpinBox->setKeyboardTracking(false);

    QDoubleValidator *doubleValidator = new QDoubleValidator(this);
    ui->xLowMarginLineEdit->setValidator(doubleValidator);
    ui->xHighMarginLineEdit->setValidator(doubleValidator);

}
예제 #30
0
GeneralEdit::GeneralEdit(EEPFILE *eFile, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::GeneralEdit)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon(":/icon.png"));
    eeFile = eFile;

    switchDefPosEditLock = false;

    QSettings settings("er9x-eePe", "eePe");
    ui->tabWidget->setCurrentIndex(settings.value("generalEditTab", 0).toInt());

    eeFile->getGeneralSettings(&g_eeGeneral);
		createSwitchMapping( &g_eeGeneral, eeFile->mee_type ) ;
    QRegExp rx(CHAR_FOR_NAMES_REGEX);
    ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));

    populateSwitchCB(ui->backlightswCB,g_eeGeneral.lightSw,eeFile->mee_type);

    ui->ownerNameLE->setText(g_eeGeneral.ownerName);

		for(quint8 i=0; i<16; i++)
		{
			if (g_eeGeneral.customStickNames[i] == 0 )
			{
				g_eeGeneral.customStickNames[i] = ' ' ;
			}
		}

    QString Str = (char *)g_eeGeneral.customStickNames ;
    ui->rudNameLE->setText( Str.mid(0,4)) ;
    ui->eleNameLE->setText( Str.mid(4,4)) ;
    ui->thrNameLE->setText( Str.mid(8,4)) ;
    ui->ailNameLE->setText( Str.mid(12,4)) ;

    ui->contrastSB->setValue(g_eeGeneral.contrast);
    ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10);
    ui->battcalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
    ui->battCalib->setValue((double)g_eeGeneral.vBatCalib/10);
    ui->backlightautoSB->setValue(g_eeGeneral.lightAutoOff*5);
    ui->backlightStickMove->setValue(g_eeGeneral.lightOnStickMove*5);
    ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer+10);

    ui->soundModeCB->setCurrentIndex(g_eeGeneral.speakerMode > 3 ? 4 : g_eeGeneral.speakerMode );
    ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
    ui->hapticStengthSB->setValue(g_eeGeneral.hapticStrength);

    ui->thrrevChkB->setChecked(g_eeGeneral.throttleReversed);
//    ui->inputfilterCB->setCurrentIndex(g_eeGeneral.filterInput);
    ui->thrwarnChkB->setChecked(!g_eeGeneral.disableThrottleWarning);   //Default is zero=checked
    ui->switchwarnChkB->setChecked(!g_eeGeneral.disableSwitchWarning); //Default is zero=checked
    ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning);   //Default is zero=checked
    ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked
    ui->PotScrollEnableChkB->setChecked(!g_eeGeneral.disablePotScroll);//Default is zero=checked
    ui->StickScrollEnableChkB->setChecked(g_eeGeneral.stickScroll);//Default is zero=not checked
    ui->CrossTrimChkB->setChecked(g_eeGeneral.crosstrim);//Default is zero=not checked
    ui->FrskyPinsChkB->setChecked(g_eeGeneral.FrskyPins);//Default is zero=not checked
    ui->TeZ_gt_90ChkB->setChecked(g_eeGeneral.TEZr90);//Default is zero=not checked
    ui->MsoundSerialChkB->setChecked(g_eeGeneral.MegasoundSerial);//Default is zero=not checked
    ui->RotateScreenChkB->setChecked(g_eeGeneral.rotateScreen);//Default is zero=not checked
    ui->SerialLCDChkB->setChecked(g_eeGeneral.serialLCD);//Default is zero=not checked
    ui->SSD1306ChkB->setChecked(g_eeGeneral.SSD1306);//Default is zero=not checked
    ui->BandGapEnableChkB->setChecked(!g_eeGeneral.disableBG);//Default is zero=checked
    ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperVal);
    ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup);
    ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode);
    
		ui->volumeSB->setValue(g_eeGeneral.volume+7);
    ui->enablePpmsimChkB->setChecked(g_eeGeneral.enablePpmsim);
    ui->internalFrskyAlarmChkB->setChecked(g_eeGeneral.frskyinternalalarm);
    ui->backlightinvertChkB->setChecked(g_eeGeneral.blightinv);

    ui->beepMinuteChkB->setChecked(g_eeGeneral.minuteBeep);
    ui->beepCountDownChkB->setChecked(g_eeGeneral.preBeep);
    ui->beepFlashChkB->setChecked(g_eeGeneral.flashBeep);
    ui->splashScreenChkB->setChecked(!g_eeGeneral.disableSplashScreen);
    ui->splashScreenNameChkB->setChecked(!g_eeGeneral.hideNameOnSplash);

    ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]);
    ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]);
    ui->ana3Neg->setValue(g_eeGeneral.calibSpanNeg[2]);
    ui->ana4Neg->setValue(g_eeGeneral.calibSpanNeg[3]);
    ui->ana5Neg->setValue(g_eeGeneral.calibSpanNeg[4]);
    ui->ana6Neg->setValue(g_eeGeneral.calibSpanNeg[5]);
    ui->ana7Neg->setValue(g_eeGeneral.calibSpanNeg[6]);

    ui->ana1Mid->setValue(g_eeGeneral.calibMid[0]);
    ui->ana2Mid->setValue(g_eeGeneral.calibMid[1]);
    ui->ana3Mid->setValue(g_eeGeneral.calibMid[2]);
    ui->ana4Mid->setValue(g_eeGeneral.calibMid[3]);
    ui->ana5Mid->setValue(g_eeGeneral.calibMid[4]);
    ui->ana6Mid->setValue(g_eeGeneral.calibMid[5]);
    ui->ana7Mid->setValue(g_eeGeneral.calibMid[6]);

    ui->ana1Pos->setValue(g_eeGeneral.calibSpanPos[0]);
    ui->ana2Pos->setValue(g_eeGeneral.calibSpanPos[1]);
    ui->ana3Pos->setValue(g_eeGeneral.calibSpanPos[2]);
    ui->ana4Pos->setValue(g_eeGeneral.calibSpanPos[3]);
    ui->ana5Pos->setValue(g_eeGeneral.calibSpanPos[4]);
    ui->ana6Pos->setValue(g_eeGeneral.calibSpanPos[5]);
    ui->ana7Pos->setValue(g_eeGeneral.calibSpanPos[6]);

    setSwitchDefPos();
    
    ui->StickRevLH->setChecked(g_eeGeneral.stickReverse & 0x01);
    ui->StickRevLV->setChecked(g_eeGeneral.stickReverse & 0x02);
    ui->StickRevRV->setChecked(g_eeGeneral.stickReverse & 0x04);
    ui->StickRevRH->setChecked(g_eeGeneral.stickReverse & 0x08);

		ui->weightSB_1->findChild<QLineEdit*>()->setReadOnly(true);
    ui->weightSB_2->findChild<QLineEdit*>()->setReadOnly(true);
    ui->weightSB_3->findChild<QLineEdit*>()->setReadOnly(true);
    ui->weightSB_4->findChild<QLineEdit*>()->setReadOnly(true);

    updateTrianerTab();

    connect(ui->modeCB_1, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->modeCB_2, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->modeCB_3, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->modeCB_4, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));

    connect(ui->weightSB_1, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->weightSB_2, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->weightSB_3, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->weightSB_4, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));

    connect(ui->sourceCB_1, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->sourceCB_2, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->sourceCB_3, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->sourceCB_4, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));

    connect(ui->swtchCB_1, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->swtchCB_2, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->swtchCB_3, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));
    connect(ui->swtchCB_4, SIGNAL(currentIndexChanged(int)), this, SLOT(trainerTabValueChanged()));

    connect(ui->trainerCalib_1, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->trainerCalib_2, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->trainerCalib_3, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));
    connect(ui->trainerCalib_4, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));

    connect(ui->PPM_MultiplierDSB, SIGNAL(editingFinished()), this, SLOT(trainerTabValueChanged()));

    connect(ui->weightSB_1, SIGNAL(valueChanged(int)), this, SLOT(validateWeightSB()));
    connect(ui->weightSB_2, SIGNAL(valueChanged(int)), this, SLOT(validateWeightSB()));
    connect(ui->weightSB_3, SIGNAL(valueChanged(int)), this, SLOT(validateWeightSB()));
    connect(ui->weightSB_4, SIGNAL(valueChanged(int)), this, SLOT(validateWeightSB()));

	populateHardwareSwitch(ui->EleSwitchSource, g_eeGeneral.ele2source ) ;
	populateHardwareSwitch(ui->AilSwitchSource, g_eeGeneral.ail2source ) ;
	populateHardwareSwitch(ui->Pb1SwitchSource, g_eeGeneral.pb1source ) ;
	populateHardwareSwitch(ui->Pb2SwitchSource, g_eeGeneral.pb2source ) ;
	ui->L_wrInputCB->setChecked( g_eeGeneral.lcd_wrInput ) ;
	ui->Pb7InputCB->setChecked( g_eeGeneral.pb7Input ) ;
  ui->Pg2InputCB->setChecked( g_eeGeneral.pg2Input ) ;
}