Пример #1
0
void SettingsPageDlg::setButtonStates()
{
    SettingsPage *sp = currentPage();
    ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged());
    ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged());
    ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults());
}
Пример #2
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    SettingsPage settingsPage;

    settingsPage.show();
    app.exec();
}
Пример #3
0
void SettingsTab::retranslateUi()
{
  for (int i = 0; i < m_ids.size(); ++i) {
    SettingsPage *page = static_cast<SettingsPage *>(static_cast<QScrollArea *>(m_pages->widget(i))->widget());
    page->retranslateUi();
    m_contents->item(i)->setText(page->name());
  }

  setText(tr("Preferences"));
}
Пример #4
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Log log(LOG_FILENAME, APP_NAME, APP_VERSION);
    log.printHeader();

    Vna vna(CONNECTION_TYPE, INSTRUMENT_ADDRESS);
    vna.useLog(&log);
    vna.printInfo();

    Keys keys(KEY_PATH);

    if (isNoConnection(vna) || isUnknownModel(vna))
            return(0);

    SettingsPage page;
    page.setVna(&vna);
    page.setKeys(&keys);
    page.loadKeys();
    page.show();
    int result = app.exec();

    MeasurementSettings settings = page.settings();
    qDebug() << "acceptable?  " << page.hasAcceptableInput();
    qDebug() << "Output Port: " << settings.outputPort();
    qDebug() << "Input Port:  " << settings.inputPort();
    if (page.hasAcceptableInput())
        page.saveKeys();

    return result;
}
NotificationsSettingsPage::NotificationsSettingsPage(QWidget *parent)
    : SettingsPage(tr("Interface"), tr("Notifications"), parent),
    _hasDefaults(false)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    foreach(AbstractNotificationBackend *backend, QtUi::notificationBackends()) {
        SettingsPage *cw = backend->createConfigWidget();
        if (cw) {
            cw->setParent(this);
            _configWidgets.append(cw);
            layout->addWidget(cw);
            connect(cw, SIGNAL(changed(bool)), SLOT(widgetHasChanged()));
            _hasDefaults |= cw->hasDefaults();
        }
    }
Пример #6
0
bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_message)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error_message)

    // Create the globalcontext list to register actions accordingly
    Core::Context globalcontext(Core::Constants::C_GLOBAL);

    // Create the settings Page
    m_settings->fromSettings(Core::ICore::instance()->settings());
    SettingsPage *settingsPage = new SettingsPage(m_settings);
    addAutoReleasedObject(settingsPage);

    // Create the protocols and append them to the Settings
    const QSharedPointer<NetworkAccessManagerProxy> networkAccessMgrProxy(new NetworkAccessManagerProxy);
    Protocol *protos[] =  { new PasteBinDotComProtocol(networkAccessMgrProxy),
                            new PasteBinDotCaProtocol(networkAccessMgrProxy),
                            new CodePasterProtocol(networkAccessMgrProxy),
                            new FileShareProtocol
                           };
    const int count = sizeof(protos) / sizeof(Protocol *);
    for(int i = 0; i < count; ++i) {
        connect(protos[i], SIGNAL(pasteDone(QString)), this, SLOT(finishPost(QString)));
        connect(protos[i], SIGNAL(fetchDone(QString,QString,bool)),
                this, SLOT(finishFetch(QString,QString,bool)));
        settingsPage->addProtocol(protos[i]->name());
        if (protos[i]->hasSettings())
            addAutoReleasedObject(protos[i]->settingsPage());
        m_protocols.append(protos[i]);
    }

    //register actions
    Core::ActionManager *actionManager = ICore::instance()->actionManager();

    Core::ActionContainer *toolsContainer =
        actionManager->actionContainer(Core::Constants::M_TOOLS);

    Core::ActionContainer *cpContainer =
        actionManager->createMenu(Core::Id("CodePaster"));
    cpContainer->menu()->setTitle(tr("&Code Pasting"));
    toolsContainer->addMenu(cpContainer);

    Core::Command *command;

    m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
    command = actionManager->registerAction(m_postEditorAction, "CodePaster.Post", globalcontext);
    command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+P")));
    connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor()));
    cpContainer->addAction(command);

    m_postClipboardAction = new QAction(tr("Paste Clipboard..."), this);
    command = actionManager->registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext);
    connect(m_postClipboardAction, SIGNAL(triggered()), this, SLOT(postClipboard()));
    cpContainer->addAction(command);

    m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
    command = actionManager->registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext);
    command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+F")));
    connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch()));
    cpContainer->addAction(command);

    connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
            this, SLOT(updateActions()));
    updateActions();
    return true;
}
Пример #7
0
void SettingsDlg::setItemState(QTreeWidgetItem *item)
{
    SettingsPage *sp = qobject_cast<SettingsPage *>(item->data(0, SettingsPageRole).value<QObject *>());
    Q_ASSERT(sp);
    item->setDisabled(!Client::isConnected() && sp->needsCoreConnection());
}
Пример #8
0
void PanelPage::openSettings()
{
    SettingsPage *settings = new SettingsPage(m_panelmgr);
    settings->appear(DestroyWhenDone);
}