コード例 #1
0
void MainWindow::on_btnLinkKey_clicked()
{
    WRITE2LOG("Linking...");
    if(certList.isEmpty() == true)
    {
        WRITE2LOG("Certificate list is empty");
        return;
    }

    if(ui->listCerts->currentIndex().row() == -1)
    {
        QMessageBox::warning(this, "Warning", "Select certificate!");
        return;
    }

    DWORD pcbData = 0;
    if(CertGetCertificateContextProperty(certList[ui->listCerts->currentIndex().row()], CERT_KEY_PROV_INFO_PROP_ID, NULL, &pcbData) != 0)
    {
        int result = QMessageBox::warning(this, "Warning", "This certificate already have private key.\nAre you sure you want to add new key?", QMessageBox::Ok, QMessageBox::Cancel);
        if (result == QMessageBox::Cancel)
        {
            WRITE2LOG("Canceled by user");
            return;
        }
    }

    QDialog* keyInfoDlg = new QDialog(this);
    QLineEdit* lnProvider = new QLineEdit;
    QLineEdit* lnLabel = new QLineEdit;


    QFormLayout* layout = new QFormLayout(keyInfoDlg);
    layout->addRow("CNG Cryptoprovider:", lnProvider);
    layout->addRow("Key name:", lnLabel);


    QDialogButtonBox *btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(btnBox, SIGNAL(accepted()), keyInfoDlg, SLOT(accept()));
    connect(btnBox, SIGNAL(rejected()), keyInfoDlg, SLOT(reject()));
    layout->addRow(btnBox);
    keyInfoDlg->exec();

    if(keyInfoDlg->result() == QDialog::Rejected)
    {
//        delete keyInfoDlg;
//        delete lnProvider;
//        delete lnLabel;
//        delete layout;
//        delete btnBox;
        WRITE2LOG("Canceled by user");
        return;
    }

    if(lnProvider->text().size() == 0 || lnLabel->text().size() == 0 )
    {
        QMessageBox::warning(this, "Warning", "All fields must be filled!", QMessageBox::Ok);
//        delete keyInfoDlg;
//        delete lnProvider;
//        delete lnLabel;
//        delete layout;
//        delete btnBox;
        return;
    }


    QString containerName = lnLabel->text();
    wchar_t* pwszContainerName = new wchar_t[containerName.size()];
    int size = containerName.toWCharArray(pwszContainerName);
    pwszContainerName[size] = 0;

    wchar_t* pwszProvider = new wchar_t[lnProvider->text().size()];
    size = lnProvider->text().toWCharArray(pwszProvider);
    pwszProvider[size] = 0;

    CRYPT_KEY_PROV_INFO kpi;
    ZeroMemory(&kpi, sizeof(kpi));

    kpi.pwszContainerName = pwszContainerName;
    kpi.dwProvType = NULL;
    kpi.pwszProvName = pwszProvider;

    LPCWSTR storage = L"";
    if(ui->rbMYStorage->isChecked() == true)
        storage = L"MY";
    else
        storage = L"ROOT";


    HCERTSTORE hCertStore = CertOpenStore(
           CERT_STORE_PROV_SYSTEM,
           0,
           NULL,
           CERT_SYSTEM_STORE_CURRENT_USER,
           storage);

    int res = CertSetCertificateContextProperty(certList[ui->listCerts->currentIndex().row()], CERT_KEY_PROV_INFO_PROP_ID, 0, &kpi);
    int ret = CertAddCertificateContextToStore(hCertStore, certList[ui->listCerts->currentIndex().row()], CERT_STORE_ADD_ALWAYS, NULL);
    if(res == 1 && ret == 1)
        QMessageBox::information(this, "Information", "Key was associated with certificate successfully. \nCertificate has been added to storage.", QMessageBox::Ok);
    else if (res == 0)
        QMessageBox::warning(this, "Warning", "Failed to associate key with certificate.", QMessageBox::Ok);
    else if (ret == 0)
        QMessageBox::warning(this, "Warning", "Failed to add certificate to store.", QMessageBox::Ok);

    delete keyInfoDlg;
    delete lnProvider;
    delete lnLabel;
    delete layout;
    delete btnBox;
    delete pwszContainerName;
    delete pwszProvider;
}
コード例 #2
0
void JabberAddAccountWidget::createGui(bool showButtons)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QWidget *formWidget = new QWidget(this);
    mainLayout->addWidget(formWidget);

    QFormLayout *layout = new QFormLayout(formWidget);

    QWidget *jidWidget = new QWidget(this);
    QGridLayout *jidLayout = new QGridLayout(jidWidget);
    jidLayout->setSpacing(0);
    jidLayout->setMargin(0);
    jidLayout->setColumnStretch(0, 2);
    jidLayout->setColumnStretch(2, 2);

    Username = new QLineEdit(this);
    connect(Username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    jidLayout->addWidget(Username);

    AtLabel = new QLabel("@", this);
    jidLayout->addWidget(AtLabel, 0, 1);

    Domain = new QComboBox();
    Domain->setEditable(true);
    connect(Domain, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataChanged()));
    connect(Domain, SIGNAL(editTextChanged(QString)), this, SLOT(dataChanged()));
    jidLayout->addWidget(Domain, 0, 2);

    layout->addRow(tr("Username") + ':', jidWidget);

    AccountPassword = new QLineEdit(this);
    connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    AccountPassword->setEchoMode(QLineEdit::Password);
    layout->addRow(tr("Password") + ':', AccountPassword);

    RememberPassword = new QCheckBox(tr("Remember Password"), this);
    layout->addRow(0, RememberPassword);

    Identity = m_pluginInjectedFactory->makeInjected<IdentitiesComboBox>(this);
    connect(Identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
    layout->addRow(tr("Account Identity") + ':', Identity);

    QLabel *infoLabel = new QLabel(
        tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"),
        this);
    infoLabel->setWordWrap(true);
    infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    layout->addRow(0, infoLabel);

    mainLayout->addStretch(100);

    QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);
    mainLayout->addWidget(buttons);

    AddAccountButton =
        new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
    QPushButton *cancelButton =
        new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);

    buttons->addButton(AddAccountButton, QDialogButtonBox::AcceptRole);
    buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);

    connect(AddAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
    connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));

    if (!showButtons)
        buttons->hide();
}
コード例 #3
0
ファイル: preopenapk.cpp プロジェクト: chuanyo/apkstudio
APP_NAMESPACE_START

PreOpenApk::PreOpenApk(const QString &a, QWidget *p)
    : Dialog(QString(), p)
{
    QFileInfo fi(a);
    QString project = PathUtils::combine(fi.absolutePath(), fi.completeBaseName());
    setAttribute(Qt::WA_DeleteOnClose, false);
    setFixedSize(360, 180);
    setWindowIcon(Qrc::icon("toolbar_apk"));
    setWindowTitle(__("decode_apk", "titles", fi.fileName()));
    // Form : Start
    QFormLayout *form = new QFormLayout;
    form->addRow(__("apk_path", "forms"), _apk = new QLineEdit(a, this));
    QPushButton *browse = new QPushButton(__("browse", "buttons"), this);
    QLayout *row = new QHBoxLayout;
    row->addWidget(_project = new QLineEdit(project, this));
    row->addWidget(browse);
    form->addRow(__("project_path", "forms"), row);
    form->addRow(__("framework_tag", "forms"), _framework = new QComboBox(this));
    form->addRow(__("decompile_sources", "forms"), _sources = new QCheckBox(this));
    // Form : End
    QVBoxLayout *layout = new QVBoxLayout(this);
    QDialogButtonBox *buttons = new QDialogButtonBox(this);
    buttons->addButton(new QPushButton(__("cancel", "buttons"), buttons), QDialogButtonBox::RejectRole);
    buttons->addButton(new QPushButton(__("decode", "buttons"), buttons), QDialogButtonBox::AcceptRole);
    layout->addLayout(form);
    layout->addWidget(buttons);
    setLayout(layout);
    _apk->setReadOnly(true);
    _connections << connect(browse, &QPushButton::clicked, [=]
    {
        QString dir;
        QFileInfo fi(project);
        if (fi.exists() && fi.isFile())
        {
            dir = fi.absolutePath();
        }
        QFileDialog d(this, __("choose_project_directory", "titles"), dir);
        d.setFileMode(QFileDialog::Directory);
        d.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
#ifdef NO_NATIVE_DIALOG
        d.setOption(QFileDialog::DontUseNativeDialog);
#endif
        if (d.exec() == QFileDialog::Accepted)
        {
            QStringList files;
            if ((files = d.selectedFiles()).isEmpty() == false)
            {
                _project->setText(files.first());
            }
        }
    });
    _connections << connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
    _connections << connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::close);
    // List Frameworks
    _framework->addItem("Default");
    QDirIterator iterator(PathUtils::combine(QDir::homePath(), "apktool/framework"), QDirIterator::Subdirectories);
    while (iterator.hasNext())
    {
        QFileInfo file(iterator.next());
        if (file.exists() && file.isFile())
        {
            QString name = file.baseName();
            QStringList parts = name.split(QChar('-')).mid(0, 2);
            if (parts.count() == 2)
            {
                QString tag = name.section('-', 1);
                _framework->addItem(QString("%1 [%2]").arg(parts.at(0)).arg(tag), tag);
            }
        }
    }
}
コード例 #4
0
ファイル: ProcessingManager.cpp プロジェクト: C-CINA/2dx
QWidget* ProcessingManager::setupQueueContainer() {
    queueModel_ = new ProcessingModel(this);
    connect(&projectData, &ProjectData::toBeAddedToProcessingQueue, queueModel_, &ProcessingModel::addProcesses);
    
    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(2);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

    int numberOfThreads = QThread::idealThreadCount();
    if(numberOfThreads < 1) numberOfThreads = 1;
    
    processesBox_ = new QSpinBox;
    processesBox_->setFrame(false);
    processesBox_->setMinimum(1);
    processesBox_->setMaximum(numberOfThreads);
    processesBox_->setValue(ProjectPreferences().processJobs());
    connect(processesBox_, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){
        ProjectPreferences().setProcessJobs(value);
    });
    layout->addRow("Number of jobs to run in parallel", processesBox_);
    
    QLabel* introLabel = new QLabel("The maximum number of threads on your system is: " + QString::number(numberOfThreads));
    introLabel->setWordWrap(true);
    QPalette pal = introLabel->palette();
    pal.setColor(QPalette::WindowText, Qt::darkGray);
    introLabel->setPalette(pal);
    layout->addRow(introLabel);
    
    GroupContainer* jobcontainer = new GroupContainer;
    jobcontainer->setTitle("Concurrency Selection");
    jobcontainer->setContainerLayout(layout);
    
    QToolButton* addSelectedButton = getButton("add_queue", "Add Images", "Add selected images from the project library to the processing queue");
    connect(addSelectedButton, &GraphicalButton::clicked, [=]() {
        projectData.addSelectedToQueue();
    });
    
    QToolButton* clearSelectedButton = getButton("remove_highlighted", "Clear Selected", "Remove highlighted images from the processing queue");
    connect(clearSelectedButton, &GraphicalButton::clicked, [=]() {
        while(!queueView_->selectionModel()->selectedIndexes().isEmpty()) {
            QModelIndex i = queueView_->selectionModel()->selectedIndexes().first();
            if(!i.parent().isValid()) {
                queueModel_->removeRow(i.row());
            }
        }
        
        setQueueCount(queueModel_->rowCount());
    });
    
    QToolButton* clearAllButton = getButton("remove_all", "Clear All", "Remove all images from queue");
    connect(clearAllButton, &GraphicalButton::clicked, queueModel_, &ProcessingModel::clearAll);
    
    QToolButton* prioritizeButton = getButton("prioritize_highlighted", "Prioritize", "Prioritize the processing of highlighted images");
    connect(prioritizeButton, &GraphicalButton::clicked, [=]() {
        for(QModelIndex i : queueView_->selectionModel()->selectedRows(0)) {
            if(!i.parent().isValid()) {
                queueModel_->insertRow(0, queueModel_->takeRow(i.row()));
            }
        }
    });
    
    QHBoxLayout* buttonLayout = new QHBoxLayout();
    buttonLayout->addStretch(0);
    buttonLayout->addWidget(addSelectedButton, 0);
    buttonLayout->addStretch(1);
    buttonLayout->addWidget(prioritizeButton, 0);
    buttonLayout->addWidget(clearAllButton, 0);
    buttonLayout->addWidget(clearSelectedButton, 0);
    
    
    queueView_ = new QTreeView(this);
    queueView_->setAttribute(Qt::WA_MacShowFocusRect, 0);
    queueView_->setModel(queueModel_);
    queueView_->setSelectionMode(QAbstractItemView::ExtendedSelection);
    queueView_->setSortingEnabled(true);
    queueView_->setAllColumnsShowFocus(true);
    queueView_->setAlternatingRowColors(true);
    queueView_->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    queueView_->setHeaderHidden(true);
    
    BlockContainer* queueContainer = new BlockContainer("Images in queue", queueView_);
    
    QVBoxLayout *queueLayout = new QVBoxLayout;
    queueLayout->setMargin(10);
    queueLayout->setSpacing(10);
    queueLayout->addLayout(buttonLayout, 0);
    queueLayout->addWidget(queueContainer, 1);

    GroupContainer* container = new GroupContainer;
    container->setTitle("Processing Queue");
    container->setContainerLayout(queueLayout);
    
    
    QVBoxLayout* mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(10);
    mainLayout->addStretch(0);
    mainLayout->addWidget(jobcontainer, 0);
    mainLayout->addWidget(container, 1);
    
    QWidget* mainContainer = new QWidget;
    mainContainer->setLayout(mainLayout);
    mainContainer->setMaximumWidth(500);
    
    return mainContainer;
}
コード例 #5
0
GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
    : QWidget(parent)
{
    groupBoxGeneral = new QGroupBox(this);
    groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));

    labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
    labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:"));
    labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr(
        "The number of seconds Qt Creator will wait before it terminates\n"
        "a non-responsive GDB process. The default value of 20 seconds should\n"
        "be sufficient for most applications, but there are situations when\n"
        "loading big libraries or listing source files takes much longer than\n"
        "that on slow machines. In this case, the value should be increased."));

    spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral);
    spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip());
    spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec"));
    spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight);
    spinBoxGdbWatchdogTimeout->setMinimum(20);
    spinBoxGdbWatchdogTimeout->setMaximum(1000000);
    spinBoxGdbWatchdogTimeout->setSingleStep(20);
    spinBoxGdbWatchdogTimeout->setValue(20);

    checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
    checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
    checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>"
        "Allows <i>Step Into</i> to compress several steps into one step\n"
        "for less noisy debugging. For example, the atomic reference\n"
        "counting code is skipped, and a single <i>Step Into</i> for a signal\n"
        "emission ends up directly in the slot connected to it."));

    checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
    checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
        "Show a message box when receiving a signal"));
    checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
        "Displays a message box as soon as your application\n"
        "receives a signal like SIGSEGV during debugging."));

    checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
    checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
        "Adjust breakpoint locations"));
    checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
        "GDB allows setting breakpoints on source lines for which no code \n"
        "was generated. In such situations the breakpoint is shifted to the\n"
        "next source code line for which code was actually generated.\n"
        "This option reflects such temporary change by moving the breakpoint\n"
        "markers in the source code editor."));

    checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
    checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
        "Use dynamic object type for display"));
    checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
        "Specifies whether the dynamic or the static type of objects will be "
        "displayed. Choosing the dynamic type might be slower."));

    checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral);
    checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup"));
    checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr(
        "Allows or inhibits reading the user's default\n"
        ".gdbinit file on debugger startup."));

    checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
    checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers"));
    checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr(
        "Uses the default GDB pretty printers installed in your "
        "system or linked to the libraries your application uses.\n"));

    checkBoxIntelFlavor = new QCheckBox(groupBoxGeneral);
    checkBoxIntelFlavor->setText(GdbOptionsPage::tr("Use Intel style disassembly"));
    checkBoxIntelFlavor->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>GDB shows by default AT&&T style disassembly."
        "</body></html>"));

    checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
    checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages"));
    checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>Attempts to identify missing debug info packages "
        "and lists them in the Issues output pane.</p><p>"
        "<b>Note:</b> This feature needs special support from the Linux "
        "distribution and GDB build and is not available everywhere.</p></body></html>"));

    QString howToUsePython = GdbOptionsPage::tr(
        "<p>To execute simple Python commands, prefix them with \"python\".</p>"
        "<p>To execute sequences of Python commands spanning multiple lines "
        "prepend the block with \"python\" on a separate line, and append "
        "\"end\" on a separate line.</p>"
        "<p>To execute arbitrary Python scripts, "
        "use <i>python execfile('/path/to/script.py')</i>.</p>");

    groupBoxStartupCommands = new QGroupBox(this);
    groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
    groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "GDB has been started, but before the debugged program is started or "
        "attached, and before the debugging helpers are initialized.</p>%1"
        "</body></html>").arg(howToUsePython));

    textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
    textEditStartupCommands->setAcceptRichText(false);
    textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());

    groupBoxPostAttachCommands = new QGroupBox(this);
    groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands"));
    groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "GDB has successfully attached to remote targets.</p>"
        "<p>You can add commands to further set up the target here, "
        "such as \"monitor reset\" or \"load\"."
        "</body></html>"));

    textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
    textEditPostAttachCommands->setAcceptRichText(false);
    textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());

    groupBoxCustomDumperCommands = new QGroupBox(this);
    groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization"));
    groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>GDB commands entered here will be executed after "
        "Qt Creator's debugging helpers have been loaded and fully initialized. "
        "You can load additional debugging helpers or modify existing ones here.</p>"
        "%1</body></html>").arg(howToUsePython));

    textEditCustomDumperCommands = new QTextEdit(groupBoxStartupCommands);
    textEditCustomDumperCommands->setAcceptRichText(false);
    textEditCustomDumperCommands->setToolTip(groupBoxStartupCommands->toolTip());

    /*
    groupBoxPluginDebugging = new QGroupBox(q);
    groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
        "Behavior of Breakpoint Setting in Plugins"));

    radioButtonAllPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonAllPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Always try to set breakpoints in plugins automatically"));
    radioButtonAllPluginBreakpoints->setToolTip(GdbOptionsPage::tr(
        "This is the slowest but safest option."));

    radioButtonSelectedPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Try to set breakpoints in selected plugins"));

    radioButtonNoPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
    radioButtonNoPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Never set breakpoints in plugins automatically"));

    lineEditSelectedPluginBreakpointsPattern = new QLineEdit(groupBoxPluginDebugging);

    labelSelectedPluginBreakpoints = new QLabel(groupBoxPluginDebugging);
    labelSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
        "Matching regular expression: "));
    */

    QFormLayout *formLayout = new QFormLayout(groupBoxGeneral);
    formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
    formLayout->addRow(checkBoxSkipKnownFrames);
    formLayout->addRow(checkBoxUseMessageBoxForSignals);
    formLayout->addRow(checkBoxAdjustBreakpointLocations);
    formLayout->addRow(checkBoxUseDynamicType);
    formLayout->addRow(checkBoxLoadGdbInit);
    formLayout->addRow(checkBoxLoadGdbDumpers);
    formLayout->addRow(checkBoxIntelFlavor);
    formLayout->addRow(checkBoxIdentifyDebugInfoPackages);

    QGridLayout *startLayout = new QGridLayout(groupBoxStartupCommands);
    startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);

    QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
    postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);

    QGridLayout *customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
    customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);

    //QHBoxLayout *horizontalLayout = new QHBoxLayout();
    //horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
    //horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
    //horizontalLayout->addWidget(lineEditSelectedPluginBreakpointsPattern);

    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1);
    gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
    gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1);
    gridLayout->addWidget(groupBoxCustomDumperCommands, 2, 1, 1, 1);

    //gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
    //gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
    //gridLayout->addWidget(radioButtonSelectedPluginBreakpoints, 1, 0, 1, 1);

    //gridLayout->addLayout(horizontalLayout, 2, 0, 1, 1);
    //gridLayout->addWidget(radioButtonNoPluginBreakpoints, 3, 0, 1, 1);
    //gridLayout->addWidget(groupBoxPluginDebugging, 1, 0, 1, 2);

    DebuggerCore *dc = debuggerCore();
    group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
    group.insert(dc->action(GdbCustomDumperCommands), textEditCustomDumperCommands);
    group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
    group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
    group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
    group.insert(dc->action(UseDynamicType), checkBoxUseDynamicType);
    group.insert(dc->action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
    group.insert(dc->action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
    group.insert(dc->action(IntelFlavor), checkBoxIntelFlavor);
    group.insert(dc->action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages);
    group.insert(dc->action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
    group.insert(dc->action(SkipKnownFrames), checkBoxSkipKnownFrames);

    //lineEditSelectedPluginBreakpointsPattern->
    //    setEnabled(dc->action(SelectedPluginBreakpoints)->value().toBool());
    //connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
    //    lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));

    const QLatin1Char sep(' ');
    QTextStream(&searchKeywords)
            << sep << groupBoxGeneral->title()
            << sep << checkBoxLoadGdbInit->text()
            << sep << checkBoxLoadGdbDumpers->text()
            << sep << checkBoxUseDynamicType->text()
            << sep << labelGdbWatchdogTimeout->text()
            << sep << checkBoxSkipKnownFrames->text()
            << sep << checkBoxUseMessageBoxForSignals->text()
            << sep << checkBoxAdjustBreakpointLocations->text();
    ;
    searchKeywords.remove(QLatin1Char('&'));
}
コード例 #6
0
void DataViewer_GameObject::_CreatePiece_Transform()
{
	QFormLayout* form = new QFormLayout();
	form->setSpacing( 3 );
	form->setContentsMargins( 0, 0, 3, 0 );


	QLineEdit* xWidget;
	QLineEdit* yWidget;
	QLineEdit* zWidget;

	QWidget* posLocal = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( posLocal->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( posLocal->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( posLocal->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	form->addRow( "Position Local", posLocal );

	QWidget* posWorld = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( posWorld->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( posWorld->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( posWorld->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	form->addRow( "Position World", posWorld );

	QWidget* rotLocal = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( rotLocal->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( rotLocal->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( rotLocal->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	form->addRow( "Rotation Local", rotLocal );

	QWidget* rotWorld = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( rotWorld->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( rotWorld->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( rotWorld->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	form->addRow( "Rotation World", rotWorld );

	QWidget* scaleLocal = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( scaleLocal->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( scaleLocal->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( scaleLocal->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_Local );
	form->addRow( "Scale Local", scaleLocal );

	QWidget* scaleWorld = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( scaleWorld->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( scaleWorld->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( scaleWorld->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Transform_World );
	form->addRow( "Scale World", scaleWorld );


	QHBoxLayout* boxLayout = new QHBoxLayout();
	boxLayout->setAlignment( Qt::AlignLeft );

	QLabel* titleLabel = new QLabel( "Transform" );
	titleLabel->setObjectName( "Style_Title" );
	boxLayout->addWidget( titleLabel );


	QWidget* titleWidget = new QWidget( _qtTree );
	titleWidget->setLayout( boxLayout );

	QWidget* dataWidget = new QWidget( _qtTree );
	dataWidget->setLayout( form );

	_CreatePiece( titleWidget, dataWidget );


	_dataTransform.titleWidget = titleWidget;
	_dataTransform.dataWidget = dataWidget;
	_dataTransform.posLocal = posLocal;
	_dataTransform.posWorld = posWorld;
	_dataTransform.rotLocal = rotLocal;
	_dataTransform.rotWorld = rotWorld;
	_dataTransform.scaleLocal = scaleLocal;
	_dataTransform.scaleWorld = scaleWorld;
}
コード例 #7
0
void DataViewer_GameObject::_CreatePiece_Camera( Camera* camera )
{
	QFormLayout* form = new QFormLayout();
	form->setSpacing( 3 );
	form->setContentsMargins( 0, 0, 3, 0 );


	QLineEdit* xWidget;
	QLineEdit* yWidget;

	QStringList typeNames;
	for (auto& kv : EnumConvertor::s2e_CameraType)
	{
		typeNames << kv.first.ToChar();
	}
	QWidget* type = _CreateWidget_Choice( typeNames );
	QObject::connect( static_cast<QComboBox*>(type), &QComboBox::currentTextChanged, 
						this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "Type", type );

	QWidget* aspectRatio = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(aspectRatio), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "Aspect Ratio", aspectRatio );

	QWidget* fovYAngle = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(fovYAngle), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "FovY Angle", fovYAngle );

	QWidget* orthoSize = _CreateWidget_Vector2();
	xWidget = static_cast<QLineEdit*>( orthoSize->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( orthoSize->layout()->itemAt(3)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Camera_1 );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "Ortho Size", orthoSize );

	QWidget* nearClipping = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(nearClipping), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "Near Clipping", nearClipping );

	QWidget* farClipping = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(farClipping), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Camera_1 );
	form->addRow( "Far Clipping", farClipping );


	QCheckBox* titleCheck = new QCheckBox();
	QObject::connect( titleCheck, &QCheckBox::clicked, this, &DataViewer_GameObject::A_Camera_2 );

	QLabel* titleLabel = new QLabel( "Camera" );
	titleLabel->setObjectName( "Style_Title" );

	QWidget* emptySpace = new QWidget();
	emptySpace->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

	QtRemoveButton* removeButton = new QtRemoveButton();
	removeButton->setText( "x" );
	removeButton->setMinimumSize( 20, 18 );
	removeButton->setMaximumSize( 20, 18 );
	removeButton->component = camera;
	QObject::connect( removeButton, &QPushButton::clicked, removeButton, &QtRemoveButton::A_Onlick );

	QHBoxLayout* boxLayout = new QHBoxLayout();
	boxLayout->setAlignment( Qt::AlignLeft );
	boxLayout->addWidget( titleCheck );
	boxLayout->addWidget( titleLabel );
	boxLayout->addWidget( emptySpace );
	boxLayout->addWidget( removeButton );


	QWidget* titleWidget = new QWidget( _qtTree );
	titleWidget->setLayout( boxLayout );

	QWidget* dataWidget = new QWidget( _qtTree );
	dataWidget->setLayout( form );

	_CreatePiece( titleWidget, dataWidget );


	_dataCamera.titleWidget = titleWidget;
	_dataCamera.dataWidget = dataWidget;
	_dataCamera.enable = titleCheck;
	_dataCamera.type = type;
	_dataCamera.aspectRatio = aspectRatio;
	_dataCamera.fovYAngle = fovYAngle;
	_dataCamera.orthoSize = orthoSize;
	_dataCamera.nearClipping = nearClipping;
	_dataCamera.farClipping = farClipping;
}
コード例 #8
0
/**
 *
 * @param theme
 * @param parent
 */
SystemOptions::SystemOptions(const QString & theme,QWidget * parent) : OptionsWidget(theme,parent) {
  m_section = "System";
  m_allowNavMode = false;
  QVBoxLayout * vlayout = new QVBoxLayout;
  setObjectName("systemoptions");


  m_contentsLinked = new QCheckBox;
  m_lexicon = new QLineEdit;
  QPushButton * lexiconbutton = new QPushButton(tr("..."));
  QHBoxLayout * lexiconlayout = new QHBoxLayout;
  connect(lexiconbutton,SIGNAL(clicked()),this,SLOT(onSetDatabase()));
  lexiconlayout->addWidget(m_lexicon);
  lexiconlayout->addSpacing(10);
  lexiconlayout->addWidget(lexiconbutton);
  lexiconlayout->addStretch();
  //  this->setControlSize(m_lexicon,VLARGE_EDIT);
  m_interval = new QLineEdit;
  m_interval->setValidator(new QIntValidator);
  this->setControlSize(m_interval,SMALL_EDIT);
  m_docked = new QCheckBox;
  m_importCheck = new QCheckBox;
  m_importShow = new QCheckBox;


  //  this->setControlSize(m_focusTab,LARGE_EDIT);
  m_minimalInterface = new QCheckBox;
  m_restoreBookmarks = new QCheckBox;
  m_restoreTabs = new QCheckBox;
  //  m_saveSettings = new QCheckBox;
  m_saveTabs = new QCheckBox;
  m_rootNavigation = new QCheckBox;
  // Root mod
  //  m_runDate = new QDateTimeEdit;
  //  this->setControlSize(m_runDate,VLARGE_EDIT);

  // Save boo
  m_showInterfaceWarning = new QCheckBox;

  m_qtStyle = new QComboBox;
  m_qtStyle->addItems(QStyleFactory::keys());

  m_css = new QLineEdit;
  QHBoxLayout * csslayout = new QHBoxLayout;
  QPushButton * cssbutton = new QPushButton(tr("..."));
  csslayout->addWidget(m_css);
  csslayout->addSpacing(10);
  csslayout->addWidget(cssbutton);
  csslayout->addStretch();
  connect(cssbutton,SIGNAL(clicked()),this,SLOT(onSetCss()));


  m_theme = new QComboBox;

  m_title = new QLineEdit;

  m_toolbarText = new QCheckBox;
  m_useNotes = new QCheckBox;

  m_notesDb = new QLineEdit;
  m_optionsWarning  = new QCheckBox;
QHBoxLayout * noteslayout = new QHBoxLayout;
  QPushButton * notesbutton = new QPushButton(tr("..."));
  noteslayout->addWidget(m_notesDb);
  noteslayout->addSpacing(10);
  noteslayout->addWidget(notesbutton);
  noteslayout->addStretch();
  connect(notesbutton,SIGNAL(clicked()),this,SLOT(onSetNotesDatabase()));

  m_historyDb = new QLineEdit;
  QHBoxLayout * historylayout = new QHBoxLayout;
  QPushButton * historybutton = new QPushButton(tr("..."));
  historylayout->addWidget(m_historyDb);
  historylayout->addSpacing(10);
  historylayout->addWidget(historybutton);
  historylayout->addStretch();
  connect(historybutton,SIGNAL(clicked()),this,SLOT(onSetHistoryDatabase()));

  m_keyboard = new QComboBox;

  m_splashScreen = new QCheckBox;
  m_splashDuration = new QLineEdit;
  m_splashDuration->setValidator(new QIntValidator);
  this->setControlSize(m_splashDuration,SMALL_EDIT);

  m_allowDuplicates = new QCheckBox;
  /// there are no other radiobuttons, so just make this the parent
  QHBoxLayout * tablayout = new QHBoxLayout;
  m_insertNewTab = new QRadioButton(tr("Insert"),this);
  m_appendNewTab = new QRadioButton(tr("Append"),this);
  tablayout->addWidget(m_insertNewTab);
  tablayout->addSpacing(40);
  tablayout->addWidget(m_appendNewTab);
  tablayout->addStretch();

  QGroupBox * dbgroup = new QGroupBox(tr("Databases"));
  QFormLayout * dblayout = new QFormLayout;
  dblayout->addRow(tr("Lexicon"),lexiconlayout);
  dblayout->addRow(tr("Notes"),noteslayout);
  dblayout->addRow(tr("History"),historylayout);
  dblayout->setVerticalSpacing(VERTICAL_SPACING);
  dbgroup->setLayout(dblayout);


  QGroupBox * othergroup = new QGroupBox(tr("Options"));
  QFormLayout * optionlayout = new QFormLayout;



  optionlayout->addRow(tr("Title"),m_title);
  optionlayout->addRow(tr("Application stylesheet"),csslayout);
  optionlayout->addRow(tr("Theme"),m_theme);
  optionlayout->addRow(tr("Qt style"),m_qtStyle);
  optionlayout->addRow(tr("Docked"),m_docked);
  optionlayout->addRow(tr("New tab behaviour"),tablayout);
  optionlayout->addRow(tr("Contents linked"),m_contentsLinked);
  optionlayout->addRow(tr("Restore bookmarks"),m_restoreBookmarks);
  optionlayout->addRow(tr("Restore tabs"),m_restoreTabs);
  //  optionlayout->addRow(tr("Save settings"),m_saveSettings);
  //  optionlayout->addRow(tr("Run date"),m_runDate);
  optionlayout->addRow(tr("Minimal interface"),m_minimalInterface);
  optionlayout->addRow(tr("Show interface warning"),m_showInterfaceWarning);
  optionlayout->addRow(tr("Show preferences close warning"),m_optionsWarning);
  optionlayout->addRow(tr("Message duration (secs)"),m_interval);
  optionlayout->addRow(tr("Toolbar text"),m_toolbarText);
  if (m_allowNavMode) {
    optionlayout->addRow(tr("Nav by root"),m_rootNavigation);
  }
  else {
    m_rootNavigation->setVisible(false);
  }
  optionlayout->addRow(tr("Allow duplicates"),m_allowDuplicates);
  //  optionlayout->addRow(tr("Use notes"),m_useNotes);

  optionlayout->addRow(tr("Keyboard"),m_keyboard);

  QHBoxLayout * splashlayout = new QHBoxLayout;
  splashlayout->addWidget(m_splashScreen);
  splashlayout->addSpacing(10);
  splashlayout->addWidget(new QLabel(tr("Duration (secs)")));
  splashlayout->addWidget(m_splashDuration);
  splashlayout->addSpacing(10);
  QPushButton * splashbutton = new QPushButton(tr("Show location"));
  splashlayout->addWidget(splashbutton);
  connect(splashbutton,SIGNAL(clicked()),this,SLOT(onShowSplash()));
  splashlayout->addStretch();

  optionlayout->addRow(tr("Show splash screen"),splashlayout);
  optionlayout->addRow(tr("Import links ignore db mismatch"),m_importCheck);
  optionlayout->addRow(tr("Import links show warning"),m_importShow);
  optionlayout->setVerticalSpacing(VERTICAL_SPACING);
  othergroup->setLayout(optionlayout);


  m_onlineUrl = new QLineEdit;
  m_onlineCurrentPage = new QLineEdit;
  m_offlineLocation = new QLineEdit;
  QHBoxLayout * locationlayout = new QHBoxLayout;
  QPushButton * locationbutton = new QPushButton(tr("..."));
  locationlayout->addWidget(m_offlineLocation);
  locationlayout->addSpacing(10);
  locationlayout->addWidget(locationbutton);
  locationlayout->addStretch();

  connect(locationbutton,SIGNAL(clicked()),this,SLOT(onOfflineLocation()));
  m_offlineCurrentPage = new QLineEdit;
  m_localDocs = new QCheckBox;
  QGroupBox * docgroup = new QGroupBox(tr("Documentation"));
  QFormLayout * doclayout = new QFormLayout;
  doclayout->addRow(tr("Online URL"),m_onlineUrl);
  doclayout->addRow(tr("Online current page"),m_onlineCurrentPage);
  doclayout->addRow(tr("Offline location"),locationlayout);
  doclayout->addRow(tr("Offline current page"),m_offlineCurrentPage);
  doclayout->addRow(tr("Local documentation"),m_localDocs);
  doclayout->setVerticalSpacing(VERTICAL_SPACING);
  docgroup->setLayout(doclayout);


  vlayout->addWidget(dbgroup);
  vlayout->addWidget(othergroup);
  vlayout->addWidget(docgroup);

  vlayout->addStretch();
  setLayout(vlayout);
  addButtons();
  readSettings();
  setupConnections();
  this->setLineEditSize(VLARGE_EDIT);
  this->setComboSize(VLARGE_EDIT);


}
コード例 #9
0
QWidget* AutoImportWindow::setupStatusContinaer() {

    safeIntervalBox->setValue(ProjectPreferences().importSafeInterval());
    connect(safeIntervalBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=] (int i){
        ProjectPreferences().setImportSafeInterval(i);
        
    });
    
    QHBoxLayout* buttonLayout = new QHBoxLayout();
    buttonLayout->addStretch(0);
    buttonLayout->addWidget(importButton_, 0);
    buttonLayout->addWidget(refreshButton_, 0);
    buttonLayout->addStretch(1);
    
    QVBoxLayout* statusLayout = new QVBoxLayout;
    statusLayout->addWidget(statusLabel_, 0);
    statusLayout->addLayout(buttonLayout, 0);
    statusLayout->addWidget(deleteLabel_, 0);
    
    GroupContainer* statusContainer = new GroupContainer;
    statusContainer->setTitle("Current Status");
    statusContainer->setContainerLayout(statusLayout);
    
    filePatternLabel_->setText(FileNameParserDialog::expectedFileNamePattern());
    filePatternLabel_->setWordWrap(true);
    
    QPushButton* changeButton = new QPushButton("Change Pattern");
    connect(changeButton, &QPushButton::clicked, [=]{
        if(fileNameParser_->exec()) {
            filePatternLabel_->setText(FileNameParserDialog::expectedFileNamePattern());
        }
    }); 
    
    QHBoxLayout* fileNameParserLayout = new QHBoxLayout();
    fileNameParserLayout->addStretch(0);
    fileNameParserLayout->addWidget(filePatternLabel_, 0);
    fileNameParserLayout->addWidget(changeButton, 0);
    fileNameParserLayout->addStretch(1);
    
    QHBoxLayout* timerLayout = new QHBoxLayout();
    timerLayout->addStretch(0);
    timerLayout->addWidget(new QLabel("Number of seconds to wait before starting import of fresh (newly created) images"), 0);
    timerLayout->addWidget(safeIntervalBox, 0);
    timerLayout->addStretch(1);
    
    QFormLayout* optionsLayout = new QFormLayout();
    optionsLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
    
    optionsLayout->addRow("Parameters to be deduced from file names: ", fileNameParserLayout);
    optionsLayout->addRow("Import delay time: ", timerLayout);
    
    //Make the labels bold
    for(int i=0; i< optionsLayout->rowCount(); ++i) {
        QLabel* label = static_cast<QLabel*>(optionsLayout->itemAt(i, QFormLayout::LabelRole)->widget());
        QFont font = label->font();
        font.setBold(true);
        label->setFont(font);
    }
    
    GroupContainer* optionsContainer = new GroupContainer;
    optionsContainer->setTitle("Import Options");
    optionsContainer->setContainerLayout(optionsLayout);
    
    QHBoxLayout* resultsLayout = new QHBoxLayout();
    resultsLayout->addWidget(resultsTable_, 1);
    
    GroupContainer* resultsContainer = new GroupContainer;
    resultsContainer->setTitle("Import Folder Details");
    resultsContainer->setContainerLayout(resultsLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(statusContainer, 0);
    mainLayout->addWidget(optionsContainer, 0);
    mainLayout->addWidget(resultsContainer, 1);
    
    QWidget* mainWid = new QWidget();
    mainWid->setLayout(mainLayout);

    return mainWid;
}
コード例 #10
0
WidgetAgregarStreamPeru::WidgetAgregarStreamPeru(QWidget *parent) :
    QDialog(parent)
{
    QFormLayout *layoutPrincipal = new QFormLayout;
    QHBoxLayout *layoutBotones = new QHBoxLayout;
    QHBoxLayout *layoutRadio = new QHBoxLayout;

    botonAceptar = new QPushButton(trUtf8("Aceptar"));
    botonCancelar = new QPushButton(trUtf8("Cancelar"));
    Titulo =new QLabel ("AGREGAR PELICULA STREAM");
    campoNombre = new QLineEdit();
    campoNombreOriginal = new QLineEdit();
    campoAno = new QLineEdit();
    campoDirector = new QLineEdit();
    campoDuracion = new QLineEdit();
    campoDescripcion = new QTextEdit();
    campoUrl = new QLineEdit();
    campoFormato = new QLineEdit();
    campoHDs = new QRadioButton("SI");
    campoHDn = new QRadioButton("NO");
    campoCalidad = new QLineEdit();
    campoResolucion = new QLineEdit();
    campoExistencias = new QLineEdit();

    campoHDs->setChecked(true);

    layoutBotones->addStretch();
    layoutBotones->addWidget(botonAceptar);
    layoutBotones->addWidget(botonCancelar);

    layoutRadio->addStretch();
    layoutRadio->addWidget(campoHDs);
    layoutRadio->addWidget(campoHDn);

    layoutPrincipal->addRow(Titulo);
    layoutPrincipal->addRow(trUtf8("Nombre"), campoNombre);
    layoutPrincipal->addRow(("NombreOriginal"), campoNombreOriginal);
    layoutPrincipal->addRow("Año", campoAno );
    layoutPrincipal->addRow(trUtf8("Director"), campoDirector );
    layoutPrincipal->addRow(trUtf8("Duracion"), campoDuracion );
    layoutPrincipal->addRow(trUtf8("Descripcion"), campoDescripcion );
    layoutPrincipal->addRow(trUtf8("URL"), campoUrl );
    layoutPrincipal->addRow(trUtf8("Formato de Reproduccion"), campoFormato );
    layoutPrincipal->addRow(trUtf8("HD"), layoutRadio);
    layoutPrincipal->addRow(trUtf8("Calidad"), campoCalidad );
    layoutPrincipal->addRow(trUtf8("Resolucion"), campoResolucion );

    layoutPrincipal->addRow(layoutBotones);

    setLayout(layoutPrincipal);
    setWindowTitle("AGREGAR PELICULA");
    setMinimumSize(350,350);
    setMaximumSize(350,350);

    connect(botonAceptar, SIGNAL(clicked()),
            this, SLOT(agregarDatos()));

    connect(botonCancelar, SIGNAL(clicked()),
            this, SLOT(close()));
}
コード例 #11
0
MiniTargetWidget::MiniTargetWidget(Target *target, QWidget *parent) :
    QWidget(parent), m_target(target)
{
    Q_ASSERT(m_target);

    if (hasBuildConfiguration()) {
        m_buildComboBox = new QComboBox;
        m_buildComboBox->setProperty("alignarrow", true);
        m_buildComboBox->setProperty("hideborder", true);
        m_buildComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
        m_buildComboBox->setToolTip(tr("Select active build configuration"));
    } else {
        m_buildComboBox = 0;
    }
 
    m_runComboBox = new QComboBox;
    m_runComboBox ->setProperty("alignarrow", true);
    m_runComboBox ->setProperty("hideborder", true);
    m_runComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    m_runComboBox->setToolTip(tr("Select active run configuration"));
    int fontSize = font().pointSize();
    setStyleSheet(QString::fromLatin1("QLabel { font-size: %2pt; color: white; } "
                                      "#target { font: bold %1pt;} "
                                      "#buildLabel{ font: bold; color: rgba(255, 255, 255, 160)} "
                                      "#runLabel { font: bold ; color: rgba(255, 255, 255, 160)} "
                                      ).arg(fontSize).arg(fontSize - 2));

    QGridLayout *gridLayout = new QGridLayout(this);

    m_targetName = new QLabel(m_target->displayName());
    m_targetName->setObjectName(QString::fromUtf8("target"));
    m_targetIcon = new QLabel();
    updateIcon();
    if (hasBuildConfiguration()) {
        Q_FOREACH(BuildConfiguration* bc, m_target->buildConfigurations())
                addBuildConfiguration(bc);

        connect(m_target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
                SLOT(addBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
        connect(m_target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
                SLOT(removeBuildConfiguration(ProjectExplorer::BuildConfiguration*)));

        connect(m_target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
                SLOT(setActiveBuildConfiguration()));
        connect(m_buildComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setActiveBuildConfiguration(int)));
    }

    Q_FOREACH(RunConfiguration* rc, m_target->runConfigurations())
            addRunConfiguration(rc);

    connect(m_target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
            SLOT(addRunConfiguration(ProjectExplorer::RunConfiguration*)));
    connect(m_target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)),
            SLOT(removeRunConfiguration(ProjectExplorer::RunConfiguration*)));

    connect(m_runComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setActiveRunConfiguration(int)));

    connect(m_target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
            SLOT(setActiveRunConfiguration()));
    connect(m_target, SIGNAL(iconChanged()), this, SLOT(updateIcon()));

    QHBoxLayout *buildHelperLayout = 0;
    if (hasBuildConfiguration()) {
        buildHelperLayout= new QHBoxLayout;
        buildHelperLayout->setMargin(0);
        buildHelperLayout->setSpacing(0);
        buildHelperLayout->addWidget(m_buildComboBox);
    }

    QHBoxLayout *runHelperLayout = new QHBoxLayout;
    runHelperLayout->setMargin(0);
    runHelperLayout->setSpacing(0);
    runHelperLayout->addWidget(m_runComboBox);

    QFormLayout *formLayout = new QFormLayout;
    formLayout->setLabelAlignment(Qt::AlignRight);
    QLabel *lbl;
    int indent = 10;
    if (hasBuildConfiguration()) {
        lbl = new QLabel(tr("Build:"));
        lbl->setObjectName(QString::fromUtf8("buildLabel"));
        lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
        lbl->setIndent(indent);

        formLayout->addRow(lbl, buildHelperLayout);
    }
    lbl = new QLabel(tr("Run:"));
    lbl->setObjectName(QString::fromUtf8("runLabel"));
    lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
    lbl->setIndent(indent);
    formLayout->addRow(lbl, runHelperLayout);

    gridLayout->addWidget(m_targetName, 0, 0);
    gridLayout->addWidget(m_targetIcon, 0, 1, 2, 1, Qt::AlignTop|Qt::AlignHCenter);
    gridLayout->addLayout(formLayout, 1, 0);
}
コード例 #12
0
AM2DSummingABEditor::AM2DSummingABEditor(AM2DSummingAB* analysisBlock, QWidget *parent) :
	QWidget(parent)
{

	analysisBlock_ = analysisBlock;

	names_ = new QComboBox;
	populateComboBox();

	connect(names_, SIGNAL(currentIndexChanged(int)), this, SLOT(onNameChoiceChanged(int)));
	connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(populateComboBox()));

	axisSelector_ = new QComboBox();
	axisSelector_->addItem("Horizontal");
	axisSelector_->addItem("Vertical");

	rangeMinControl_ = new QSpinBox();
	rangeMinControl_->setSingleStep(1);
	rangeMinControl_->setMinimum(0);
	rangeMaxControl_ = new QSpinBox();
	rangeMaxControl_->setSingleStep(1);
	rangeMaxControl_->setMinimum(0);

	plot_ = new MPlot();
	plotWidget_ = new MPlotWidget();
	plotWidget_->setPlot(plot_);

	plot_->plotArea()->setBrush(QBrush(QColor(Qt::white)));
	plot_->axisRight()->setTicks(0);
	plot_->axisBottom()->setTicks(4);
	plot_->axisLeft()->showGrid(false);
	plot_->axisBottom()->showAxisName(false);
	plot_->axisLeft()->showAxisName(false);
	plot_->axisScaleBottom()->setPadding(0);
	plot_->axisScaleLeft()->setPadding(0);
	image_ = 0;

	QColor white(Qt::white);
	QPen pen(white, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
	white.setAlphaF(0.6);
	rangeRectangle1_ = new MPlotRectangle(QRectF(0,0,10,10), Qt::NoPen, QBrush(white));
	rangeRectangle1_->setSelectable(false);
	rangeRectangle1_->setIgnoreWhenAutoScaling(true);
	rangeRectangle1_->setZValue(3000);
	plot_->addItem(rangeRectangle1_);
	rangeRectangle1_->setVisible(false);
	rangeRectangle2_ = new MPlotRectangle(QRectF(0,0,10,10), Qt::NoPen, QBrush(white));
	rangeRectangle2_->setSelectable(false);
	rangeRectangle2_->setIgnoreWhenAutoScaling(true);
	rangeRectangle2_->setZValue(3000);
	plot_->addItem(rangeRectangle2_);
	rangeRectangle2_->setVisible(false);
	plot_->legend()->enableDefaultLegend(false);

	plot_->addTool(new MPlotDragZoomerTool());
	plot_->addTool(new MPlotWheelZoomerTool());



	QVBoxLayout* vl = new QVBoxLayout();
	QFormLayout* fl = new QFormLayout();
	fl->addRow("Input:", names_);
	fl->addRow("Sum", axisSelector_);
	QHBoxLayout* hl = new QHBoxLayout();
	hl->addWidget(rangeMinControl_);
	hl->addWidget(new QLabel("To"));
	hl->addWidget(rangeMaxControl_);
	fl->addRow("From (index)", hl);
	vl->addLayout(fl);
	vl->addWidget(plotWidget_);
	setLayout(vl);

	onAnalysisBlockInputDataSourcesChanged();

	// This needs to be called last because it requires all of the pointers to be valid.  All of dem.
	if (analysisBlock_->inputDataSourceCount() > 0){
		if(analysisBlock_->analyzedName().isEmpty())
			onNameChoiceChanged(0);
		else{
			for(int x = 0; x < names_->count(); x++)
				if(names_->itemData(x).toString() == analysisBlock_->analyzedName())
					names_->setCurrentIndex(x);
		}
	}

	// make connections
	connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(onAnalysisBlockInputDataSourcesChanged()));

//	connect(axisSelector_, SIGNAL(currentIndexChanged(int)), this, SLOT(onSumAxisControlChanged(int)));
	connect(rangeMinControl_, SIGNAL(valueChanged(int)), this, SLOT(onRangeMinControlChanged(int)));
	connect(rangeMaxControl_, SIGNAL(valueChanged(int)), this, SLOT(onRangeMaxControlChanged(int)));
}
コード例 #13
0
DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser, QWidget *parent)
    : q(parent)
    , kitLabel(new QLabel(DeviceProcessesDialog::tr("Kit:"), parent))
    , kitChooser(chooser)
    , acceptButton(0)
    , buttonBox(new QDialogButtonBox(parent))
{
    q->setWindowTitle(DeviceProcessesDialog::tr("List of Processes"));
    q->setWindowFlags(q->windowFlags() & ~Qt::WindowContextHelpButtonHint);
    q->setMinimumHeight(500);

    processList = 0;

    processFilterLineEdit = new FilterLineEdit(q);
    processFilterLineEdit->setPlaceholderText(DeviceProcessesDialog::tr("Filter"));
    processFilterLineEdit->setFocus(Qt::TabFocusReason);
    processFilterLineEdit->setHistoryCompleter(QLatin1String("DeviceProcessDialogFilter"));

    kitChooser->populate();

    procView = new QTreeView(q);
    procView->setModel(&proxyModel);
    procView->setSelectionBehavior(QAbstractItemView::SelectRows);
    procView->setSelectionMode(QAbstractItemView::SingleSelection);
    procView->setUniformRowHeights(true);
    procView->setRootIsDecorated(false);
    procView->setAlternatingRowColors(true);
    procView->setSortingEnabled(true);
    procView->header()->setDefaultSectionSize(100);
    procView->header()->setStretchLastSection(true);
    procView->sortByColumn(1, Qt::AscendingOrder);

    errorText = new QTextBrowser(q);

    updateListButton = new QPushButton(DeviceProcessesDialog::tr("&Update List"), q);
    killProcessButton = new QPushButton(DeviceProcessesDialog::tr("&Kill Process"), q);

    buttonBox->addButton(updateListButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(killProcessButton, QDialogButtonBox::ActionRole);

    QFormLayout *leftColumn = new QFormLayout();
    leftColumn->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    leftColumn->addRow(kitLabel, kitChooser);
    leftColumn->addRow(DeviceProcessesDialog::tr("&Filter:"), processFilterLineEdit);

//    QVBoxLayout *rightColumn = new QVBoxLayout();
//    rightColumn->addWidget(updateListButton);
//    rightColumn->addWidget(killProcessButton);
//    rightColumn->addStretch();

//    QHBoxLayout *horizontalLayout = new QHBoxLayout();
//    horizontalLayout->addLayout(leftColumn);
//    horizontalLayout->addLayout(rightColumn);

    QVBoxLayout *mainLayout = new QVBoxLayout(q);
    mainLayout->addLayout(leftColumn);
    mainLayout->addWidget(procView);
    mainLayout->addWidget(errorText);
    mainLayout->addWidget(buttonBox);

//    QFrame *line = new QFrame(this);
//    line->setFrameShape(QFrame::HLine);
//    line->setFrameShadow(QFrame::Sunken);

    proxyModel.setFilterRegExp(processFilterLineEdit->text());

    connect(processFilterLineEdit, SIGNAL(textChanged(QString)),
        &proxyModel, SLOT(setFilterRegExp(QString)));
    connect(procView->selectionModel(),
        SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
        SLOT(updateButtons()));
    connect(updateListButton, SIGNAL(clicked()), SLOT(updateProcessList()));
    connect(kitChooser, SIGNAL(currentIndexChanged(int)), SLOT(updateDevice()));
    connect(killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
    connect(&proxyModel, SIGNAL(layoutChanged()), SLOT(handleProcessListUpdated()));
    connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));

    QWidget::setTabOrder(kitChooser, processFilterLineEdit);
    QWidget::setTabOrder(processFilterLineEdit, procView);
    QWidget::setTabOrder(procView, buttonBox);
}
コード例 #14
0
ファイル: productpricedialog.cpp プロジェクト: YSYou/LADS
ProductPriceDialog::ProductPriceDialog(
        TrackDiffModel * model
        , int regularPrice
        , QWidget *parent) : m_model(model), QDialog(parent)
{
    m_model->setEditable(true);

    // Set up the add zone.
    QFormLayout * addPropertyLayout = new QFormLayout;

    m_clientEdit = new QComboBox;
    m_clientEdit->addItems(data::Client::getClientLabelList());

    m_priceEdit = new QSpinBox;
    m_priceEdit->setMinimum(0);
    m_priceEdit->setMaximum(10000);
    m_priceEdit->setValue(regularPrice);

    addPropertyLayout->addRow(tr("Client:"), m_clientEdit);
    addPropertyLayout->addRow(tr("Price:"), m_priceEdit);

    QPushButton * add = new QPushButton(tr("Add a item"));
    connect(add, SIGNAL(clicked()), this, SLOT(addItem()));

    QVBoxLayout * addRightLayout = new QVBoxLayout;
    addRightLayout->addStretch(-1);
    addRightLayout->addWidget(add);

    QHBoxLayout * addLayout = new QHBoxLayout;
    addLayout->addLayout(addPropertyLayout);
    addLayout->addLayout(addRightLayout);

    QGroupBox * addBox = new QGroupBox;
    addBox->setLayout(addLayout);

    // Set delete button.
    QPushButton * del = new QPushButton(tr("Delete current item"));
    connect(del, SIGNAL(clicked()), this, SLOT(deleteItem()));

    // Set price layout.
    m_delegate = new SpinBoxDelegate(this);

    m_priceView = new QTableView;
    m_priceView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_priceView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_priceView->setModel(m_model);
    m_priceView->setItemDelegateForColumn(1, m_delegate);
    m_priceView->horizontalHeader()->setStretchLastSection(true);

    // Set status layout.
    m_status = new QLabel;
    m_status->setHidden(true);
    m_status->setStyleSheet("QLabel { color : red; }");

    QHBoxLayout * statusLayout = new QHBoxLayout;
    statusLayout->addStretch(-1);
    statusLayout->addWidget(m_status);

    // Set button layout.
    QPushButton * save = new QPushButton(tr("Save"));
    connect(save, SIGNAL(clicked()), this, SLOT(accept()));

    QPushButton * cancel = new QPushButton(tr("Cancel"));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));

    QHBoxLayout * buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch(-1);
    buttonLayout->addWidget(save);
    buttonLayout->addWidget(cancel);

    // Set main layout.
    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->addWidget(addBox);
    mainLayout->addWidget(del);
    mainLayout->addWidget(m_priceView);
    mainLayout->addLayout(statusLayout);
    mainLayout->addSpacing(12);
    mainLayout->addLayout(buttonLayout);

    setLayout(mainLayout);
}
コード例 #15
0
void QgsVectorLayerSaveAsDialog::mFormatComboBox_currentIndexChanged( int idx )
{
  Q_UNUSED( idx );

  browseFilename->setEnabled( true );
  leFilename->setEnabled( true );
  bool selectAllFields = true;
  bool fieldsAsDisplayedValues = false;

  const QString sFormat( format() );
  if ( sFormat == QLatin1String( "DXF" ) || sFormat == QLatin1String( "DGN" ) )
  {
    mAttributesSelection->setVisible( false );
    selectAllFields = false;
  }
  else
  {
    mAttributesSelection->setVisible( true );
    fieldsAsDisplayedValues = ( sFormat == QLatin1String( "CSV" ) || sFormat == QLatin1String( "XLS" ) || sFormat == QLatin1String( "XLSX" ) || sFormat == QLatin1String( "ODS" ) );
  }

  leLayername->setEnabled( sFormat == QLatin1String( "KML" ) ||
                           sFormat == QLatin1String( "GPKG" ) ||
                           sFormat == QLatin1String( "XLSX" ) ||
                           sFormat == QLatin1String( "ODS" ) ||
                           sFormat == QLatin1String( "FileGDB" ) ||
                           sFormat == QLatin1String( "SQLite" ) ||
                           sFormat == QLatin1String( "SpatiaLite" ) );
  if ( !leLayername->isEnabled() )
    leLayername->setText( QString() );
  else if ( leLayername->text().isEmpty() &&
            !leFilename->text().isEmpty() )
  {
    QString layerName = QFileInfo( leFilename->text() ).baseName();
    leLayername->setText( layerName );
  }

  if ( mLayer )
  {
    mAttributeTable->setRowCount( mLayer->fields().count() );

    bool foundFieldThatCanBeExportedAsDisplayedValue = false;
    for ( int i = 0; i < mLayer->fields().size(); ++i )
    {
      const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, mLayer->fields()[i].name() );
      if ( setup.type() != QLatin1String( "TextEdit" ) &&
           QgsGui::editorWidgetRegistry()->factory( setup.type() ) )
      {
        foundFieldThatCanBeExportedAsDisplayedValue = true;
        break;
      }
    }
    if ( foundFieldThatCanBeExportedAsDisplayedValue )
    {
      mAttributeTable->setColumnCount( 3 );
      mAttributeTable->setHorizontalHeaderLabels( QStringList() << tr( "Name" ) << tr( "Type" ) << tr( "Replace with displayed values" ) );
    }
    else
    {
      mAttributeTable->setColumnCount( 2 );
      mAttributeTable->setHorizontalHeaderLabels( QStringList() << tr( "Name" ) << tr( "Type" ) );
    }

    mAttributeTableItemChangedSlotEnabled = false;

    for ( int i = 0; i < mLayer->fields().size(); ++i )
    {
      QgsField fld = mLayer->fields().at( i );
      Qt::ItemFlags flags = mLayer->providerType() != QLatin1String( "oracle" ) || !fld.typeName().contains( QLatin1String( "SDO_GEOMETRY" ) ) ? Qt::ItemIsEnabled : Qt::NoItemFlags;
      QTableWidgetItem *item = nullptr;
      item = new QTableWidgetItem( fld.name() );
      item->setFlags( flags | Qt::ItemIsUserCheckable );
      item->setCheckState( ( selectAllFields ) ? Qt::Checked : Qt::Unchecked );
      mAttributeTable->setItem( i, COLUMN_IDX_NAME, item );

      item = new QTableWidgetItem( fld.typeName() );
      item->setFlags( flags );
      mAttributeTable->setItem( i, COLUMN_IDX_TYPE, item );

      if ( foundFieldThatCanBeExportedAsDisplayedValue )
      {
        const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, mLayer->fields()[i].name() );
        QgsEditorWidgetFactory *factory = nullptr;
        if ( flags == Qt::ItemIsEnabled &&
             setup.type() != QLatin1String( "TextEdit" ) &&
             ( factory = QgsGui::editorWidgetRegistry()->factory( setup.type() ) ) )
        {
          item = new QTableWidgetItem( tr( "Use %1" ).arg( factory->name() ) );
          item->setFlags( ( selectAllFields ) ? ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ) : Qt::ItemIsUserCheckable );
          item->setCheckState( ( selectAllFields && fieldsAsDisplayedValues ) ? Qt::Checked : Qt::Unchecked );
          mAttributeTable->setItem( i, COLUMN_IDX_EXPORT_AS_DISPLAYED_VALUE, item );
        }
        else
        {
          item = new QTableWidgetItem();
          item->setFlags( Qt::NoItemFlags );
          mAttributeTable->setItem( i, COLUMN_IDX_EXPORT_AS_DISPLAYED_VALUE, item );
        }
      }
    }

    mAttributeTableItemChangedSlotEnabled = true;

    mReplaceRawFieldValuesStateChangedSlotEnabled = false;
    mReplaceRawFieldValues->setChecked( selectAllFields && fieldsAsDisplayedValues );
    mReplaceRawFieldValuesStateChangedSlotEnabled = true;
    mReplaceRawFieldValues->setEnabled( selectAllFields );
    mReplaceRawFieldValues->setVisible( foundFieldThatCanBeExportedAsDisplayedValue );

    mAttributeTable->resizeColumnsToContents();
  }

  QgsVectorFileWriter::MetaData driverMetaData;

  while ( mDatasourceOptionsGroupBox->layout()->count() )
  {
    QLayoutItem *item = mDatasourceOptionsGroupBox->layout()->takeAt( 0 );
    delete item->widget();
    delete item;
  }

  while ( mLayerOptionsGroupBox->layout()->count() )
  {
    QLayoutItem *item = mLayerOptionsGroupBox->layout()->takeAt( 0 );
    delete item->widget();
    delete item;
  }

  // workaround so the Q_FOREACH macro does not get confused by the ','
  typedef QPair<QLabel *, QWidget *> LabelControlPair;

  if ( QgsVectorFileWriter::driverMetadata( format(), driverMetaData ) )
  {
    if ( !driverMetaData.driverOptions.empty() )
    {
      mDatasourceOptionsGroupBox->setVisible( true );
      QList<QPair<QLabel *, QWidget *> > controls = createControls( driverMetaData.driverOptions );

      QFormLayout *datasourceLayout = dynamic_cast<QFormLayout *>( mDatasourceOptionsGroupBox->layout() );

      Q_FOREACH ( LabelControlPair control, controls )
      {
        datasourceLayout->addRow( control.first, control.second );
      }
    }
コード例 #16
0
ファイル: scenebasic.cpp プロジェクト: musallub/agros2d
QLayout* SceneEdgeDialog::createContent()
{
    logMessage("DSceneEdge::createContent()");

    cmbNodeStart = new QComboBox();
    cmbNodeEnd = new QComboBox();
    connect(cmbNodeStart, SIGNAL(currentIndexChanged(int)), this, SLOT(doNodeChanged()));
    connect(cmbNodeEnd, SIGNAL(currentIndexChanged(int)), this, SLOT(doNodeChanged()));
    cmbBoundary = new QComboBox();
    connect(cmbBoundary, SIGNAL(currentIndexChanged(int)), this, SLOT(doBoundaryChanged(int)));
    btnBoundary = new QPushButton(icon("three-dots"), "");
    btnBoundary->setMaximumSize(btnBoundary->sizeHint());
    connect(btnBoundary, SIGNAL(clicked()), this, SLOT(doBoundaryClicked()));
    txtAngle = new ValueLineEdit();
    txtAngle->setMinimum(0.0);
    txtAngle->setMaximum(180.0);
    connect(txtAngle, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    txtRefineTowardsEdge = new QSpinBox(this);
    txtRefineTowardsEdge->setMinimum(0);
    txtRefineTowardsEdge->setMaximum(10);
    lblLength = new QLabel();

    // coordinates
    QFormLayout *layoutCoordinates = new QFormLayout();
    layoutCoordinates->addRow(tr("Start point:"), cmbNodeStart);
    layoutCoordinates->addRow(tr("End point:"), cmbNodeEnd);
    layoutCoordinates->addRow(tr("Angle (deg.):"), txtAngle);

    QGroupBox *grpCoordinates = new QGroupBox(tr("Coordinates"));
    grpCoordinates->setLayout(layoutCoordinates);

    // marker
    QHBoxLayout *layoutBoundary = new QHBoxLayout();
    layoutBoundary->addWidget(cmbBoundary);
    layoutBoundary->addWidget(btnBoundary);

    // refine towards edge
    chkRefineTowardsEdge = new QCheckBox();
    connect(chkRefineTowardsEdge, SIGNAL(stateChanged(int)), this, SLOT(doRefineTowardsEdge(int)));

    QHBoxLayout *layoutRefineTowardsEdge = new QHBoxLayout();
    layoutRefineTowardsEdge->addStretch(1);
    layoutRefineTowardsEdge->addWidget(chkRefineTowardsEdge);
    layoutRefineTowardsEdge->addWidget(txtRefineTowardsEdge);

    // mesh
    QFormLayout *layoutMeshParameters = new QFormLayout();
    layoutMeshParameters->addRow(tr("Refine towards edge:"), layoutRefineTowardsEdge);

    QGroupBox *grpMeshParameters = new QGroupBox(tr("Mesh parameters"));
    grpMeshParameters->setLayout(layoutMeshParameters);

    // layout
    QFormLayout *layout = new QFormLayout();
    layout->addRow(tr("Boundary condition:"), layoutBoundary);
    layout->addRow(grpCoordinates);
    layout->addRow(grpMeshParameters);
    layout->addRow(tr("Length:"), lblLength);

    fillComboBox();

    return layout;
}
コード例 #17
0
FilterOptionsDialog::FilterOptionsDialog(QWidget *parent, int FilterType)
                   : KDialog(parent)
{
    setCaption(i18n("Filter Options"));
    setModal(true);
    showButtonSeparator(true);
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    QWidget* box       = new QWidget(this);
    QFormLayout *layout = new QFormLayout(box);
    layout->setSpacing(spacingHint());
    layout->setMargin(0);
    setMainWidget(box);

    if (FilterType == 0)
    { // Add noise
        m_noiseType = new KComboBox(false, box);
        m_noiseType->addItem(i18nc("image noise type", "Uniform"));
        m_noiseType->addItem(i18nc("image noise type", "Gaussian"));
        m_noiseType->addItem(i18nc("image noise type", "Multiplicative"));
        m_noiseType->addItem(i18nc("image noise type", "Impulse"));
        m_noiseType->addItem(i18nc("image noise type", "Laplacian"));
        m_noiseType->addItem(i18nc("image noise type", "Poisson"));
        m_noiseType->setWhatsThis(i18n("Select here the algorithm method which will used "
                                       "to add random noise to the images."));
        layout->addRow(i18n("Noise algorithm:"), m_noiseType);
    }
    else if (FilterType == 2)
    { // Blur
        m_blurRadius = new KIntNumInput(3, box);
        initInput(m_blurRadius, 0, 20, i18n("px"));
        m_blurRadius->setWhatsThis(i18n("Select here the blur radius of the Gaussian, "
                                        "not counting the center pixel. For reasonable results, the "
                                        "radius should be larger than deviation. If you use a radius of 0 "
                                        "the blur operation selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_blurRadius);

        m_blurDeviation = new KIntNumInput(1, box);
        initInput(m_blurDeviation, 0, 20, i18n("px"));
        m_blurDeviation->setWhatsThis(i18n("Select here the standard deviation of the blur Gaussian."));
        layout->addRow(i18n("Deviation:"), m_blurDeviation);
    }
    else if (FilterType == 5)
    { // Median
        m_medianRadius = new KIntNumInput(3, box);
        initInput(m_medianRadius, 0, 20, i18n("px"));
        m_medianRadius->setWhatsThis(i18n("Select here the median radius of the pixel neighborhood. "
                                          "The algorithm applies a digital filter that improves the quality "
                                          "of noisy images. Each pixel is replaced by the median in a "
                                          "set of neighboring pixels as defined by the radius."));
        layout->addRow(i18n("Radius:"), m_medianRadius);
    }
    else if (FilterType == 6)
    { // Noise reduction
        m_noiseRadius = new KIntNumInput(3, box);
        initInput(m_noiseRadius, 0, 20, i18n("px"));
        m_noiseRadius->setWhatsThis(i18n("Select here the noise reduction radius value. "
                                         "The algorithm smooths the contours of an image while still "
                                         "preserving edge information. The algorithm works by replacing "
                                         "each pixel with its neighbor closest in value. A neighbor is "
                                         "defined by the radius. If you use a radius of 0 the algorithm "
                                         "selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_noiseRadius);
    }
    else if (FilterType == 7)
    { // Sharpen
        m_sharpenRadius = new KIntNumInput(3, box);
        initInput(m_sharpenRadius, 0, 20, i18n("px"));
        m_sharpenRadius->setWhatsThis(i18n("Select here the radius of the sharpen Gaussian, "
                                           "not counting the center pixel. For reasonable "
                                           "results, the radius should be larger than deviation. "
                                           "If you use a radius of 0 the sharpen operation selects a "
                                           "suitable radius."));
        layout->addRow(i18n("Radius:"), m_sharpenRadius);

        m_sharpenDeviation = new KIntNumInput(1, box);
        initInput(m_sharpenDeviation, 0, 20, i18n("px"));
        m_sharpenDeviation->setWhatsThis(i18n("Select here the sharpen deviation value of the "
                                              "Laplacian."));
        layout->addRow(i18n("Deviation:"), m_sharpenDeviation);
    }
    else if (FilterType == 8)
    { // Unsharp
        m_unsharpenRadius = new KIntNumInput(3, box);
        initInput(m_unsharpenRadius, 0, 20, i18n("px"));
        m_unsharpenRadius->setWhatsThis(i18n("Select here the radius of the unsharpen Gaussian, "
                                             "not counting the center pixel. The algorithm "
                                             "convolve the image with a Gaussian operator of the given "
                                             "radius and standard deviation. For reasonable results, "
                                             "radius should be larger than sigma. If you use a radius of 0 "
                                             "the algorithm selects a suitable radius."));
        layout->addRow(i18n("Radius:"), m_unsharpenRadius);

        m_unsharpenDeviation = new KIntNumInput(1, box);
        initInput(m_unsharpenDeviation, 0, 20, i18n("px"));
        m_unsharpenDeviation->setWhatsThis(i18n("Select here the unsharpen deviation value of the "
                                                "Gaussian."));
        layout->addRow(i18n("Deviation:"), m_unsharpenDeviation);

        m_unsharpenPercent = new KIntNumInput(100, box);
        initInput(m_unsharpenPercent, 1, 200, i18n("%"));
        m_unsharpenPercent->setWhatsThis(i18n("Select here the percentage difference between original "
                                              "and blurred image which should be added to original."));
        layout->addRow(i18n("Amount:"), m_unsharpenPercent);

        m_unsharpenThreshold = new KIntNumInput(5, box);
        initInput(m_unsharpenThreshold, 1, 100, i18n("%"));
        m_unsharpenThreshold->setWhatsThis(i18n("Select here the unsharpen threshold value, "
                                                "as a percentage of the maximum color component value, "
                                                "needed to apply the difference amount."));
        layout->addRow(i18n("Threshold:"), m_unsharpenThreshold);
    }
}
コード例 #18
0
ファイル: scenebasic.cpp プロジェクト: musallub/agros2d
QLayout* SceneLabelDialog::createContent()
{
    logMessage("DSceneLabel::createContent()");

    txtPointX = new ValueLineEdit();
    txtPointY = new ValueLineEdit();
    connect(txtPointX, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    connect(txtPointY, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    cmbMaterial = new QComboBox();
    connect(cmbMaterial, SIGNAL(currentIndexChanged(int)), this, SLOT(doMaterialChanged(int)));
    btnMaterial = new QPushButton(icon("three-dots"), "");
    btnMaterial->setMaximumSize(btnMaterial->sizeHint());
    connect(btnMaterial, SIGNAL(clicked()), this, SLOT(doMaterialClicked()));
    txtArea = new ValueLineEdit();
    txtArea->setMinimum(0.0);
    connect(txtArea, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    txtPolynomialOrder = new QSpinBox(this);
    txtPolynomialOrder->setMinimum(0);
    txtPolynomialOrder->setMaximum(10);

    // coordinates must be greater then or equal to 0 (axisymmetric case)
    if (Util::scene()->problemInfo()->problemType == ProblemType_Axisymmetric)
        txtPointX->setMinimum(0.0);

    // coordinates
    QFormLayout *layoutCoordinates = new QFormLayout();
    layoutCoordinates->addRow(Util::scene()->problemInfo()->labelX() + " (m):", txtPointX);
    layoutCoordinates->addRow(Util::scene()->problemInfo()->labelY() + " (m):", txtPointY);

    QGroupBox *grpCoordinates = new QGroupBox(tr("Coordinates"));
    grpCoordinates->setLayout(layoutCoordinates);

    // marker
    QHBoxLayout *layoutMaterial = new QHBoxLayout();
    layoutMaterial->addWidget(cmbMaterial);
    layoutMaterial->addWidget(btnMaterial);

    // order
    chkPolynomialOrder = new QCheckBox();
    connect(chkPolynomialOrder, SIGNAL(stateChanged(int)), this, SLOT(doPolynomialOrder(int)));

    QHBoxLayout *layoutPolynomialOrder = new QHBoxLayout();
    layoutPolynomialOrder->addWidget(chkPolynomialOrder);
    layoutPolynomialOrder->addWidget(txtPolynomialOrder);
    layoutPolynomialOrder->addWidget(new QLabel(tr("Global order is %1.").arg(Util::scene()->problemInfo()->polynomialOrder)));

    // area
    chkArea = new QCheckBox();
    connect(chkArea, SIGNAL(stateChanged(int)), this, SLOT(doArea(int)));

    QHBoxLayout *layoutArea = new QHBoxLayout();
    layoutArea->addWidget(chkArea);
    layoutArea->addWidget(txtArea);

    // mesh
    QFormLayout *layoutMeshParameters = new QFormLayout();
    layoutMeshParameters->addRow(tr("Triangle area (m):"), layoutArea);
    layoutMeshParameters->addRow(tr("Polynomial order (-):"), layoutPolynomialOrder);

    QGroupBox *grpMeshParameters = new QGroupBox(tr("Mesh parameters"));
    grpMeshParameters->setLayout(layoutMeshParameters);

    QFormLayout *layout = new QFormLayout();
    layout->addRow(tr("Material:"), layoutMaterial);
    layout->addRow(grpCoordinates);
    layout->addRow(grpMeshParameters);

    fillComboBox();

    return layout;
}
コード例 #19
0
void DataViewer_GameObject::_CreatePiece_Light( Light* light )
{
	QFormLayout* form = new QFormLayout();
	form->setSpacing( 3 );
	form->setContentsMargins( 0, 0, 3, 0 );


	QLineEdit* xWidget;
	QLineEdit* yWidget;
	QLineEdit* zWidget;

	QStringList typeNames;
	for (auto& kv : EnumConvertor::s2e_LightType)
	{
		typeNames << kv.first.ToChar();
	}
	QWidget* type = _CreateWidget_Choice( typeNames );
	QObject::connect( static_cast<QComboBox*>(type), &QComboBox::currentTextChanged, 
						this, &DataViewer_GameObject::A_Light_1 );
	form->addRow( "Type", type );

	QWidget* color = _CreateWidget_Vector3();
	xWidget = static_cast<QLineEdit*>( color->layout()->itemAt(1)->widget() );
	yWidget = static_cast<QLineEdit*>( color->layout()->itemAt(3)->widget() );
	zWidget = static_cast<QLineEdit*>( color->layout()->itemAt(5)->widget() );
	QObject::connect( xWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Light_1 );
	QObject::connect( yWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Light_1 );
	QObject::connect( zWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_Light_1 );
	form->addRow( "Color", color );

	QWidget* intensity = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(intensity), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Light_1 );
	form->addRow( "Intensity", intensity );

	QWidget* range = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(range), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Light_1 );
	form->addRow( "Range", range );

	QWidget* spotAngle = _CreateWidget_Float();
	QObject::connect( static_cast<QLineEdit*>(spotAngle), &QLineEdit::textChanged, 
						this, &DataViewer_GameObject::A_Light_1 );
	form->addRow( "Spot Angle", spotAngle );

	QWidget* castShadows = _CreateWidget_Bool();
	QObject::connect( static_cast<QCheckBox*>(castShadows), &QCheckBox::clicked, 
						this, &DataViewer_GameObject::A_Light_2 );
	form->addRow( "Cast Shadows", castShadows );


	QCheckBox* titleCheck = new QCheckBox();
	QObject::connect( titleCheck, &QCheckBox::clicked, this, &DataViewer_GameObject::A_Light_2 );

	QLabel* titleLabel = new QLabel( "Light" );
	titleLabel->setObjectName( "Style_Title" );

	QWidget* emptySpace = new QWidget();
	emptySpace->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

	QtRemoveButton* removeButton = new QtRemoveButton();
	removeButton->setText( "x" );
	removeButton->setMinimumSize( 20, 18 );
	removeButton->setMaximumSize( 20, 18 );
	removeButton->component = light;
	QObject::connect( removeButton, &QPushButton::clicked, removeButton, &QtRemoveButton::A_Onlick );

	QHBoxLayout* boxLayout = new QHBoxLayout();
	boxLayout->setAlignment( Qt::AlignLeft );
	boxLayout->addWidget( titleCheck );
	boxLayout->addWidget( titleLabel );
	boxLayout->addWidget( emptySpace );
	boxLayout->addWidget( removeButton );


	QWidget* titleWidget = new QWidget( _qtTree );
	titleWidget->setLayout( boxLayout );

	QWidget* dataWidget = new QWidget( _qtTree );
	dataWidget->setLayout( form );

	_CreatePiece( titleWidget, dataWidget );

	_dataLight.titleWidget = titleWidget;
	_dataLight.dataWidget = dataWidget;
	_dataLight.enable = titleCheck;
	_dataLight.type = type;
	_dataLight.color = color;
	_dataLight.intensity = intensity;
	_dataLight.range = range;
	_dataLight.spotAngle = spotAngle;
	_dataLight.castShadows = castShadows;
}
コード例 #20
0
void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx )
{
  Q_UNUSED( idx );

  browseFilename->setEnabled( true );
  leFilename->setEnabled( true );

  if ( format() == "KML" )
  {
    mEncodingComboBox->setCurrentIndex( mEncodingComboBox->findText( "UTF-8" ) );
    mEncodingComboBox->setDisabled( true );
    mAttributesSelection->setChecked( true );
  }
  else if ( format() == "DXF" )
  {
    mAttributesSelection->setChecked( true );
    mAttributesSelection->setDisabled( true );
  }
  else
  {
    mEncodingComboBox->setEnabled( true );
    mAttributesSelection->setEnabled( true );
  }

  if ( mLayer )
  {
    mAttributeTable->setRowCount( mLayer->fields().count() );
    mAttributeTable->setColumnCount( 2 );
    mAttributeTable->setHorizontalHeaderLabels( QStringList() << tr( "Name" ) << tr( "Type" ) );

    int i = 0;
    Q_FOREACH ( const QgsField &fld, mLayer->fields() )
    {
      Qt::ItemFlags flags = mLayer->providerType() != "oracle" || !fld.typeName().contains( "SDO_GEOMETRY" ) ? Qt::ItemIsEnabled : Qt::NoItemFlags;
      QTableWidgetItem *item;
      item = new QTableWidgetItem( fld.name() );
      item->setFlags( flags | Qt::ItemIsUserCheckable );
      item->setCheckState( Qt::Unchecked );
      mAttributeTable->setItem( i, 0, item );
      item = new QTableWidgetItem( fld.typeName() );
      item->setFlags( flags );
      mAttributeTable->setItem( i++, 1, item );
    }

    mAttributeTable->resizeColumnsToContents();
  }

  QgsVectorFileWriter::MetaData driverMetaData;

  while ( mDatasourceOptionsGroupBox->layout()->count() )
  {
    QLayoutItem* item = mDatasourceOptionsGroupBox->layout()->takeAt( 0 );
    delete item->widget();
    delete item;
  }

  while ( mLayerOptionsGroupBox->layout()->count() )
  {
    QLayoutItem* item = mLayerOptionsGroupBox->layout()->takeAt( 0 );
    delete item->widget();
    delete item;
  }

  // workaround so the Q_FOREACH macro does not get confused by the ','
  typedef QPair<QLabel*, QWidget*> LabelControlPair;

  if ( QgsVectorFileWriter::driverMetadata( format(), driverMetaData ) )
  {
    if ( driverMetaData.driverOptions.size() != 0 )
    {
      mDatasourceOptionsGroupBox->setVisible( true );
      QList<QPair<QLabel*, QWidget*> > controls = createControls( driverMetaData.driverOptions );

      QFormLayout* datasourceLayout = dynamic_cast<QFormLayout*>( mDatasourceOptionsGroupBox->layout() );

      Q_FOREACH ( LabelControlPair control, controls )
      {
        datasourceLayout->addRow( control.first, control.second );
      }
    }
コード例 #21
0
void DataViewer_GameObject::_CreatePiece_MeshDrawing( MeshDrawing* meshDrawing )
{
	QFormLayout* form = new QFormLayout();
	form->setSpacing( 3 );
	form->setContentsMargins( 0, 0, 3, 0 );


	QLineEdit* textWidget;

	QWidget* material = _CreateWidget_Picking( "Material" );
	textWidget = static_cast<QLineEdit*>( material->layout()->itemAt(0)->widget() );
	QObject::connect( textWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_MeshDrawing_1 );
	form->addRow( "Material", material );

	QWidget* mesh = _CreateWidget_Picking( "Mesh" );
	textWidget = static_cast<QLineEdit*>( mesh->layout()->itemAt(0)->widget() );
	QObject::connect( textWidget, &QLineEdit::textChanged, this, &DataViewer_GameObject::A_MeshDrawing_1 );
	form->addRow( "Mesh", mesh );

	QWidget* castShadows = _CreateWidget_Bool();
	QObject::connect( static_cast<QCheckBox*>(castShadows), &QCheckBox::clicked, 
						this, &DataViewer_GameObject::A_MeshDrawing_2 );
	form->addRow( "Cast Shadows", castShadows );

	QWidget* receiveShadows = _CreateWidget_Bool();
	QObject::connect( static_cast<QCheckBox*>(receiveShadows), &QCheckBox::clicked, 
						this, &DataViewer_GameObject::A_MeshDrawing_2 );
	form->addRow( "Receive Shadows", receiveShadows );


	QCheckBox* titleCheck = new QCheckBox();
	QObject::connect( titleCheck, &QCheckBox::clicked, this, &DataViewer_GameObject::A_MeshDrawing_2 );

	QLabel* titleLabel = new QLabel( "MeshDrawing" );
	titleLabel->setObjectName( "Style_Title" );

	QWidget* emptySpace = new QWidget();
	emptySpace->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

	QtRemoveButton* removeButton = new QtRemoveButton();
	removeButton->setText( "x" );
	removeButton->setMinimumSize( 20, 18 );
	removeButton->setMaximumSize( 20, 18 );
	removeButton->component = meshDrawing;
	QObject::connect( removeButton, &QPushButton::clicked, removeButton, &QtRemoveButton::A_Onlick );

	QHBoxLayout* boxLayout = new QHBoxLayout();
	boxLayout->setAlignment( Qt::AlignLeft );
	boxLayout->addWidget( titleCheck );
	boxLayout->addWidget( titleLabel );
	boxLayout->addWidget( emptySpace );
	boxLayout->addWidget( removeButton );


	QWidget* titleWidget = new QWidget( _qtTree );
	titleWidget->setLayout( boxLayout );

	QWidget* dataWidget = new QWidget( _qtTree );
	dataWidget->setLayout( form );

	_CreatePiece( titleWidget, dataWidget );


	_dataMeshDrawing.titleWidget = titleWidget;
	_dataMeshDrawing.dataWidget = dataWidget;
	_dataMeshDrawing.enable = titleCheck;
	_dataMeshDrawing.material = material;
	_dataMeshDrawing.mesh = mesh;
	_dataMeshDrawing.castShadows = castShadows;
	_dataMeshDrawing.receiveShadows = receiveShadows;
}
コード例 #22
0
ファイル: StreamsDlg.cpp プロジェクト: robotage/SyntroPiApps
void StreamsDlg::layoutWindow()
{
	QSettings *settings = SyntroUtils::getSettings();

	settings->beginGroup(CAMCLIENT_STREAM_GROUP);

	QVBoxLayout *centralLayout = new QVBoxLayout(this);
	
    QFormLayout *formLayout = new QFormLayout;

	m_highRateMinInterval = new QLineEdit(this);
	m_highRateMinInterval->setMaximumWidth(60);
	formLayout->addRow(tr("High rate min interval (mS)"), m_highRateMinInterval);
	m_highRateMinInterval->setText(settings->value(CAMCLIENT_HIGHRATEVIDEO_MININTERVAL).toString());
	m_highRateMinInterval->setValidator(new QIntValidator(33, 10000));

	m_highRateMaxInterval = new QLineEdit(this);
	m_highRateMaxInterval->setMaximumWidth(60);
	formLayout->addRow(tr("High rate max interval (mS)"), m_highRateMaxInterval);
	m_highRateMaxInterval->setText(settings->value(CAMCLIENT_HIGHRATEVIDEO_MAXINTERVAL).toString());
	m_highRateMaxInterval->setValidator(new QIntValidator(10000, 60000));

	m_highRateNullInterval = new QLineEdit(this);
	m_highRateNullInterval->setMaximumWidth(60);
	formLayout->addRow(tr("High rate null interval (mS)"), m_highRateNullInterval);
	m_highRateNullInterval->setText(settings->value(CAMCLIENT_HIGHRATEVIDEO_NULLINTERVAL).toString());
	m_highRateNullInterval->setValidator(new QIntValidator(1000, 10000));

    QGroupBox *group = new QGroupBox("High Rate Parameters");
    group->setLayout(formLayout);
    centralLayout->addWidget(group);

    formLayout = new QFormLayout;

	m_generateLowRate = new QCheckBox(this);
	formLayout->addRow(tr("Generate low rate"), m_generateLowRate);
	m_generateLowRate->setCheckState(settings->value(CAMCLIENT_GENERATE_LOWRATE).toBool() ? Qt::Checked : Qt::Unchecked);
    centralLayout->addLayout(formLayout);

    formLayout = new QFormLayout;

	m_lowRateHalfRes = new QCheckBox(this);
	formLayout->addRow(tr("Low rate at half resolution"), m_lowRateHalfRes);
	m_lowRateHalfRes->setCheckState(settings->value(CAMCLIENT_LOWRATE_HALFRES).toBool() ? Qt::Checked : Qt::Unchecked);

	m_lowRateMinInterval = new QLineEdit(this);
	m_lowRateMinInterval->setMaximumWidth(60);
	formLayout->addRow(tr("Low rate min interval (mS)"), m_lowRateMinInterval);
	m_lowRateMinInterval->setText(settings->value(CAMCLIENT_LOWRATEVIDEO_MININTERVAL).toString());
	m_lowRateMinInterval->setValidator(new QIntValidator(33, 10000));

	m_lowRateMaxInterval = new QLineEdit(this);
	m_lowRateMaxInterval->setMaximumWidth(60);
	formLayout->addRow(tr("Low rate max interval (mS)"), m_lowRateMaxInterval);
	m_lowRateMaxInterval->setText(settings->value(CAMCLIENT_LOWRATEVIDEO_MAXINTERVAL).toString());
	m_lowRateMaxInterval->setValidator(new QIntValidator(10000, 60000));

	m_lowRateNullInterval = new QLineEdit(this);
	m_lowRateNullInterval->setMaximumWidth(60);
	formLayout->addRow(tr("Low rate null interval (mS)"), m_lowRateNullInterval);
	m_lowRateNullInterval->setText(settings->value(CAMCLIENT_LOWRATEVIDEO_NULLINTERVAL).toString());
	m_lowRateNullInterval->setValidator(new QIntValidator(1000, 10000));

    group = new QGroupBox("Low Rate Parameters");
    group->setLayout(formLayout);
    centralLayout->addWidget(group);

	m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
	m_buttons->setCenterButtons(true);

    centralLayout->addSpacerItem(new QSpacerItem(20, 20));

	centralLayout->addWidget(m_buttons);

	connect(m_generateLowRate, SIGNAL(stateChanged(int)), this, SLOT(lowRateStateChange(int)));

	enableLowRate(m_generateLowRate->checkState() == Qt::Checked);

	settings->endGroup();

	delete settings;
}
コード例 #23
0
GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent)
    : QWidget(parent)
{
    groupBoxDangerous = new QGroupBox(this);
    groupBoxDangerous->setTitle(GdbOptionsPage::tr("Extended"));

    labelDangerous = new QLabel(GdbOptionsPage::tr(
        "The options below should be used with care."));
    labelDangerous->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>The options below give access to advanced "
        "or experimental functions of GDB. Enabling them may negatively "
        "impact your debugging experience.</body></html>"));
    QFont f = labelDangerous->font();
    f.setItalic(true);
    labelDangerous->setFont(f);

    checkBoxTargetAsync = new QCheckBox(groupBoxDangerous);
    checkBoxTargetAsync->setText(GdbOptionsPage::tr(
        "Use asynchronous mode to control the inferior"));

    checkBoxAutoEnrichParameters = new QCheckBox(groupBoxDangerous);
    checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr(
        "Use common locations for debug information"));
    checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>Add common paths to locations "
        "of debug information such as <i>/usr/src/debug</i> "
        "when starting GDB.</body></html>"));

    // #fixme: 2.7 Move to common settings page.
    checkBoxBreakOnWarning = new QCheckBox(groupBoxDangerous);
    checkBoxBreakOnWarning->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qWarning"));
    checkBoxBreakOnWarning->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qWarning"));

    checkBoxBreakOnFatal = new QCheckBox(groupBoxDangerous);
    checkBoxBreakOnFatal->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal"));
    checkBoxBreakOnFatal->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal"));

    checkBoxBreakOnAbort = new QCheckBox(groupBoxDangerous);
    checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort"));
    checkBoxBreakOnAbort->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort"));

    checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
    checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
    checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body><p>Enable stepping backwards.</p><p>"
        "<b>Note:</b> This feature is very slow and unstable on the GDB side. "
        "It exhibits unpredictable behavior when going backwards over system "
        "calls and is very likely to destroy your debugging session.</p></body></html>"));

    checkBoxAttemptQuickStart = new QCheckBox(groupBoxDangerous);
    checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
    checkBoxAttemptQuickStart->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>Postpone reading debug information as long as possible. "
        "This can result in faster startup times at the price of not being able to "
        "set breakpoints by file and number.</body></html>"));

    checkBoxMultiInferior = new QCheckBox(groupBoxDangerous);
    checkBoxMultiInferior->setText(GdbOptionsPage::tr("Debug all children"));
    checkBoxMultiInferior->setToolTip(GdbOptionsPage::tr(
        "<html><head/><body>Keep debugging all children after a fork."
        "</body></html>"));


    QFormLayout *formLayout = new QFormLayout(groupBoxDangerous);
    formLayout->addRow(labelDangerous);
    formLayout->addRow(checkBoxTargetAsync);
    formLayout->addRow(checkBoxAutoEnrichParameters);
    formLayout->addRow(checkBoxBreakOnWarning);
    formLayout->addRow(checkBoxBreakOnFatal);
    formLayout->addRow(checkBoxBreakOnAbort);
    formLayout->addRow(checkBoxEnableReverseDebugging);
    formLayout->addRow(checkBoxAttemptQuickStart);
    formLayout->addRow(checkBoxMultiInferior);

    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->addWidget(groupBoxDangerous, 0, 0, 2, 1);

    DebuggerCore *dc = debuggerCore();
    group.insert(dc->action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
    group.insert(dc->action(TargetAsync), checkBoxTargetAsync);
    group.insert(dc->action(BreakOnWarning), checkBoxBreakOnWarning);
    group.insert(dc->action(BreakOnFatal), checkBoxBreakOnFatal);
    group.insert(dc->action(BreakOnAbort), checkBoxBreakOnAbort);
    group.insert(dc->action(AttemptQuickStart), checkBoxAttemptQuickStart);
    group.insert(dc->action(MultiInferior), checkBoxMultiInferior);
    group.insert(dc->action(EnableReverseDebugging), checkBoxEnableReverseDebugging);

    const QLatin1Char sep(' ');
    QTextStream(&searchKeywords)
            << sep << groupBoxDangerous->title()
            << sep << checkBoxTargetAsync->text()
            << sep << checkBoxEnableReverseDebugging->text()
            << sep << checkBoxAttemptQuickStart->text()
            << sep << checkBoxMultiInferior->text()
    ;
    searchKeywords.remove(QLatin1Char('&'));
}
コード例 #24
0
itkProcessRegistrationDiffeomorphicDemonsToolBox::itkProcessRegistrationDiffeomorphicDemonsToolBox(QWidget *parent) : medRegistrationAbstractToolBox(parent), d(new itkProcessRegistrationDiffeomorphicDemonsToolBoxPrivate)
{
    QWidget *widget = new QWidget(this);

    QPushButton *runButton = new QPushButton(tr("Run"), this);
    runButton->setToolTip(tr("Start Registration"));

    QFormLayout *layout = new QFormLayout(widget);

    d->iterationsBox = new QLineEdit(this);
    d->iterationsBox->setText("15x10x5");
    d->iterationsBox->setToolTip(tr("Each number of iteration per level must be separated by \"x\". From coarser to finest levels"));

    d->maxStepLengthBox = new QDoubleSpinBox(this);
    d->maxStepLengthBox->setMinimum(0);
    d->maxStepLengthBox->setMaximum(1000);
    d->maxStepLengthBox->setSingleStep(0.01);
    d->maxStepLengthBox->setValue(2.0);
    d->maxStepLengthBox->setToolTip(tr(
                "Maximum length of an update vector (voxel units)."
                " Setting it to 0 implies no restrictions will be made"
                " on the step length."));

    d->updateFieldStdDevBox = new QDoubleSpinBox(this);
    d->updateFieldStdDevBox->setMinimum(0);
    d->updateFieldStdDevBox->setMaximum(1000);
    d->updateFieldStdDevBox->setSingleStep(0.01);
    d->updateFieldStdDevBox->setValue(0.0);
    d->updateFieldStdDevBox->setToolTip(tr(
                "Standard deviation of the Gaussian smoothing"
                "of the update field (voxel units). Setting it below 0.1"
                "means no smoothing will be performed (default 0.0)."));

    d->disFieldStdDevBox = new QDoubleSpinBox(this);
    d->disFieldStdDevBox->setMinimum(0);
    d->disFieldStdDevBox->setMaximum(1000);
    d->disFieldStdDevBox->setSingleStep(0.01);
    d->disFieldStdDevBox->setValue(1.5);
    d->disFieldStdDevBox->setToolTip(tr(
                "Standard deviation of the Gaussian smoothing of "
                "the displacement field (voxel units). Setting it below 0.1 "
                "means no smoothing will be performed (default 1.5)."));
    d->updateRuleBox = new QComboBox(this);
    QStringList updateRules;
    updateRules<< tr("Diffeomorphic") << tr ("Additive") << tr("Compositive");
    d->updateRuleBox->addItems(updateRules);
    //WARNING IF YOU CHANGE THE ORDER OF THE ITEMS, CHANGE TOOLTIPS also!!!
    d->updateRuleBox->setItemData(0,"s <- s o exp(u)",Qt::ToolTipRole);
    d->updateRuleBox->setItemData(1,"s <- s + u",Qt::ToolTipRole);
    d->updateRuleBox->setItemData(2,"s <- s o (Id+u)",Qt::ToolTipRole);

    d->gradientTypeBox = new QComboBox(this);
    d->gradientTypeBox->setToolTip(tr(
                "Type of gradient used for computing the demons force."));
    QStringList gradientTypes;
    gradientTypes<< tr("Symmetrized") << tr ("Fixed Image")
                 << tr("Warped Moving Image")
                 << tr("Mapped Moving Image");
    d->gradientTypeBox->addItems(gradientTypes);
    d->useHistogramBox =  new QCheckBox(this);
    d->useHistogramBox->setChecked(false);
    d->useHistogramBox->setToolTip(tr(
                "Use histogram matching before processing?"));

    this->setTitle("Diffeomorphic Demons");
    layout->addRow(new QLabel(tr("Iterations per level of res."),this),d->iterationsBox);
    layout->addRow(new QLabel(tr("Update Rule"),this),d->updateRuleBox);
    layout->addRow(new QLabel(tr("Gradient Type"),this),d->gradientTypeBox);
    layout->addRow(new QLabel(tr("Max. Update Step Length"),this),d->maxStepLengthBox);
    layout->addRow(new QLabel(tr("Update Field Std. Deviation"),this),
                   d->updateFieldStdDevBox);
    layout->addRow(new QLabel(tr("Displ. Field Std. Deviation"),this),
                   d->disFieldStdDevBox);
    layout->addRow(new QLabel(tr("Histogram Matching"),this),d->useHistogramBox);

    // progression stack
    d->progressionStack = new medProgressionStack(widget);
//    QHBoxLayout *progressStackLayout = new QHBoxLayout;
//    progressStackLayout->addWidget(d->progressionStack);

    this->addWidget(widget);
    this->addWidget(runButton);
    this->addWidget(d->progressionStack);

    //enable about plugin. Constructor called after the plugin has been registered, go ahead call it.
    medPluginManager* pm = medPluginManager::instance();
    dtkPlugin* plugin = pm->plugin(
                "itkProcessRegistrationDiffeomorphicDemonsPlugin");
    setAboutPluginButton(plugin);
    setAboutPluginVisibility(true);

    connect(runButton, SIGNAL(clicked()), this, SLOT(run()));
}
コード例 #25
0
PfPvWindow::PfPvWindow(Context *context) :
    GcChartWindow(context), context(context), current(NULL), compareStale(true)
{
    QWidget *c = new QWidget;
    QVBoxLayout *cl = new QVBoxLayout(c);
    setControls(c);

    //
    // reveal controls widget
    //

    // layout reveal controls
    QHBoxLayout *revealLayout = new QHBoxLayout;
    revealLayout->setContentsMargins(0,0,0,0);

    rShade = new QCheckBox(tr("Shade zones"));
    if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true)
        rShade->setCheckState(Qt::Checked);
    else
        rShade->setCheckState(Qt::Unchecked);
    rMergeInterval = new QCheckBox;
    rMergeInterval->setText(tr("Merge intervals"));
    rMergeInterval->setCheckState(Qt::Unchecked);
    rMergeInterval->hide(); // lets not - its not that useful
    rFrameInterval = new QCheckBox;
    rFrameInterval->setText(tr("Frame intervals"));
    rFrameInterval->setCheckState(Qt::Checked);

    QVBoxLayout *checks = new QVBoxLayout;
    checks->addStretch();
    checks->addWidget(rShade);
    checks->addWidget(rMergeInterval);
    checks->addWidget(rFrameInterval);
    checks->addStretch();

    revealLayout->addStretch();
    revealLayout->addLayout(checks);
    revealLayout->addStretch();

    setRevealLayout(revealLayout);

    // the plot
    QVBoxLayout *vlayout = new QVBoxLayout;
    pfPvPlot = new PfPvPlot(context);
    vlayout->addWidget(pfPvPlot);

    setChartLayout(vlayout);
    setAutoFillBackground(true);

    // allow zooming
    pfpvZoomer = new QwtPlotZoomer(pfPvPlot->canvas());
    pfpvZoomer->setRubberBand(QwtPicker::RectRubberBand);
    pfpvZoomer->setRubberBandPen(GColor(CPLOTSELECT));
    pfpvZoomer->setTrackerMode(QwtPicker::AlwaysOff);
    pfpvZoomer->setEnabled(true);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);

    // double click
    doubleClickPicker = new PfPvDoubleClickPicker(pfPvPlot);

    // the controls
    QFormLayout *f = new QFormLayout;
    cl->addLayout(f);

    QLabel *qaCPLabel = new QLabel(tr("Watts:"), this);
    qaCPValue = new QLineEdit(QString("%1").arg(pfPvPlot->getCP()));
    qaCPValue->setValidator(new QIntValidator(0, 9999, qaCPValue));
    f->addRow(qaCPLabel, qaCPValue);

    QLabel *qaCadLabel = new QLabel(tr("RPM:"), this);
    qaCadValue = new QLineEdit(QString("%1").arg(pfPvPlot->getCAD()));
    qaCadValue->setValidator(new QIntValidator(0, 999, qaCadValue));
    f->addRow(qaCadLabel, qaCadValue);

    QLabel *qaClLabel = new QLabel(tr("Crank Length (m):"), this);
    qaClValue = new QLineEdit(QString("%1").arg(1000 * pfPvPlot->getCL()));
    f->addRow(qaClLabel, qaClValue);

    shadeZonesPfPvCheckBox = new QCheckBox;
    shadeZonesPfPvCheckBox->setText(tr("Shade zones"));
    if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true)
        shadeZonesPfPvCheckBox->setCheckState(Qt::Checked);
    else
        shadeZonesPfPvCheckBox->setCheckState(Qt::Unchecked);
    cl->addWidget(shadeZonesPfPvCheckBox);

    mergeIntervalPfPvCheckBox = new QCheckBox;
    mergeIntervalPfPvCheckBox->setText(tr("Merge intervals"));
    mergeIntervalPfPvCheckBox->setCheckState(Qt::Unchecked);
    cl->addWidget(mergeIntervalPfPvCheckBox);

    frameIntervalPfPvCheckBox = new QCheckBox;
    frameIntervalPfPvCheckBox->setText(tr("Frame intervals"));
    frameIntervalPfPvCheckBox->setCheckState(Qt::Checked);
    cl->addWidget(frameIntervalPfPvCheckBox);
    cl->addStretch();

    connect(pfPvPlot, SIGNAL(changedCP(const QString&)),
            qaCPValue, SLOT(setText(const QString&)) );
    connect(pfPvPlot, SIGNAL(changedCAD(const QString&)),
            qaCadValue, SLOT(setText(const QString&)) );
    connect(pfPvPlot, SIGNAL(changedCL(const QString&)),
            qaClValue, SLOT(setText(const QString&)) );
    connect(qaCPValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCPFromLineEdit()));
    connect(qaCadValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCADFromLineEdit()));
    connect(qaClValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCLFromLineEdit()));
    connect(shadeZonesPfPvCheckBox, SIGNAL(stateChanged(int)),
            this, SLOT(setShadeZonesPfPvFromCheckBox()));
    connect(rShade, SIGNAL(stateChanged(int)),
            this, SLOT(setrShadeZonesPfPvFromCheckBox()));
    connect(mergeIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
                this, SLOT(setMergeIntervalsPfPvFromCheckBox()));
    connect(rMergeInterval, SIGNAL(stateChanged(int)),
                this, SLOT(setrMergeIntervalsPfPvFromCheckBox()));
    connect(frameIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
                this, SLOT(setFrameIntervalsPfPvFromCheckBox()));
    connect(rFrameInterval, SIGNAL(stateChanged(int)),
                this, SLOT(setrFrameIntervalsPfPvFromCheckBox()));
    connect(doubleClickPicker, SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClicked(int, int)));

    // GC signals
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    connect(context, SIGNAL(intervalsChanged()), this, SLOT(intervalSelected()));
    connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(zonesChanged()));
    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(context, SIGNAL(configChanged()), pfPvPlot, SLOT(configChanged()));

    // comparing things
    connect(context, SIGNAL(compareIntervalsStateChanged(bool)), this, SLOT(compareChanged()));
    connect(context, SIGNAL(compareIntervalsChanged()), this, SLOT(compareChanged()));

    configChanged();
}
コード例 #26
0
//-------------------------------------------------------------------------------------------------
ExchangeRate::ExchangeRate() : QWidget(),
    nam(new QNetworkAccessManager(this)),
    iPrecision(2),
    bUseProxy(false),
    bProxyIsSocks(false),
    iPort(3128),
    bAuth(false),
    dMaxSum(100000000000000000000.05)
{
    const QString strAppName = qAppName(),
            strAppDir = qApp->applicationDirPath();
    strAppStg = strAppDir + '/' + strAppName + ".ini";
    QTranslator *translator = new QTranslator(this);
    if (translator->load(strAppName, strAppDir) || translator->load(strAppName + '_' + QLocale::system().name(), strAppDir))
        qApp->installTranslator(translator);

    leUah = new QLineEdit(this);
    QVBoxLayout *vblSpacing = new QVBoxLayout;
    vblSpacing->addSpacing(15);
    leUsd = new QLineEdit(this);
    leEur = new QLineEdit(this);
    leRub = new QLineEdit(this);
    gbMain = new QGroupBox(this);
    gbMain->setEnabled(false);
    QFormLayout *frml = new QFormLayout(gbMain);
    frml->addRow("UAH:", leUah);
    frml->addRow(vblSpacing);
    frml->addRow("USD:", leUsd);
    frml->addRow("EUR:", leEur);
    frml->addRow("RUB:", leRub);

    QPushButton *pbUpdate = new QPushButton(style()->standardIcon(QStyle::SP_BrowserReload), tr("Update"), this);
    lblInfo = new QLabel(this);
    QFont fontSaved = lblInfo->font();
    fontSaved.setItalic(true);
    lblInfo->setFont(fontSaved);
    QHBoxLayout *hblUpdate = new QHBoxLayout;
    hblUpdate->setContentsMargins(0, 0, 0, 0);
    hblUpdate->addWidget(pbUpdate);
    hblUpdate->addWidget(lblInfo);
    lblNote = new QLabel("?\n1 USD = ?\n1 EUR = ?\n1 UAH = ?", this);
    QGroupBox *gbNote = new QGroupBox(this);
    gbNote->setMinimumWidth(170);
    QVBoxLayout *vbNote = new QVBoxLayout(gbNote);
    vbNote->addLayout(hblUpdate);
    vbNote->addWidget(lblNote);

    QLabel *lblVer = new QLabel(cFullVersion, this);
    QPushButton *pbSettings = new QPushButton(style()->standardIcon(QStyle::SP_FileDialogDetailedView), 0, this);
    QHBoxLayout *hblBottom = new QHBoxLayout;
    hblBottom->addStretch();
    hblBottom->addWidget(lblVer);
    hblBottom->addWidget(pbSettings);
    QVBoxLayout *vblRight = new QVBoxLayout;
    vblRight->addWidget(gbNote);
    vblRight->addLayout(hblBottom, Qt::AlignRight);

    QHBoxLayout *hblMain = new QHBoxLayout(this);
    hblMain->addWidget(gbMain);
    hblMain->addLayout(vblRight);

    this->setMaximumHeight(this->minimumSizeHint().height());

    //connects
    connect(leUah, SIGNAL(textEdited(QString)), this, SLOT(slotFromUah(QString)));
    connect(leUsd, SIGNAL(textEdited(QString)), this, SLOT(slotFromUsd(QString)));
    connect(leEur, SIGNAL(textEdited(QString)), this, SLOT(slotFromEur(QString)));
    connect(leRub, SIGNAL(textEdited(QString)), this, SLOT(slotFromRub(QString)));
    connect(pbUpdate, SIGNAL(clicked()), this, SLOT(slotUpdate()));
    connect(pbSettings, SIGNAL(clicked()), this, SLOT(slotShowSettings()));
    connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotReplyFin(QNetworkReply*)));

    //settings
    QSettings stg(strAppStg, QSettings::IniFormat);
    stg.setIniCodec("UTF-8");
    if (stg.childGroups().contains("Settings"))
    {
        stg.beginGroup("Settings");
        const QString strDate = stg.value("DateTime").toString();
        if (QDateTime::fromString(strDate, "dd.MM.yyyy").isValid() &&
                (dUahPerUsd = stg.value("USD").toDouble()) > 3.0 && dUahPerUsd < 80.0 &&
                (dUahPerEur = stg.value("EUR").toDouble()) > 3.0 && dUahPerEur < 80.0 &&
                (dUahPerRub = stg.value("RUB").toDouble()) > 0.1 && dUahPerRub < 1.0)
        {
            lblNote->setText(strDate +
                             "\n1 USD = " + QString::number(dUahPerUsd, 'f', 6) +
                             " UAH\n1 EUR = " + QString::number(dUahPerEur, 'f', 6) +
                             " UAH\n1 UAH = " + QString::number(1.0/dUahPerRub, 'f', 6) +
                             " RUB");
            gbMain->setEnabled(true);
        }
        int iTemp = stg.value("Precision", -1).toInt();
        if (iTemp >= 0 && iTemp <= 10)
            iPrecision = iTemp;
        if (stg.value("UseProxy").toString() == "1")
            bUseProxy = true;
        if (stg.value("ProxyType") == "SOCKS5")
            bProxyIsSocks = true;
        strServer = stg.value("Server").toString();
        iTemp = stg.value("Port").toInt();
        if (iTemp > 0 && iTemp <= 65535)
            iPort = iTemp;
        if (stg.value("Auth").toString() == "1")
            bAuth = true;
        strUser = stg.value("User").toString();
        strPassword = stg.value("Password").toString();
        stg.endGroup();

        if (bUseProxy)
        {
            QNetworkProxy netProxy(bProxyIsSocks ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy, strServer, iPort);
            if (bAuth)
            {
                netProxy.setUser(strUser);
                netProxy.setPassword(strPassword);
            }
            nam->setProxy(netProxy);
        }
    }

    this->restoreGeometry(QSettings("UserPrograms", strAppName).value("Geometry").toByteArray());
}
コード例 #27
0
void TeamView::init()
{
  if(team)
  {
    QFormLayout* layout = new QFormLayout();
    QHBoxLayout* settingsGrid = new QHBoxLayout();
    settingsGrid->setSpacing(6);
    settingsGrid->setAlignment(Qt::AlignmentFlag::AlignLeft);

    pbSave = new QPushButton(QIcon(":icons/disk.png"), "");
    pbSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
    pbSave->setToolTip("Save Team Configuration");
    settingsGrid->addWidget(pbSave);
    connect(pbSave, SIGNAL(clicked()), teamSelector, SLOT(saveTeams()));

    cbColor = new QComboBox(this);
    cbColor->addItem("red");
    cbColor->addItem("blue");
    cbColor->addItem("yellow");
    cbColor->addItem("black");
    cbColor->addItem("white");
    cbColor->addItem("green");
    cbColor->addItem("orange");
    cbColor->addItem("purple");
    cbColor->addItem("brown");
    cbColor->addItem("gray");
    cbColor->setCurrentIndex(cbColor->findText(fromString(team->color)));
    settingsGrid->addWidget(new QLabel("<b>Color:</b>", cbColor));
    settingsGrid->addWidget(cbColor);
    connect(cbColor, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(colorChanged(const QString&)));

    sbNumber = new QSpinBox(this);
    sbNumber->setRange(1, 99);
    sbNumber->setButtonSymbols(QAbstractSpinBox::NoButtons);
    sbNumber->setMaximumWidth(18);
    sbNumber->setValue(team->number);
    settingsGrid->addWidget(new QLabel("<b>Number:</b>", sbNumber));
    settingsGrid->addWidget(sbNumber);
    connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(numberChanged(int)));

    cbLocation = new QComboBox(this);
    std::vector<std::string> locations = Filesystem::getLocations();
    for(size_t i = 0; i < locations.size(); ++i)
      cbLocation->addItem(fromString(locations[i]));
    cbLocation->setCurrentIndex(cbLocation->findText(fromString(team->location)));
    settingsGrid->addWidget(new QLabel("<b>Location:</b>", lePort));
    settingsGrid->addWidget(cbLocation);
    connect(cbLocation, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(locationChanged(const QString&)));

    cbWlanConfig = new QComboBox(this);
    std::vector<std::string> configs = Filesystem::getWlanConfigs();
    for(size_t i = 0; i < configs.size(); ++i)
      cbWlanConfig->addItem(fromString(configs[i]));
    cbWlanConfig->setCurrentIndex(cbWlanConfig->findText(fromString(team->wlanConfig)));
    settingsGrid->addWidget(new QLabel("<b>Wlan:<b/>", cbWlanConfig));
    settingsGrid->addWidget(cbWlanConfig);
    connect(cbWlanConfig, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(wlanConfigChanged(const QString&)));

    cbBuildConfig = new QComboBox(this);
    cbBuildConfig->addItem("Develop");
    cbBuildConfig->addItem("Release");
    cbBuildConfig->addItem("Debug");
    cbBuildConfig->setCurrentIndex(cbBuildConfig->findText(fromString(team->buildConfig)));
    settingsGrid->addWidget(new QLabel("<b>Conf:</b>", cbBuildConfig));
    settingsGrid->addWidget(cbBuildConfig);
    connect(cbBuildConfig, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(buildConfigChanged(const QString&)));

    sVolume = new QSlider(this);
    sVolume->setMinimum(0);
    sVolume->setMaximum(100);
    sVolume->setTickInterval(1);
    sVolume->setValue(team->volume);
    settingsGrid->addWidget(new QLabel("<b>Vol:</b>", sVolume));
    settingsGrid->addWidget(sVolume);
    connect(sVolume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(const int)));

    settingsGrid->addStretch();

    cbDeployDevice = new QComboBox(this);
    cbDeployDevice->addItem("auto");
    cbDeployDevice->addItem("lan");
    cbDeployDevice->addItem("wlan");
    cbDeployDevice->setCurrentIndex(cbDeployDevice->findText(fromString(team->deployDevice)));
    settingsGrid->addWidget(new QLabel("<b>Device:</b>", cbDeployDevice));
    settingsGrid->addWidget(cbDeployDevice);
    connect(cbDeployDevice, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(deployDeviceChanged(const QString&)));

    sbMagic = new QSpinBox(this);
    sbMagic->setRange(-1, 255);
    sbMagic->setButtonSymbols(QAbstractSpinBox::NoButtons);
    sbMagic->setMaximumWidth(23);
    sbMagic->setValue(team->magicNumber);
    settingsGrid->addWidget(new QLabel("<b>Magic Number:</b>", sbMagic));
    settingsGrid->addWidget(sbMagic);
    connect(sbMagic, SIGNAL(valueChanged(int)), this, SLOT(magicNumberChanged(int)));

    layout->addRow(settingsGrid);

    QFrame* hr = new QFrame(this);
    hr->setFrameStyle(QFrame::Sunken | QFrame::HLine);
    QLabel* players = new QLabel("<b>Players</b>");
    layout->addRow(players, hr);
    layout->setAlignment(hr, Qt::AlignVCenter);

    QGridLayout* teamGrid = new QGridLayout();
    generateRobotViews(teamGrid);
    layout->addRow(teamGrid);

    setLayout(layout);
  }
}
コード例 #28
0
ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
    GcWindow(parent), home(home), main(parent), ride(NULL), current(NULL)
{
    setInstanceName("3D Window");

    QWidget *c = new QWidget;
    QFormLayout *cl = new QFormLayout(c);
    setControls(c);

    // hidden text when plot invalid
    nodata = new QLabel(tr("No data or bin size too large."), this);
    nodata->hide();

    // the plot widget
    QHBoxLayout *mainLayout = new QHBoxLayout;
    modelPlot= new ModelPlot(main, NULL);
    zpane = new QSlider(Qt::Vertical);
    zpane->setTickInterval(1);
    zpane->setMinimum(0);
    zpane->setMaximum(100);
    zpane->setValue(0);
    mainLayout->addWidget(zpane);
    mainLayout->addWidget(modelPlot);
    mainLayout->addWidget(nodata);
    setLayout(mainLayout);

    // preset Values
    presetLabel = new QLabel(tr("Analyse"), this);
    presetValues = new QComboBox;
    fillPresets(presetValues);
    presetValues->setCurrentIndex(1);
    cl->addRow(presetLabel, presetValues);

    // labels
    xLabel = new QLabel(tr("X-Axis:"), this);
    xSelector = new QComboBox;
    addStandardChannels(xSelector);
    xSelector->setCurrentIndex(0); // power
    cl->addRow(xLabel, xSelector);

    yLabel = new QLabel(tr("Y-Axis:"), this);
    ySelector = new QComboBox;
    addStandardChannels(ySelector);
    ySelector->setCurrentIndex(1); // cadence
    cl->addRow(yLabel, ySelector);

    zLabel = new QLabel(tr("Z-Axis:"), this);
    zSelector = new QComboBox;
    addStandardChannels(zSelector);
    zSelector->addItem(tr("Time at X&Y"), MODEL_XYTIME);
    zSelector->setCurrentIndex(12); // time at xy
    cl->addRow(zLabel, zSelector);

    colorLabel = new QLabel(tr("Color:"), this);
    colorSelector = new QComboBox;
    addStandardChannels(colorSelector);
    colorSelector->addItem(tr("Power Zone"), MODEL_POWERZONE);
    colorSelector->addItem(tr("Time at X&Y"), MODEL_XYTIME);
    colorSelector->setCurrentIndex(12); // power zone
    cl->addRow(colorLabel, colorSelector);

    binLabel = new QLabel(tr("Bin Width:"), this);
    binWidthLineEdit = new QLineEdit(this);
    binWidthLineEdit->setFixedWidth(30);
    binWidthLineEdit->setText("5");
    cl->addRow(binLabel, binWidthLineEdit);

    binWidthSlider = new QSlider(Qt::Horizontal);
    binWidthSlider->setTickPosition(QSlider::TicksBelow);
    binWidthSlider->setTickInterval(1);
    binWidthSlider->setMinimum(3);
    binWidthSlider->setMaximum(100);
    binWidthSlider->setValue(5);
    cl->addRow(binWidthSlider);

    // selectors
    styleSelector = new QComboBox;
    styleSelector->addItem(tr("Bar"));
    styleSelector->addItem(tr("Grid"));
    styleSelector->addItem(tr("Surface"));
    styleSelector->addItem(tr("Dots"));
    styleSelector->setCurrentIndex(0);
    cl->addRow(styleSelector);

    ignore = new QCheckBox(tr("Ignore Zero"));
    ignore->setChecked(true);
    cl->addRow(ignore);

    grid = new QCheckBox(tr("Show Grid"));
    grid->setChecked(true);
    cl->addRow(grid);

    frame = new QCheckBox(tr("Frame Intervals"));
    frame->setChecked(true);
    cl->addRow(frame);

    legend = new QCheckBox(tr("Legend"));
    legend->setChecked(true);
    cl->addRow(legend);

    resetView = new QPushButton(tr("Reset View"));
    cl->addRow(resetView);

    // now connect up the widgets
    //connect(main, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(main, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    connect(presetValues, SIGNAL(currentIndexChanged(int)), this, SLOT(applyPreset(int)));
    connect(xSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(ySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(zSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(colorSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirty()));
    connect(grid, SIGNAL(stateChanged(int)), this, SLOT(setGrid()));
    connect(legend, SIGNAL(stateChanged(int)), this, SLOT(setLegend()));
    connect(frame, SIGNAL(stateChanged(int)), this, SLOT(setFrame()));
    connect(styleSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(styleSelected(int)));
    connect(ignore, SIGNAL(stateChanged(int)), this, SLOT(setDirty()));
    connect(binWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(setBinWidthFromSlider()));
    connect(binWidthLineEdit, SIGNAL(editingFinished()), this, SLOT(setBinWidthFromLineEdit()));
    connect(resetView, SIGNAL(clicked()), this, SLOT(resetViewPoint()));
    connect(zpane, SIGNAL(valueChanged(int)), this, SLOT(setZPane(int)));
}
コード例 #29
0
FancyPlotterSettings::FancyPlotterSettings( QWidget* parent, bool locked )
  : KPageDialog( parent ), mModel( new SensorModel( this ) )
{
  setFaceType( Tabbed );
  setCaption( i18n( "Plotter Settings" ) );
  setButtons( Ok | Apply | Cancel );
  setObjectName( "FancyPlotterSettings" );
  setModal( false );

  QFrame *page = 0;
  QGridLayout *pageLayout = 0;
  QGridLayout *boxLayout = 0;
  QGroupBox *groupBox = 0;
  QLabel *label = 0;

  // Style page
  page = new QFrame();
  addPage( page, i18n( "General" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  label = new QLabel( i18n( "Title:" ), page );
  pageLayout->addWidget( label, 0, 0 );

  mTitle = new KLineEdit( page );
  mTitle->setWhatsThis( i18n( "Enter the title of the display here." ) );
  pageLayout->addWidget( mTitle, 0, 1 );
  label->setBuddy( mTitle );

  mStackBeams = new QCheckBox( i18n("Stack the beams on top of each other"), page);
  mStackBeams->setWhatsThis( i18n("The beams are stacked on top of each other, and the area is drawn filled in. So if one beam has a value of 2 and another beam has a value of 3, the first beam will be drawn at value 2 and the other beam drawn at 2+3=5.") );
  pageLayout->addWidget( mStackBeams, 1, 0,1,2);

  pageLayout->setRowStretch( 2, 1 );

  // Scales page
  page = new QFrame();
  addPage( page, i18n( "Scales" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  groupBox = new QGroupBox( i18n( "Vertical scale" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 2, 1 );

  mManualRange = new QCheckBox( i18n( "Specify graph range:" ), groupBox );
  mManualRange->setWhatsThis( i18n( "Check this box if you want the display range to adapt dynamically to the currently displayed values; if you do not check this, you have to specify the range you want in the fields below." ) );
  mManualRange->setChecked(true);
  boxLayout->addWidget( mManualRange, 0, 0, 1, 5 );

  mMinValueLabel = new QLabel( i18n( "Minimum value:" ), groupBox );
  boxLayout->addWidget( mMinValueLabel, 1, 0 );

  mMinValue = new QDoubleSpinBox( groupBox );
  mMinValue->setMaximum( std::numeric_limits<long long>::max());
  mMinValue->setMinimum( std::numeric_limits<long long>::min());
  mMinValue->setWhatsThis( i18n( "Enter the minimum value for the display here." ) );
  mMinValue->setSingleStep(10);
  boxLayout->addWidget( mMinValue, 1, 1 );
  mMinValueLabel->setBuddy( mMinValue );

  mMaxValueLabel = new QLabel( i18n( "Maximum value:" ), groupBox );
  boxLayout->addWidget( mMaxValueLabel, 1, 3 );

  mMaxValue = new QDoubleSpinBox( groupBox);
  mMaxValue->setMaximum( std::numeric_limits<long long>::max());
  mMaxValue->setMinimum( std::numeric_limits<long long>::min());
  mMaxValue->setWhatsThis( i18n( "Enter the soft maximum value for the display here. The upper range will not be reduced below this value, but will still go above this number for values above this value." ) );
  mMaxValue->setSingleStep(10);
  boxLayout->addWidget( mMaxValue, 1, 4 );
  mMaxValueLabel->setBuddy( mMaxValue );

  pageLayout->addWidget( groupBox, 0, 0 );

  groupBox = new QGroupBox( i18n( "Horizontal scale" ), page );
  QFormLayout *formLayout = new QFormLayout(groupBox);

  mHorizontalScale = new KIntNumInput( 1, groupBox );
  mHorizontalScale->setMinimum( 1 );
  mHorizontalScale->setMaximum( 50 );

  formLayout->addRow( i18n("Pixels per time period:"), mHorizontalScale );


  pageLayout->addWidget( groupBox, 1, 0 );

  // Grid page
  page = new QFrame( );
  addPage( page, i18n( "Grid" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  groupBox = new QGroupBox( i18n( "Lines" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 1, 1 );

  mShowVerticalLines = new QCheckBox( i18n( "Vertical lines" ), groupBox );
  mShowVerticalLines->setWhatsThis( i18n( "Check this to activate the vertical lines if display is large enough." ) );
  boxLayout->addWidget( mShowVerticalLines, 0, 0 );

  label = new QLabel( i18n( "Distance:" ), groupBox );
  boxLayout->addWidget( label, 0, 2 );

  mVerticalLinesDistance = new KIntNumInput( 0, groupBox );
  mVerticalLinesDistance->setMinimum( 10 );
  mVerticalLinesDistance->setMaximum( 120 );
  mVerticalLinesDistance->setWhatsThis( i18n( "Enter the distance between two vertical lines here." ) );
  boxLayout->addWidget( mVerticalLinesDistance , 0, 3 );
  label->setBuddy( mVerticalLinesDistance );

  mVerticalLinesScroll = new QCheckBox( i18n( "Vertical lines scroll" ), groupBox );
  boxLayout->addWidget( mVerticalLinesScroll, 1, 0, 1, -1 );

  mShowHorizontalLines = new QCheckBox( i18n( "Horizontal lines" ), groupBox );
  mShowHorizontalLines->setWhatsThis( i18n( "Check this to enable horizontal lines if display is large enough." ) );
  boxLayout->addWidget( mShowHorizontalLines, 2, 0, 1, -1 );

  pageLayout->addWidget( groupBox, 0, 0, 1, 2 );

  groupBox = new QGroupBox( i18n( "Text" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 1, 1 );

  mShowAxis = new QCheckBox( i18n( "Show axis labels" ), groupBox );
  mShowAxis->setWhatsThis( i18n( "Check this box if horizontal lines should be decorated with the values they mark." ) );
  boxLayout->addWidget( mShowAxis, 0, 0, 1, -1 );

  label = new QLabel( i18n( "Font size:" ), groupBox );
  boxLayout->addWidget( label, 1, 0 );

  mFontSize = new KIntNumInput( 8, groupBox );
  mFontSize->setMinimum( 1 );
  mFontSize->setMaximum( 1000 );
  boxLayout->addWidget( mFontSize, 1, 1 );
  label->setBuddy( mFontSize );

  pageLayout->addWidget( groupBox, 1, 0 );

  pageLayout->setRowStretch( 2, 1 );

  // Sensors page
  page = new QFrame( );
  addPage( page, i18n( "Sensors" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );
  pageLayout->setRowStretch( 2, 1 );
  pageLayout->setRowStretch( 5, 1 );

  mView = new QTreeView( page );
  mView->header()->setStretchLastSection( false );
  mView->setRootIsDecorated( false );
  mView->setItemsExpandable( false );
  mView->setModel( mModel );
  mView->header()->setResizeMode(QHeaderView::ResizeToContents);
  bool hideFirstColumn = true;
  for(int i = 0; i < mModel->rowCount(); i++)
    if(mModel->data(mModel->index(i, 0)) != "localhost") {
      hideFirstColumn = false;
      break;
    }
  if(hideFirstColumn)
    mView->hideColumn(0);

  pageLayout->addWidget( mView, 0, 0, 6, 1 );
  connect(mView,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editSensor()));

  mEditButton = new QPushButton( i18n( "Set Color..." ), page );
  mEditButton->setWhatsThis( i18n( "Push this button to configure the color of the sensor in the diagram." ) );
  pageLayout->addWidget( mEditButton, 0, 1 );

  mRemoveButton = 0;
  mMoveUpButton = 0;
  mMoveDownButton = 0;
  if ( !locked ) {
    mRemoveButton = new QPushButton( i18n( "Delete" ), page );
    mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) );
    pageLayout->addWidget( mRemoveButton, 1, 1 );
    connect( mRemoveButton, SIGNAL(clicked()), SLOT(removeSensor()) );

    mMoveUpButton = new QPushButton( i18n( "Move Up" ), page );
    mMoveUpButton->setEnabled( false );
    pageLayout->addWidget( mMoveUpButton, 2, 1 );
    connect( mMoveUpButton, SIGNAL(clicked()), SLOT(moveUpSensor()) );

    mMoveDownButton = new QPushButton( i18n( "Move Down" ), page );
    mMoveDownButton->setEnabled( false );
    pageLayout->addWidget( mMoveDownButton, 3, 1 );
    connect( mMoveDownButton, SIGNAL(clicked()), SLOT(moveDownSensor()) );

    connect(mView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectionChanged(QModelIndex)));

  }

  connect( mManualRange, SIGNAL(toggled(bool)), mMinValue,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMaxValue,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMinValueLabel,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMaxValueLabel,
           SLOT(setEnabled(bool)) );

  connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesDistance,
           SLOT(setEnabled(bool)) );
  connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesScroll,
           SLOT(setEnabled(bool)) );

  connect( mEditButton, SIGNAL(clicked()), SLOT(editSensor()) );

  KAcceleratorManager::manage( this );
}
コード例 #30
0
ファイル: StoreStreamDlg.cpp プロジェクト: Syntro/SyntroCore
void StoreStreamDlg::layoutWidgets()
{
	QFormLayout *formLayout = new QFormLayout;

	QHBoxLayout *e = new QHBoxLayout;
	e->addStretch();
	formLayout->addRow(new QLabel("Store stream"), e);

	m_formatCombo = new QComboBox;
	m_formatCombo->addItem("Structured [srf])");
	m_formatCombo->addItem("Raw [raw]");
	m_formatCombo->setEditable(false);
	QHBoxLayout *a = new QHBoxLayout;
	a->addWidget(m_formatCombo);
	a->addStretch();
	formLayout->addRow(new QLabel("Store format"), a);

	m_streamName = new QLineEdit;
	m_streamName->setMinimumWidth(200);
	m_streamName->setValidator(&m_validator);
	formLayout->addRow(new QLabel("Stream path"), m_streamName);

	m_storePath = new StoreLabel("");
	m_storePath->setMinimumWidth(320);
	formLayout->addRow(new QLabel("Store path"), m_storePath);

	m_subFolderCheck = new QCheckBox;
	formLayout->addRow(new QLabel("Create subfolder"), m_subFolderCheck);

	m_rotationPolicy = new QComboBox;
	m_rotationPolicy->addItem(SYNTROSTORE_PARAMS_ROTATION_POLICY_TIME);
	m_rotationPolicy->addItem(SYNTROSTORE_PARAMS_ROTATION_POLICY_SIZE);
	m_rotationPolicy->addItem(SYNTROSTORE_PARAMS_ROTATION_POLICY_ANY);
	m_rotationPolicy->setEditable(false);
	QHBoxLayout *b = new QHBoxLayout;
	b->addWidget(m_rotationPolicy);
	b->addStretch();
	formLayout->addRow(new QLabel("Rotation policy"), b);

	m_rotationTimeUnits = new QComboBox;
	m_rotationTimeUnits->addItem(SYNTROSTORE_PARAMS_ROTATION_TIME_UNITS_MINUTES);
	m_rotationTimeUnits->addItem(SYNTROSTORE_PARAMS_ROTATION_TIME_UNITS_HOURS);
	m_rotationTimeUnits->setEditable(false);
	QHBoxLayout *c = new QHBoxLayout;
	c->addWidget(m_rotationTimeUnits);
	c->addStretch();
	formLayout->addRow(new QLabel("Rotation time units"), c);
		
	m_rotationTime = new QLineEdit;
	m_rotationTime->setMaximumWidth(100);
	formLayout->addRow(new QLabel("Rotation time"), m_rotationTime);

	m_rotationSize = new QLineEdit;
	m_rotationSize->setMaximumWidth(100);
	formLayout->addRow(new QLabel("Rotation size (MB)"), m_rotationSize);

	QHBoxLayout *buttonLayout = new QHBoxLayout;

	m_okButton = new QPushButton("Ok");
	m_cancelButton = new QPushButton("Cancel");

	buttonLayout->addStretch();
	buttonLayout->addWidget(m_okButton);
	buttonLayout->addWidget(m_cancelButton);
	buttonLayout->addStretch();

	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	mainLayout->addLayout(formLayout);
	mainLayout->addSpacing(20);
	mainLayout->addLayout(buttonLayout);
	setLayout(mainLayout);

	setWindowTitle("Configure entry");
}