configwidget::configwidget(QWidget *parent) : QDialog(parent), m_ui(new Ui::configwidget) { m_ui->setupUi(this); conf = Config::instance(); m_ui->tabWidget->setCurrentIndex(0); loadSettings(); on_defDelay_valueChanged(conf->getDefDelay()); setVisibleDateTplEdit(conf->getDateTimeInFilename()); connect(m_ui->butSaveOpt, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_ui->buttonBrowse, SIGNAL(clicked()), this, SLOT(selectDir())); connect(m_ui->butRestoreOpt, SIGNAL(clicked()), this, SLOT(restoreDefaults()) ); connect(m_ui->checkIncDate, SIGNAL(toggled(bool)), this, SLOT(setVisibleDateTplEdit(bool))); connect(m_ui->keyWidget, SIGNAL(keySequenceAccepted(QKeySequence)), this, SLOT(acceptShortcut(QKeySequence))); connect(m_ui->keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(changeShortcut(QKeySequence))); connect(m_ui->keyWidget, SIGNAL(keyNotSupported()), this, SLOT(keyNotSupported())); on_editDateTmeTpl_textEdited(conf->getDateTimeTpl()); m_ui->treeKeys->expandAll(); m_ui->treeKeys->header()->setResizeMode(QHeaderView::Stretch); // adding shortcut values in treewidget int action = 0; QTreeWidgetItemIterator iter(m_ui->treeKeys); while(*iter) { if ((*iter)->parent() != NULL) { (*iter)->setData(1, Qt::DisplayRole, conf->shortcuts()->getShortcut(action)); ++action; } ++iter; } // set false visibility to edit hokey controls m_ui->labUsedShortcut->setVisible(false); m_ui->keyWidget->setVisible(false); }
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent), _ui(new Ui::configwidget) { _ui->setupUi(this); conf = Config::instance(); connect(_ui->butSaveOpt, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(_ui->buttonBrowse, SIGNAL(clicked()), this, SLOT(selectDir())); connect(_ui->butRestoreOpt, SIGNAL(clicked()), this, SLOT(restoreDefaults()) ); connect(_ui->checkIncDate, SIGNAL(toggled(bool)), this, SLOT(setVisibleDateTplEdit(bool))); connect(_ui->keyWidget, SIGNAL(keySequenceAccepted(QKeySequence)), this, SLOT(acceptShortcut(QKeySequence))); connect(_ui->keyWidget, SIGNAL(keyNotSupported()), this, SLOT(keyNotSupported())); connect(_ui->checkAutoSave, SIGNAL(clicked(bool)), this, SLOT(setVisibleAutoSaveFirst(bool))); connect(_ui->butCancel, SIGNAL(clicked(bool)), this, SLOT(reject())); connect(_ui->treeKeys, SIGNAL(expanded(QModelIndex)), _ui->treeKeys, SLOT(clearSelection())); connect(_ui->treeKeys, SIGNAL(collapsed(QModelIndex)), this, SLOT(collapsTreeKeys(QModelIndex))); connect(_ui->checkShowTray, SIGNAL(toggled(bool)), this, SLOT(toggleCheckShowTray(bool))); connect(_ui->editDateTmeTpl, SIGNAL(textEdited(QString)), this, SLOT(editDateTmeTpl(QString))); connect(_ui->defDelay, SIGNAL(valueChanged(int)), this, SLOT(changeDefDelay(int))); connect(_ui->timeTrayMess, SIGNAL(valueChanged(int)), this, SLOT(changeTimeTrayMess(int))); connect(_ui->cbxTrayMsg, SIGNAL(currentIndexChanged(int)), this, SLOT(changeTrayMsgType(int))); connect(_ui->treeKeys, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleclickTreeKeys(QModelIndex))); connect(_ui->treeKeys, SIGNAL(activated(QModelIndex)), this, SLOT(doubleclickTreeKeys(QModelIndex))); connect(_ui->treeKeys->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentItemChanged(const QModelIndex,const QModelIndex))); connect(_ui->keyWidget, SIGNAL(keySequenceCleared()), this, SLOT(clearShrtcut())); connect(_ui->listWidget, SIGNAL(currentRowChanged(int)), _ui->stackedWidget, SLOT(setCurrentIndex(int))); connect(_ui->slideImgQuality, SIGNAL(valueChanged(int)), this, SLOT(changeImgQualituSlider(int))); connect(_ui->cbxFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFormatType(int))); loadSettings(); changeDefDelay(conf->getDefDelay()); setVisibleDateTplEdit(conf->getDateTimeInFilename()); setVisibleAutoSaveFirst(conf->getAutoSave()); _ui->listWidget->setCurrentRow(0); _ui->tabMain->setCurrentIndex(0); editDateTmeTpl(conf->getDateTimeTpl()); _ui->treeKeys->expandAll(); _ui->treeKeys->header()->setSectionResizeMode(QHeaderView::Stretch); // adding shortcut values in treewidge int action = 0; QTreeWidgetItemIterator iter(_ui->treeKeys); while(*iter) { if ((*iter)->parent() != NULL) { (*iter)->setData(1, Qt::DisplayRole, conf->shortcuts()->getShortcut(action)); #ifndef SG_GLOBAL_SHORTCUTS if (conf->shortcuts()->getShortcutType(action) == Config::globalShortcut) { (*iter)->setHidden(true); } #endif ++action; } else { #ifndef SG_GLOBAL_SHORTCUTS int numGlobalShortcuts = conf->shortcuts()->getShortcutsList(Config::globalShortcut).count(); if ((*iter)->childCount() == numGlobalShortcuts) { (*iter)->setHidden(true); } #endif } ++iter; } // set false visibility to edit hokey controls _ui->labUsedShortcut->setVisible(false); _ui->keyWidget->setVisible(false); // Load config widgets for modules quint8 countModules = Core::instance()->modules()->count(); for (int i = 0; i < countModules; ++i) { AbstractModule* currentModule = Core::instance()->modules()->getModule(i); if (currentModule->initConfigWidget() != 0) { _ui->listWidget->addItem(currentModule->moduleName()); QWidget *currentModWidget = currentModule->initConfigWidget(); _ui->stackedWidget->addWidget(currentModWidget); _moduleWidgetNames << currentModWidget->objectName(); } } }
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent), _ui(new Ui::configwidget) { _ui->setupUi(this); conf = Config::instance(); connect(_ui->butSaveOpt, &QPushButton::clicked, this, &ConfigDialog::saveSettings); connect(_ui->buttonBrowse, &QPushButton::clicked, this, &ConfigDialog::selectDir); connect(_ui->butRestoreOpt, &QPushButton::clicked, this, &ConfigDialog::restoreDefaults); connect(_ui->checkIncDate, &QCheckBox::toggled, this, &ConfigDialog::setVisibleDateTplEdit); connect(_ui->keyWidget, &QKeySequenceWidget::keySequenceAccepted, this, &ConfigDialog::acceptShortcut); connect(_ui->keyWidget, &QKeySequenceWidget::keyNotSupported, this, &ConfigDialog::keyNotSupported); connect(_ui->checkAutoSave, &QCheckBox::toggled, this, &ConfigDialog::setVisibleAutoSaveFirst); connect(_ui->butCancel, &QPushButton::clicked, this, &ConfigDialog::reject); connect(_ui->treeKeys, &QTreeWidget::expanded, _ui->treeKeys, &QTreeWidget::clearSelection); connect(_ui->treeKeys, &QTreeWidget::collapsed, this, &ConfigDialog::collapsTreeKeys); connect(_ui->checkShowTray, &QCheckBox::toggled, this, &ConfigDialog::toggleCheckShowTray); connect(_ui->editDateTmeTpl, &QLineEdit::textEdited, this, &ConfigDialog::editDateTmeTpl); void (QSpinBox::*delayChange)(int) = &QSpinBox::valueChanged; connect(_ui->defDelay, delayChange, this, &ConfigDialog::changeDefDelay); void (QSpinBox::*timeToTray)(int) = &QSpinBox::valueChanged; connect(_ui->timeTrayMess, timeToTray, this, &ConfigDialog::changeTimeTrayMess); void (QComboBox::*trayMessType)(int) = &QComboBox::currentIndexChanged; connect(_ui->cbxTrayMsg, trayMessType, this, &ConfigDialog::changeTrayMsgType); connect(_ui->treeKeys, &QTreeWidget::doubleClicked, this, &ConfigDialog::doubleclickTreeKeys); connect(_ui->treeKeys, &QTreeWidget::activated, this, &ConfigDialog::doubleclickTreeKeys); connect(_ui->treeKeys->selectionModel(), &QItemSelectionModel::currentChanged, this, &ConfigDialog::currentItemChanged); connect(_ui->keyWidget, &QKeySequenceWidget::keySequenceCleared, this, &ConfigDialog::clearShrtcut); connect(_ui->listWidget, &QListWidget::currentRowChanged, _ui->stackedWidget, &QStackedWidget::setCurrentIndex); connect(_ui->slideImgQuality, &QSlider::valueChanged, this, &ConfigDialog::changeImgQualituSlider); void (QComboBox::*formatChabge)(int) = &QComboBox::currentIndexChanged; connect(_ui->cbxFormat, formatChabge, this, &ConfigDialog::changeFormatType); loadSettings(); changeDefDelay(conf->getDefDelay()); setVisibleDateTplEdit(conf->getDateTimeInFilename()); setVisibleAutoSaveFirst(conf->getAutoSave()); _ui->listWidget->setCurrentRow(0); _ui->tabMain->setCurrentIndex(0); editDateTmeTpl(conf->getDateTimeTpl()); _ui->treeKeys->expandAll(); _ui->treeKeys->header()->setSectionResizeMode(QHeaderView::Stretch); // adding shortcut values in treewidge int action = 0; QTreeWidgetItemIterator iter(_ui->treeKeys); while (*iter) { if ((*iter)->parent() != NULL) { (*iter)->setData(1, Qt::DisplayRole, conf->shortcuts()->getShortcut(action)); #ifndef SG_GLOBAL_SHORTCUTS if (conf->shortcuts()->getShortcutType(action) == Config::globalShortcut) (*iter)->setHidden(true); #endif ++action; } else { #ifndef SG_GLOBAL_SHORTCUTS int numGlobalShortcuts = conf->shortcuts()->getShortcutsList(Config::globalShortcut).count(); if ((*iter)->childCount() == numGlobalShortcuts) (*iter)->setHidden(true); #endif } ++iter; } // set false visibility to edit hokey controls _ui->labUsedShortcut->setVisible(false); _ui->keyWidget->setVisible(false); // Load config widgets for modules quint8 countModules = Core::instance()->modules()->count(); for (int i = 0; i < countModules; ++i) { AbstractModule* currentModule = Core::instance()->modules()->getModule(i); if (currentModule->initConfigWidget() != 0) { _ui->listWidget->addItem(currentModule->moduleName()); QWidget *currentModWidget = currentModule->initConfigWidget(); _ui->stackedWidget->addWidget(currentModWidget); _moduleWidgetNames << currentModWidget->objectName(); } } }