IdentityEditWidget::IdentityEditWidget(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);

    ui.addNick->setIcon(QIcon::fromTheme("list-add"));
    ui.deleteNick->setIcon(QIcon::fromTheme("edit-delete"));
    ui.renameNick->setIcon(QIcon::fromTheme("edit-rename"));
    ui.nickUp->setIcon(QIcon::fromTheme("go-up"));
    ui.nickDown->setIcon(QIcon::fromTheme("go-down"));

    // We need to know whenever the state of input widgets changes...
    connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.nicknameList, SIGNAL(itemChanged(QListWidgetItem *)), this, SIGNAL(widgetHasChanged()));
    connect(ui.awayNick, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.awayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.autoAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
    connect(ui.autoAwayTime, SIGNAL(valueChanged(int)), this, SIGNAL(widgetHasChanged()));
    connect(ui.autoAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.autoAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
    connect(ui.detachAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
    connect(ui.detachAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.ident, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.kickReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.partReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
    connect(ui.quitReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));

    setWidgetStates();
    connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));

    connect(ui.continueUnsecured, SIGNAL(clicked()), this, SIGNAL(requestEditSsl()));

    // we would need this if we enabled drag and drop in the nicklist...
    //connect(ui.nicknameList, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(setWidgetStates()));
    //connect(ui.nicknameList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(nicklistHasChanged()));

    // disabling unused stuff
    ui.autoAwayEnabled->hide();
    ui.awayNick->hide();
    ui.awayNickLabel->hide();

    ui.detachAwayEnabled->setVisible(!Client::internalCore());

#ifdef HAVE_SSL
    ui.sslKeyGroupBox->setAcceptDrops(true);
    ui.sslKeyGroupBox->installEventFilter(this);
    ui.sslCertGroupBox->setAcceptDrops(true);
    ui.sslCertGroupBox->installEventFilter(this);
#endif
}
CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent)
    : SettingsPage(tr("Remote Cores"), QString(), parent),
    _lastAccountId(0),
    _lastAutoConnectId(0),
    _standalone(false)
{
    ui.setupUi(this);
    initAutoWidgets();
    ui.addAccountButton->setIcon(SmallIcon("list-add"));
    ui.editAccountButton->setIcon(SmallIcon("document-edit"));
    ui.deleteAccountButton->setIcon(SmallIcon("edit-delete"));

    _model = new CoreAccountModel(Client::coreAccountModel(), this);
    _filteredModel = new FilteredCoreAccountModel(_model, this);

    ui.accountView->setModel(filteredModel());
    ui.autoConnectAccount->setModel(filteredModel());

    connect(filteredModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), SLOT(rowsAboutToBeRemoved(QModelIndex, int, int)));
    connect(filteredModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(rowsInserted(QModelIndex, int, int)));

    connect(ui.accountView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(setWidgetStates()));
    connect(ui.autoConnectAccount, SIGNAL(currentIndexChanged(int)), SLOT(widgetHasChanged()));
    setWidgetStates();
}
Ejemplo n.º 3
0
ShortcutsSettingsPage::ShortcutsSettingsPage(const QHash<QString, ActionCollection*>& actionCollections, QWidget* parent)
    : SettingsPage(tr("Interface"), tr("Shortcuts"), parent)
    , _shortcutsModel(new ShortcutsModel(actionCollections, this))
    , _shortcutsFilter(new ShortcutsFilter(this))
{
    ui.setupUi(this);

    _shortcutsFilter->setSourceModel(_shortcutsModel);
    ui.shortcutsView->setModel(_shortcutsFilter);
    ui.shortcutsView->expandAll();
    ui.shortcutsView->resizeColumnToContents(0);
    ui.shortcutsView->sortByColumn(0, Qt::AscendingOrder);

    ui.keySequenceWidget->setModel(_shortcutsModel);
    connect(ui.keySequenceWidget, &KeySequenceWidget::keySequenceChanged, this, &ShortcutsSettingsPage::keySequenceChanged);

    connect(ui.shortcutsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &ShortcutsSettingsPage::setWidgetStates);

    setWidgetStates();

    connect(ui.useDefault, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault);
    connect(ui.useCustom, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault);

    connect(_shortcutsModel, &ShortcutsModel::changed, this, &ShortcutsSettingsPage::setChangedState);

    // fugly, but directly setting it from the ctor doesn't seem to work
    QTimer::singleShot(0, ui.searchEdit, [widget = ui.searchEdit]() { widget->setFocus(); });
}
ShortcutsSettingsPage::ShortcutsSettingsPage(const QHash<QString, ActionCollection *> &actionCollections, QWidget *parent)
    : SettingsPage(tr("Interface"), tr("Shortcuts"), parent),
    _shortcutsModel(new ShortcutsModel(actionCollections, this)),
    _shortcutsFilter(new ShortcutsFilter(this))
{
    ui.setupUi(this);

    _shortcutsFilter->setSourceModel(_shortcutsModel);
    ui.shortcutsView->setModel(_shortcutsFilter);
    ui.shortcutsView->expandAll();
    ui.shortcutsView->resizeColumnToContents(0);
    ui.shortcutsView->sortByColumn(0, Qt::AscendingOrder);

    ui.keySequenceWidget->setModel(_shortcutsModel);
    connect(ui.keySequenceWidget, SIGNAL(keySequenceChanged(QKeySequence, QModelIndex)), SLOT(keySequenceChanged(QKeySequence, QModelIndex)));

    connect(ui.shortcutsView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SLOT(setWidgetStates()));

    setWidgetStates();

    connect(ui.useDefault, SIGNAL(clicked(bool)), SLOT(toggledCustomOrDefault()));
    connect(ui.useCustom, SIGNAL(clicked(bool)), SLOT(toggledCustomOrDefault()));

    connect(_shortcutsModel, SIGNAL(hasChanged(bool)), SLOT(setChangedState(bool)));

    // fugly, but directly setting it from the ctor doesn't seem to work
    QTimer::singleShot(0, ui.searchEdit, SLOT(setFocus()));
}
Ejemplo n.º 5
0
void CoreAccountSettingsPage::load()
{
    model()->update(Client::coreAccountModel());
    SettingsPage::load();

    CoreAccountSettings s;

    if (Quassel::runMode() != Quassel::Monolithic) {
        // make sure we don't have selected the internal account as autoconnect account

        if (s.autoConnectOnStartup() && s.autoConnectToFixedAccount()) {
            CoreAccount acc = model()->account(s.autoConnectAccount());
            if (acc.isInternal())
                ui.autoConnectOnStartup->setChecked(false);
        }
    }
    ui.accountView->setCurrentIndex(filteredModel()->index(0, 0));
    ui.accountView->selectionModel()->select(filteredModel()->index(0, 0), QItemSelectionModel::Select);

    QModelIndex idx = filteredModel()->mapFromSource(model()->accountIndex(s.autoConnectAccount()));
    ui.autoConnectAccount->setCurrentIndex(idx.isValid() ? idx.row() : 0);
    ui.autoConnectAccount->setProperty("storedValue", ui.autoConnectAccount->currentIndex());
    setWidgetStates();
    // Mark as no changes made, we just loaded settings
    setChangedState(false);
}
Ejemplo n.º 6
0
void ShortcutsSettingsPage::keySequenceChanged(const QKeySequence& seq, const QModelIndex& conflicting)
{
    if (conflicting.isValid())
        _shortcutsModel->setData(conflicting, QKeySequence(), ShortcutsModel::ActiveShortcutRole);

    QModelIndex rowIdx = _shortcutsFilter->mapToSource(ui.shortcutsView->currentIndex());
    Q_ASSERT(rowIdx.isValid());
    _shortcutsModel->setData(rowIdx, seq, ShortcutsModel::ActiveShortcutRole);
    setWidgetStates();
}
void IdentityEditWidget::on_deleteNick_clicked()
{
    // no confirmation, since a nickname is really nothing hard to recreate
    if (ui.nicknameList->selectedItems().count()) {
        delete ui.nicknameList->takeItem(ui.nicknameList->row(ui.nicknameList->selectedItems()[0]));
        ui.nicknameList->setCurrentRow(qMin(ui.nicknameList->currentRow()+1, ui.nicknameList->count()-1));
        setWidgetStates();
        emit widgetHasChanged();
    }
}
void IdentityEditWidget::on_nickDown_clicked()
{
    if (!ui.nicknameList->selectedItems().count()) return;
    int row = ui.nicknameList->row(ui.nicknameList->selectedItems()[0]);
    if (row < ui.nicknameList->count()-1) {
        ui.nicknameList->insertItem(row+1, ui.nicknameList->takeItem(row));
        ui.nicknameList->setCurrentRow(row+1);
        setWidgetStates();
        emit widgetHasChanged();
    }
}
Ejemplo n.º 9
0
CSVSettings::UserSettingsDialog::UserSettingsDialog(QMainWindow *parent) :
    QMainWindow (parent), mStackedWidget (0)
{
    setWindowTitle(QString::fromUtf8 ("User Settings"));
    buildPages();
    setWidgetStates ();

    connect (mListWidget,
             SIGNAL (currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
             this,
             SLOT (slotChangePage (QListWidgetItem*, QListWidgetItem*)));
}
void IdentityEditWidget::on_addNick_clicked()
{
    QStringList existing;
    for (int i = 0; i < ui.nicknameList->count(); i++) existing << ui.nicknameList->item(i)->text();
    NickEditDlg dlg(QString(), existing, this);
    if (dlg.exec() == QDialog::Accepted) {
        ui.nicknameList->addItem(dlg.nick());
        ui.nicknameList->setCurrentRow(ui.nicknameList->count()-1);
        setWidgetStates();
        emit widgetHasChanged();
    }
}
Ejemplo n.º 11
0
void ShortcutsSettingsPage::toggledCustomOrDefault()
{
    if (!ui.shortcutsView->currentIndex().isValid())
        return;

    QModelIndex index = _shortcutsFilter->mapToSource(ui.shortcutsView->currentIndex());
    Q_ASSERT(index.isValid());

    if (ui.useDefault->isChecked()) {
        _shortcutsModel->setData(index, index.data(ShortcutsModel::DefaultShortcutRole));
    }
    else {
        _shortcutsModel->setData(index, QKeySequence());
    }
    setWidgetStates();
}
void CoreAccountEditDlg::on_user_textChanged(const QString &text)
{
    Q_UNUSED(text)
    setWidgetStates();
}
void CoreAccountEditDlg::on_hostName_textChanged(const QString &text)
{
    Q_UNUSED(text);
    setWidgetStates();
}
void CoreAccountSettingsPage::widgetHasChanged()
{
    setChangedState(testHasChanged());
    setWidgetStates();
}