Exemplo n.º 1
0
BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent)
    : SettingsPage(tr("Interface"), tr("Custom Chat Lists"), parent),
    _ignoreWidgetChanges(false),
    _useBufferViewHint(false),
    _bufferViewHint(0)
{
    ui.setupUi(this);
    ui.renameBufferView->setIcon(SmallIcon("edit-rename"));
    ui.addBufferView->setIcon(SmallIcon("list-add"));
    ui.deleteBufferView->setIcon(SmallIcon("edit-delete"));

    reset();

    ui.bufferViewList->setSortingEnabled(true);
    ui.settingsGroupBox->setEnabled(false);
    ui.bufferViewPreview->setEnabled(false);

    coreConnectionStateChanged(Client::isConnected()); // need a core connection!
    connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool)));
    connect(ui.bufferViewList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
        this, SLOT(bufferViewSelectionChanged(const QItemSelection &, const QItemSelection &)));

    connect(ui.onlyStatusBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.onlyChannelBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.onlyQueryBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.addNewBuffersAutomatically, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.sortAlphabetically, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.hideInactiveBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
    connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
    connect(ui.minimumActivitySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));

    connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(enableStatusBuffers(int)));
}
Exemplo n.º 2
0
CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent)
    : SettingsPage(tr("Interface"),
                   // In Monolithic mode, local highlights are replaced by remote highlights
                   Quassel::runMode() == Quassel::Monolithic ?
                       tr("Highlights") : tr("Remote Highlights"),
                   parent)
{
    ui.setupUi(this);

    setupRuleTable(ui.highlightTable);
    setupRuleTable(ui.ignoredTable);

    ui.highlightNicksComboBox->addItem(tr("All Nicks from Identity"), QVariant(HighlightRuleManager::AllNicks));
    ui.highlightNicksComboBox->addItem(tr("Current Nick"), QVariant(HighlightRuleManager::CurrentNick));
    ui.highlightNicksComboBox->addItem(tr("None"), QVariant(HighlightRuleManager::NoNick));

    coreConnectionStateChanged(Client::isConnected()); // need a core connection!
    connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool)));

    connect(ui.highlightAdd, SIGNAL(clicked(bool)), this, SLOT(addNewHighlightRow()));
    connect(ui.highlightRemove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedHighlightRows()));
    connect(ui.highlightImport, SIGNAL(clicked(bool)), this, SLOT(importRules()));

    connect(ui.ignoredAdd, SIGNAL(clicked(bool)), this, SLOT(addNewIgnoredRow()));
    connect(ui.ignoredRemove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedIgnoredRows()));

    // TODO: search for a better signal (one that emits everytime a selection has been changed for one item)
    connect(ui.highlightTable,
            SIGNAL(itemClicked(QTableWidgetItem * )),
            this,
            SLOT(selectHighlightRow(QTableWidgetItem * )));
    connect(ui.ignoredTable,
            SIGNAL(itemClicked(QTableWidgetItem * )),
            this,
            SLOT(selectIgnoredRow(QTableWidgetItem * )));

    // Update the "Case sensitive" checkbox
    connect(ui.highlightNicksComboBox,
            SIGNAL(currentIndexChanged(int)),
            this,
            SLOT(highlightNicksChanged(int)));

    connect(ui.highlightNicksComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
    connect(ui.nicksCaseSensitive, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));

    connect(ui.highlightAdd, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
    connect(ui.highlightRemove, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));

    connect(ui.ignoredAdd, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
    connect(ui.ignoredRemove, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));

    connect(ui.highlightTable,
            SIGNAL(itemChanged(QTableWidgetItem * )),
            this,
            SLOT(highlightTableChanged(QTableWidgetItem * )));

    connect(ui.ignoredTable,
            SIGNAL(itemChanged(QTableWidgetItem * )),
            this,
            SLOT(ignoredTableChanged(QTableWidgetItem * )));

    connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected()));

    // Warning icon
    ui.coreUnsupportedIcon->setPixmap(icon::get("dialog-warning").pixmap(16));

    // Set up client/monolithic remote highlights information
    if (Quassel::runMode() == Quassel::Monolithic) {
        // We're running in Monolithic mode, local highlights are considered legacy
        ui.highlightImport->setText(tr("Import Legacy"));
        ui.highlightImport->setToolTip(tr("Import highlight rules configured in <i>%1</i>.")
                                       .arg(tr("Legacy Highlights").replace(" ", "&nbsp;")));
        // Re-use translations of "Legacy Highlights" as this is a word-for-word reference, forcing
        // all spaces to be non-breaking
    } else {
        // We're running in client/split mode, local highlights are distinguished from remote
        ui.highlightImport->setText(tr("Import Local"));
        ui.highlightImport->setToolTip(tr("Import highlight rules configured in <i>%1</i>.")
                                       .arg(tr("Local Highlights").replace(" ", "&nbsp;")));
        // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing
        // all spaces to be non-breaking
    }
}