SettingsDialog::SettingsDialog(QWidget * parent)
    : QDialog(parent)
{
    setupUi(this);

    QSettings settings;
    QRect geometry = settings.value("SettingsDialog/geometry").toRect();
    if(!geometry.isEmpty())
    {
        setGeometry(geometry);
    }

    m_defaultsButton->setIcon(QIcon::fromTheme("document-revert", QIcon(":/document-revert.png")));
    m_okButton->setIcon(QIcon::fromTheme("dialog-ok", QIcon(":/dialog-ok.png")));
    m_applyButton->setIcon(QIcon::fromTheme("dialog-ok-apply", QIcon(":/dialog-ok-apply.png")));
    m_cancelButton->setIcon(QIcon::fromTheme("dialog-cancel", QIcon(":/dialog-cancel.png")));

    m_historyExpirationComboBox->setItemData(0, 1);
    m_historyExpirationComboBox->setItemData(1, 3);
    m_historyExpirationComboBox->setItemData(2, 7);
    m_historyExpirationComboBox->setItemData(3, 14);
    m_historyExpirationComboBox->setItemData(4, 30);
    m_historyExpirationComboBox->setItemData(5, 90);
    m_historyExpirationComboBox->setItemData(6, 180);
    m_historyExpirationComboBox->setItemData(7, 360);

    connect(m_defaultsButton, SIGNAL(clicked()), this, SLOT(defaults()));
    connect(m_okButton, SIGNAL(clicked()), this, SLOT(save()));
    connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect(m_applyButton, SIGNAL(clicked()), this, SLOT(save()));
    connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    connect(m_downloadCheckBox, SIGNAL(toggled(bool)), m_downloadToolButton, SLOT(setEnabled(bool)));
    connect(m_downloadToolButton, SIGNAL(clicked()), this, SLOT(openNewDirectory()));
    connect(m_listWidget, SIGNAL(currentRowChanged(int)), m_stackedWidget, SLOT(setCurrentIndex(int)));

    m_listWidget->setCurrentRow(settings.value("SettingsDialog/row").toInt());

    load();
}
Example #2
0
SettingsDialog::SettingsDialog(void) {
  setupUi(this);

  QRect geometry = SettingsManager::settingsManager()->settingsDialogGeometry();
  if(geometry != QRect()) {
    setGeometry(geometry);
  }

  _historyExpirationComboBox->setItemData(0, 1);
  _historyExpirationComboBox->setItemData(1, 3);
  _historyExpirationComboBox->setItemData(2, 7);
  _historyExpirationComboBox->setItemData(3, 14);
  _historyExpirationComboBox->setItemData(4, 30);
  _historyExpirationComboBox->setItemData(5, 90);
  _historyExpirationComboBox->setItemData(6, 180);
  _historyExpirationComboBox->setItemData(7, 360);

  connect(_defaultsButton, SIGNAL(clicked()), this, SLOT(defaults()));
  connect(_okButton, SIGNAL(clicked()), this, SLOT(ok()));
  connect(_applyButton, SIGNAL(clicked()), this, SLOT(apply()));
  connect(_cancelButton, SIGNAL(clicked()), this, SLOT(close()));
  connect(_downloadCheckBox, SIGNAL(toggled(bool)), _downloadToolButton, SLOT(setEnabled(bool)));
  connect(_downloadToolButton, SIGNAL(clicked()), this, SLOT(openNewDirectory()));
}