コード例 #1
0
QblDesktopWizardPage_CreateIdentity::QblDesktopWizardPage_CreateIdentity(QWidget *parent)
    : QWizardPage(parent){
    this->setTitle("Identity");
    this->setSubTitle("Create a new identity");
    aliasLabel = new QLabel("Alias:");
    aliasLineEdit = new QLineEdit();
    inboxLabel = new QLabel("Inbox:");
    inboxLineEdit = new QLineEdit();
    privateKeyLabel = new QLabel("Private key:");
    privateKeyLineEdit = new QLineEdit();
    publicKeyLabel = new QLabel("Public key:");
    publicKeyLineEdit = new QLineEdit();
    generateKeyPairPushButton = new QPushButton("Generate key pair");
    connect (generateKeyPairPushButton, SIGNAL(clicked()), this, SLOT(generateKeyPairPushButtonClicked()));
    QFormLayout *layout = new QFormLayout();
    QGroupBox *groupBox = new QGroupBox("Key pair");
    QVBoxLayout *groupBoxLayout = new QVBoxLayout();
    groupBoxLayout->addWidget(privateKeyLabel);
    groupBoxLayout->addWidget(privateKeyLineEdit);
    groupBoxLayout->addWidget(publicKeyLabel);
    groupBoxLayout->addWidget(publicKeyLineEdit);
    groupBoxLayout->addWidget(generateKeyPairPushButton);
    groupBox->setLayout(groupBoxLayout);
    layout->addWidget(aliasLabel);
    layout->addWidget(aliasLineEdit);
    layout->addWidget(inboxLabel);
    layout->addWidget(inboxLineEdit);
    layout->addWidget(groupBox);
    setLayout(layout);
    this->registerField("alias", aliasLineEdit);
    this->registerField("privateKey", privateKeyLineEdit);
    this->registerField("publicKey", publicKeyLineEdit);
    this->registerField("inbox", inboxLineEdit);
    return;
}
コード例 #2
0
TimelineWidget::TimelineWidget(QWidget *parent) :
    QWidget(parent)
{
    this->setWindowTitle("Timeline");
    this->setWindowIcon(QIcon(":/resources/icons/resources/timeline.png"));

    QFormLayout* propertiesLayout = new QFormLayout(this);
    propertiesLayout->setContentsMargins(2, 2, 2, 2);

    QHBoxLayout* nameLayout = new QHBoxLayout();
    QLabel* nameLabel = new QLabel("Name: ", this);
    QLineEdit* nameEdit = new QLineEdit("tml_0", this);
    nameLayout->addWidget(nameLabel);
    nameLayout->addWidget(nameEdit);
    propertiesLayout->addItem(nameLayout);

    editButton = new QPushButton("Edit", this);
    propertiesLayout->addWidget(editButton);

    QGridLayout* momButtonsLayout = new QGridLayout();
    addButton = new QPushButton("Add", this);
    momButtonsLayout->addWidget(addButton, 0, 0);
    changeButton = new QPushButton("Change", this);
    momButtonsLayout->addWidget(changeButton, 0, 1);
    deleteButton = new QPushButton("Delete", this);
    momButtonsLayout->addWidget(deleteButton, 1, 0);
    duplicateButton = new QPushButton("Duplicate", this);
    momButtonsLayout->addWidget(duplicateButton, 1, 1);
    shiftButton = new QPushButton("Shift", this);
    momButtonsLayout->addWidget(shiftButton, 2, 0);
    mergeButton = new QPushButton("Merge", this);
    momButtonsLayout->addWidget(mergeButton, 2, 1);
    propertiesLayout->addItem(momButtonsLayout);

    clearButton = new QPushButton("Clear", this);
    propertiesLayout->addWidget(clearButton);
    infoButton = new QPushButton("Information", this);
    infoButton->setIcon(QIcon(":/resources/icons/resources/info.png"));
    propertiesLayout->addWidget(infoButton);
    saveButton = new QPushButton("Save", this);
    saveButton->setIcon(QIcon(":/icons/actions/accept.png"));
    propertiesLayout->addWidget(saveButton);

    QTreeWidget* momentsTree = new QTreeWidget(this);
    momentsTree->setHeaderLabel("Moments");

    QSplitter* horizontalSplitter = new QSplitter();
    QWidget* propertiesWidget = new QWidget(this, Qt::WindowTitleHint);
    propertiesWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    propertiesWidget->setLayout(propertiesLayout);
    horizontalSplitter->addWidget(propertiesWidget);
    horizontalSplitter->addWidget(momentsTree);

    QVBoxLayout* timelineLayout = new QVBoxLayout();
    timelineLayout->setContentsMargins(2, 2, 2, 2);
    timelineLayout->addWidget(horizontalSplitter);

    this->setLayout(timelineLayout);
}
コード例 #3
0
CConfigWidget::CConfigWidget(const char *proptab, QWidget *parent,
                             Qt::WindowFlags flags) : QWidget(parent, flags)
{
    QFormLayout *form = new QFormLayout(this);
    
    NLua::CLuaTable tab(proptab);
    if (tab)
    {
        std::string var;
        const int size = tab.Size();
        for (int i=1; i<=size; i++)
        {
            NLua::CLuaTable vtab;
            tab[i] >> vtab;

            std::string type;
            vtab["type"] >> type;

            CBaseConfValue *confValue = NULL;
            if (type == "string")
                confValue = new CStringConfValue(vtab);
            else if (type == "choice")
                confValue = new CChoiceConfValue(vtab);
            else if (type == "multichoice")
                confValue = new CMultiChoiceConfValue(vtab);
            else if (type == "boolean")
                confValue = new CBoolConfValue(vtab);
            else if (type == "file")
                confValue = new CFileConfValue(vtab);
            else if (type == "unopts")
                confValue = new CUnOptsConfValue(vtab);

            if (confValue)
            {
                connect(confValue, SIGNAL(confValueChanged(NLua::CLuaTable &)),
                        this, SLOT(valueChangedCB(NLua::CLuaTable &)));
                std::string name;
                vtab["name"] >> name;

                // Big widgets
                if (type == "unopts")
                {
                    // Put label above
                    form->addWidget(new QLabel(name.c_str()));
                    form->addWidget(confValue);
                }
                else
                    form->addRow(name.c_str(), confValue);
                
                valueWidgetList.push_back(confValue);
            }
        }
    }
}
コード例 #4
0
void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth)
{
    QDialog* dialog = new QDialog(p_QupZilla);
    dialog->setWindowTitle(tr("Proxy authorization required"));

    QFormLayout* formLa = new QFormLayout(dialog);

    QLabel* label = new QLabel(dialog);
    QLabel* userLab = new QLabel(dialog);
    QLabel* passLab = new QLabel(dialog);
    userLab->setText(tr("Username: "******"Password: "******"A username and password are being requested by proxy %1. ").arg(proxy.hostName()));
    formLa->addRow(label);
    formLa->addRow(userLab, user);
    formLa->addRow(passLab, pass);
    formLa->addWidget(box);

    if (!dialog->exec() == QDialog::Accepted) {
        return;
    }
    auth->setUser(user->text());
    auth->setPassword(pass->text());
}
コード例 #5
0
ファイル: userdialog.cpp プロジェクト: aalhamad/clinic
void UserDialog::setupLayout()
{
    okButton = new QPushButton(tr("&OK"));
    cancelButton = new QPushButton(tr("&Cancel"));
    buttonBox = new QDialogButtonBox;

    buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole);
    buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole);

    usernameLineEdit = new QLineEdit;
    emailLineEdit = new QLineEdit;
    passwordLineEdit = new QLineEdit;
    passwordConfirmationLineEdit = new QLineEdit;

    passwordLineEdit->setEchoMode(QLineEdit::Password);
    passwordConfirmationLineEdit->setEchoMode(QLineEdit::Password);

    rolesCombobox = new QComboBox;

    QString asterisk = "<i style=color:red>*</i>";
    passwordLabel = new QLabel(tr("Password: "******"Password Confirmation: ") + asterisk);

    QFormLayout *formLayout = new QFormLayout;
    formLayout->addRow(tr("&Username: "******"&Email:"), emailLineEdit);
    formLayout->addRow(passwordLabel, passwordLineEdit);
    formLayout->addRow(passwordConfirmationLabel, passwordConfirmationLineEdit);
    formLayout->addRow(tr("&Role: "), rolesCombobox);
    formLayout->addWidget(buttonBox);

    setLayout(formLayout);
}
コード例 #6
0
ファイル: settingsdialog.cpp プロジェクト: marxoft/cutenews
void SettingsDialog::showGeneralTab() {
    if (!m_generalTab) {
        m_generalTab = new QWidget(m_stack);
        m_downloadsCheckBox = new QCheckBox(tr("Start downloads &automatically"), m_generalTab);
        m_downloadsCheckBox->setChecked(Settings::startTransfersAutomatically());
        m_downloadPathEdit = new QLineEdit(Settings::downloadPath(), m_generalTab);
        m_downloadPathButton = new QPushButton(QIcon::fromTheme("document-open"), tr("Browse"), m_generalTab);
        m_expirySpinBox = new QSpinBox(m_generalTab);
        m_expirySpinBox->setSuffix(tr(" day(s)"));
        m_expirySpinBox->setRange(-1, 90);
        m_expirySpinBox->setValue(Settings::readArticleExpiry());
        m_downloadsSpinBox = new QSpinBox(m_generalTab);
        m_downloadsSpinBox->setRange(1, MAX_CONCURRENT_TRANSFERS);
        m_downloadsSpinBox->setValue(Settings::maximumConcurrentTransfers());
        
        QFormLayout *form = new QFormLayout(m_generalTab);
        form->addRow(tr("&Delete read articles older than (-1 to disable):"), m_expirySpinBox);
        form->addRow(tr("Download &path:"), m_downloadPathEdit);
        form->addWidget(m_downloadPathButton);
        form->addRow(tr("&Maximum concurrent downloads:"), m_downloadsSpinBox);
        form->addRow(m_downloadsCheckBox);

        connect(m_expirySpinBox, SIGNAL(valueChanged(int)), Settings::instance(), SLOT(setReadArticleExpiry(int)));
        connect(m_downloadsCheckBox, SIGNAL(toggled(bool)),
                Settings::instance(), SLOT(setStartTransfersAutomatically(bool)));
        connect(m_downloadPathEdit, SIGNAL(textChanged(QString)), Settings::instance(), SLOT(setDownloadPath(QString)));
        connect(m_downloadPathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
        connect(m_downloadsSpinBox, SIGNAL(valueChanged(int)),
                Settings::instance(), SLOT(setMaximumConcurrentTransfers(int)));
        
        m_stack->addWidget(m_generalTab);
    }
    
    m_stack->setCurrentWidget(m_generalTab);
}
コード例 #7
0
QWidget *InputCreator::setupLogTab() {
	QWidget *tab = new QWidget();
	
	QFormLayout *layout = new QFormLayout();
	
	QHBoxLayout *selectionLayout = new QHBoxLayout();
	
	m_fileLocation = new QLabel(tr("Not selected."));
	selectionLayout->addWidget(m_fileLocation);
	
	QPushButton *selectFile = new QPushButton(style()->standardIcon(QStyle::SP_DirOpenIcon), tr(""));
	selectionLayout->addWidget(selectFile);
	connect(selectFile, SIGNAL(clicked()), this, SLOT(fileSelected()));
	
	layout->addRow(tr("File location:"), selectionLayout);
	
	m_logCreateButton = new QPushButton(tr("&Open log"));
	m_logCreateButton->setDisabled(true);
	layout->addWidget(m_logCreateButton);
	connect(m_logCreateButton, SIGNAL(clicked()), this, SLOT(createLogInput()));
	
	tab->setLayout(layout);
	
	return tab;
}
コード例 #8
0
CWindowAlarm::CWindowAlarm(QWidget *parent, Qt::WindowFlags flags)
{
	//Groupe de la liste des alarmes
	formGroupBox = new QGroupBox(tr("Alarmes"));
	listWidget = new QListWidget();
	QFormLayout *formLayout = new QFormLayout(formGroupBox);
	formLayout->addWidget(listWidget);
	formGroupBox->setLayout(formLayout);
	
	//Groupe du bouton close
	btClose = new QPushButton("Close");
	btAcquitter = new QPushButton("Acquitter");
	verticalGroupBox = new QGroupBox(tr("Actions"));
	QHBoxLayout *HBoxLayout = new QHBoxLayout(verticalGroupBox);
	HBoxLayout->addWidget(btClose);
	HBoxLayout->addWidget(btAcquitter);

	verticalGroupBox->setLayout(HBoxLayout);


	mainLayout = new QGridLayout(this);
	//this->setLayout(mainLayout);

	mainLayout->addWidget(formGroupBox,0,0);
	mainLayout->addWidget(verticalGroupBox,1,0);
	mainLayout->setRowStretch ( 0, 90 );
	mainLayout->setRowStretch ( 1, 10 );
	//mainLayout->setColumnStretch( 1, 10 );

	setConnections();

}
コード例 #9
0
void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
{
    QDialog* dialog = new QDialog(p_QupZilla);
    dialog->setWindowTitle(tr("Authorization required"));

    QFormLayout* formLa = new QFormLayout(dialog);

    QLabel* label = new QLabel(dialog);
    QLabel* userLab = new QLabel(dialog);
    QLabel* passLab = new QLabel(dialog);
    userLab->setText(tr("Username: "******"Password: "******"Save username and password on this site"));
    pass->setEchoMode(QLineEdit::Password);

    QDialogButtonBox* box = new QDialogButtonBox(dialog);
    box->addButton(QDialogButtonBox::Ok);
    box->addButton(QDialogButtonBox::Cancel);
    connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
    connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));

    label->setText(tr("A username and password are being requested by %1. "
                      "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm())));
    formLa->addRow(label);

    formLa->addRow(userLab, user);
    formLa->addRow(passLab, pass);
    formLa->addRow(save);

    formLa->addWidget(box);
    AutoFillModel* fill = mApp->autoFill();
    if (fill->isStored(reply->url())) {
        save->setChecked(true);
        user->setText(fill->getUsername(reply->url()));
        pass->setText(fill->getPassword(reply->url()));
    }
    emit wantsFocus(reply->url());

    //Do not save when private browsing is enabled
    if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
        save->setVisible(false);
    }

    if (dialog->exec() != QDialog::Accepted) {
        return;
    }

    auth->setUser(user->text());
    auth->setPassword(pass->text());

    if (save->isChecked()) {
        fill->addEntry(reply->url(), user->text(), pass->text());
    }
}
コード例 #10
0
ファイル: alert.cpp プロジェクト: ferries/booker
Alert::Alert(QWidget *parent) : QWidget(parent) {

	// Set an alert?
	enableAlert = new QCheckBox("Enable Alert");
	connect(enableAlert, SIGNAL(toggled(bool)), this, SLOT(enabledToggle(bool)));

	editDate = new DateEdit(140,"ddd, dd MMM yyyy");
	editDate->setEnabled(false);
	editDate->setMinimumDate(QDate::currentDate());
	editTime = new Clock;
	editTime->setTime(QTime::currentTime());
	editTime->setEnabled(false);
	QHBoxLayout *editTimeLay = new QHBoxLayout;
	editTimeLay->addWidget(editDate);
	editTimeLay->addWidget(editTime);

	// Edit the text to be displayed
	textEdit = new QPlainTextEdit;
	textEdit->setEnabled(false);
	textEdit->setFixedSize(250,100);

	// Some labels
	date = new QLabel("Date:");
	date->setEnabled(false);
	time = new QLabel("Time:");
	time->setEnabled(false);
	text = new QLabel("Text:");
	text->setEnabled(false);

	// Option to mark an alert as completed (only shown when editing a booking)
	completedText = new QPlainTextEdit;
	completedText->setEnabled(false);
	completedText->setFixedSize(250,75);
	completedText->hide();
	completed = new QCheckBox("Completed");
	completed->setEnabled(false);
	completed->hide();
	connect(completed, SIGNAL(toggled(bool)), completedText, SLOT(setEnabled(bool)));

	QFormLayout *lay = new QFormLayout;
	lay->addWidget(enableAlert);
	lay->addRow(time,editTimeLay);
	lay->addRow(text,textEdit);
	lay->addRow("",completed);
	lay->addRow("",completedText);

	this->setLayout(lay);

	this->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Expanding);


	connect(enableAlert, SIGNAL(clicked()), this, SLOT(sendDataChanged()));
	connect(editDate, SIGNAL(dateChanged(QDate)), this, SLOT(sendDataChanged()));
	connect(editTime, SIGNAL(timeChanged(QTime)), this, SLOT(sendDataChanged()));
	connect(textEdit, SIGNAL(textChanged()), this, SLOT(sendDataChanged()));
	connect(completedText, SIGNAL(textChanged()), this, SLOT(sendDataChanged()));

}
コード例 #11
0
AntiDosWindow::AntiDosWindow(QSettings &settings) : settings(settings)
{
    setAttribute(Qt::WA_DeleteOnClose, true);

    QFormLayout *mylayout = new QFormLayout(this);

    QSpinBox *mppip = new QSpinBox();
    mppip->setRange(1,8);
    mppip->setValue(settings.value("AntiDOS/MaxPeoplePerIp").toInt());
    mylayout->addRow(tr("Max number of people connected with the same ip"), mppip);

    QSpinBox *mcpus = new QSpinBox();
    mcpus->setRange(15,150);
    mcpus->setValue(settings.value("AntiDOS/MaxCommandsPerUser").toInt());
    mylayout->addRow(tr("Max number of times someone is active within a minute"), mcpus);

    QSpinBox *mkbpus = new QSpinBox();
    mkbpus->setRange(5,150);
    mkbpus->setValue(settings.value("AntiDOS/MaxKBPerUser").toInt());
    mkbpus->setSuffix(" kB");
    mylayout->addRow(tr("Maximum upload from user per minute"), mkbpus);

    QSpinBox *mlpip = new QSpinBox();
    mlpip->setRange(2,30);
    mlpip->setValue(settings.value("AntiDOS/MaxConnectionRatePerIP").toInt());
    mylayout->addRow(tr("Max number of times the same ip attempts to log in per minute"), mlpip);

    QSpinBox *baxk = new QSpinBox();
    baxk->setRange(1,30);
    baxk->setValue(settings.value("AntiDOS/NumberOfInfractionsBeforeBan").toInt());
    mylayout->addRow(tr("Bans after X antidos kicks per 15 minutes"), baxk);

    trusted_ips = new QLineEdit();
    trusted_ips->setText(settings.value("AntiDOS/TrustedIps").toString());
    mylayout->addRow(tr("Trusted IPs (separated by comma)"),trusted_ips);

    notificationsChannel = new QLineEdit(settings.value("AntiDOS/NotificationsChannel").toString());
    mylayout->addRow(tr("Channel in which to display overactive messages: "), notificationsChannel);

    QCheckBox *aDosOn = new QCheckBox(tr("Turn AntiDos ON"));
    aDosOn->setChecked(!settings.value("AntiDOS/Disabled").toBool());
    mylayout->addWidget(aDosOn);

    QPushButton *ok = new QPushButton("&Apply");
    QPushButton *cancel = new QPushButton("&Cancel");

    mylayout->addRow(ok, cancel);

    connect(cancel, SIGNAL(clicked()), SLOT(close()));
    connect(ok, SIGNAL(clicked()), SLOT(apply()));

    max_people_per_ip = mppip;
    max_commands_per_user = mcpus;
    max_kb_per_user = mkbpus;
    max_login_per_ip = mlpip;
    ban_after_x_kicks = baxk;
    this->aDosOn = aDosOn;
}
コード例 #12
0
ファイル: app.cpp プロジェクト: mariusadam/dictionary-mvc-cpp
void App::__initComponents() {
	QWidget* mainWidget = new QWidget(this);
	QGridLayout* mainLayout = new QGridLayout(mainWidget);
	
	mainWidget->setLayout(mainLayout);

	this->setCentralWidget(mainWidget);
	
	this->__cuvinteListWidget = new QListWidget;
	this->__nrCuvinteLabel = new QLabel;

	this->__explicatiiListWidget = new QListWidget;
	this->__nrExplicatiiLabel = new QLabel;

	QWidget* formWidget = new QWidget;
	QFormLayout* formLayout = new QFormLayout(formWidget);
	this->__cuvantLineEdit = new QLineEdit;
	formLayout->addRow(QString("Cuvant"), this->__cuvantLineEdit);
	this->__explicatieLineEdit = new QLineEdit;
	formLayout->addRow(QString("Explicatie"), this->__explicatieLineEdit);
	
	QHBoxLayout* layoutAddButtons = new QHBoxLayout;
	this->__addCuvantButton = new QPushButton("Adauga cuvant nou");
	this->__addExplicatieButton = new QPushButton("Adauga explicatie");
	layoutAddButtons->addWidget(this->__addCuvantButton);
	layoutAddButtons->addWidget(this->__addExplicatieButton);

	formLayout->addRow(layoutAddButtons);

	QVBoxLayout* layoutUpdateDeleteButton = new QVBoxLayout;
	this->__updateExplicatieButton = new QPushButton("Actualizeaza explicatie");
	this->__deleteCuvantButton = new QPushButton("Sterge cuvantul din dictionar");
	this->__deleteExplicatieButton = new QPushButton("Sterge explicatie");
	layoutUpdateDeleteButton->addWidget(this->__updateExplicatieButton);
	layoutUpdateDeleteButton->addWidget(this->__deleteCuvantButton);
	layoutUpdateDeleteButton->addWidget(this->__deleteExplicatieButton);

	QWidget* searchFormWidget = new QWidget;
	QFormLayout* searchLayout = new QFormLayout(searchFormWidget);;
	this->__searchButton = new QPushButton("Cauta cuvinte");
	this->__searchLineEdit = new QLineEdit;
	searchLayout->addRow(QString("Cauta dupa"), this->__searchLineEdit);
	searchLayout->addWidget(this->__searchButton);

	this->__refreshButton = new QPushButton("Reimprospatare lista");
	this->__quitButton = new QPushButton("Iesire");

	mainLayout->addWidget(this->__nrCuvinteLabel, 0, 0);
	mainLayout->addWidget(this->__cuvinteListWidget, 1, 0);
	mainLayout->addWidget(this->__nrExplicatiiLabel, 0, 1);
	mainLayout->addWidget(this->__explicatiiListWidget, 1, 1);
	mainLayout->addWidget(formWidget, 2, 0);
	mainLayout->addLayout(layoutUpdateDeleteButton, 2, 1);
	mainLayout->addWidget(searchFormWidget, 3, 0);
	mainLayout->addWidget(this->__refreshButton, 3, 1);
	mainLayout->addWidget(this->__quitButton, 4, 1);
}
コード例 #13
0
ファイル: bookmarkwidget.cpp プロジェクト: vhonsel/rekonq
BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
        : QMenu(parent)
        , m_bookmark(new KBookmark(bookmark))
{
    setAttribute(Qt::WA_DeleteOnClose);
    setFixedWidth(350);

    QFormLayout *layout = new QFormLayout(this);

    // Bookmark icon
    QHBoxLayout *hLayout = new QHBoxLayout(this);
    QLabel *bookmarkIcon = new QLabel(this);
    bookmarkIcon->setPixmap(KIcon("bookmarks").pixmap(32, 32));
    hLayout->setSpacing(10);
    hLayout->addWidget(bookmarkIcon);

    // Title
    QVBoxLayout *vLayout = new QVBoxLayout(this);
    QLabel *bookmarkInfo = new QLabel(this);
    bookmarkInfo->setText(i18n("<h4>Edit this Bookmark</h4>"));
    bookmarkInfo->setAlignment(Qt::AlignCenter);
    vLayout->addWidget(bookmarkInfo);

    // Remove button
    QPushButton *removeButton = new QPushButton(this);
    removeButton->setText(i18n("Remove this Bookmark"));
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
    vLayout->addWidget(removeButton);

    hLayout->addLayout(vLayout);
    layout->addItem(hLayout);

    // Bookmark name
    QLabel *nameLabel = new QLabel(this);
    nameLabel->setText(i18n("Name:"));
    m_name = new KLineEdit(this);
    if (m_bookmark->isNull())
    {
        m_name->setEnabled(false);
    }
    else
    {
        m_name->setText(m_bookmark->text());
        m_name->setFocus();
    }
    layout->addRow(nameLabel, m_name);

    // Ok & Cancel buttons
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
    layout->addWidget(buttonBox);

    setLayout(layout);
}
コード例 #14
0
medPacsSelector::medPacsSelector( QWidget *parent /*= 0*/ ): d(new medToolBoxPacsSelectorPrivate)
{
    d->selectionList = new QListWidget(this);

    QFormLayout* fLayout = new QFormLayout(this);
    fLayout->addWidget(d->selectionList);

    connect(d->selectionList, SIGNAL(itemClicked(QListWidgetItem* )), this, SLOT(emitSelectionChanged()));

    readSettings();
}
コード例 #15
0
BattleLogsWidget::BattleLogsWidget(BattleLogs *master)
{
    this->master = master;

    QFormLayout *f = new QFormLayout(this);

    f->addRow("Tiers to be logged (input nothing to log all tiers)", tiers = new QTextEdit());
    f->addWidget(mixedTiers = new QCheckBox("Save battles between different tiers"));
    f->addWidget(rawFile = new QCheckBox("Save raw binary logs"));
    f->addWidget(textFile = new QCheckBox("Save html logs"));

    mixedTiers->setChecked(master->saveMixedTiers);
    rawFile->setChecked(master->saveRawFiles);
    textFile->setChecked(master->saveTextFiles);

    tiers->setText(QStringList(master->tiers.toList()).join(", "));

    QPushButton *button = new QPushButton("Done");
    f->addRow(NULL, button);

    connect(button, SIGNAL(clicked()), SLOT(done()));
}
コード例 #16
0
ファイル: abbreviationinputdialog.cpp プロジェクト: KDE/kile
AbbreviationInputDialog::AbbreviationInputDialog(KileWidget::AbbreviationView *listview, QTreeWidgetItem *item, int mode, const char *name)
	: QDialog(listview)
	, m_listview(listview)
	, m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
	, m_abbrevItem(item)
	, m_mode(mode)
{
	setWindowTitle(i18n("Add Abbreviation"));
	setModal(true);
	setObjectName(name);
	setMinimumWidth(350);

	QFormLayout *mainLayout = new QFormLayout;
	setLayout(mainLayout);

	if(m_mode == KileWidget::AbbreviationView::ALVedit) {
		setWindowTitle( i18n("Edit Abbreviation") );
		m_abbrev = m_abbrevItem->text(KileWidget::AbbreviationView::ALVabbrev);
		m_expansion = m_abbrevItem->text(KileWidget::AbbreviationView::ALVexpansion);
	}

	m_leAbbrev = new QLineEdit(m_abbrev, this);
	m_leExpansion = new QLineEdit(m_expansion, this);
	QLabel *labelAbbreviation = new QLabel(i18n("&Abbreviation:"), this);
	labelAbbreviation->setBuddy(m_leAbbrev);
	QLabel *labelExpanded = new QLabel(i18n("&Expanded Text:"), this);
	labelExpanded->setBuddy(m_leExpansion);

	mainLayout->addRow(labelAbbreviation, m_leAbbrev);
	mainLayout->addRow(labelExpanded, m_leExpansion);

	QRegExp reg("[a-zA-Z0-9]+");
	QRegExpValidator *abbrevValidator = new QRegExpValidator(reg, this);
	m_leAbbrev->setValidator(abbrevValidator);

	connect(m_leAbbrev, &QLineEdit::textChanged, this, &AbbreviationInputDialog::onTextChanged);
	connect(m_leExpansion, &QLineEdit::textChanged, this, &AbbreviationInputDialog::onTextChanged);

	onTextChanged(QString());
	m_leAbbrev->setFocus();

	QPushButton *okButton = m_buttonBox->button(QDialogButtonBox::Ok);
	okButton->setDefault(true);
	okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
	connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
	connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
	mainLayout->addWidget(m_buttonBox);
	okButton->setDefault(true);
}
コード例 #17
0
ファイル: userfiles.cpp プロジェクト: Schwarzenegger/SDsy
void UserFiles::createNewDir()
{
    QDialog *createDialog = new QDialog;
    QFormLayout *createLayout = new QFormLayout;
    QPushButton *enterButton = new QPushButton("Criar");

    createLayout->addRow(("&Nome:"),newDirName);

    createLayout->addWidget(enterButton);
    createDialog->setLayout(createLayout);

    connect(enterButton,SIGNAL(clicked()),this,SLOT(sendNewDir()));
    connect(enterButton,SIGNAL(clicked()),createDialog,SLOT(close()));

    createDialog->exec();
}
コード例 #18
0
ファイル: networkmanager.cpp プロジェクト: spaeps/qupzilla
void NetworkManager::proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent)
{
    const QNetworkProxy proxy = QNetworkProxy::applicationProxy();
    if (!proxy.user().isEmpty() && !proxy.password().isEmpty()) {
        auth->setUser(proxy.user());
        auth->setPassword(proxy.password());
        return;
    }

    QDialog* dialog = new QDialog(parent);
    dialog->setWindowTitle(tr("Proxy authorisation required"));

    QFormLayout* formLa = new QFormLayout(dialog);

    QLabel* label = new QLabel(dialog);
    QLabel* userLab = new QLabel(dialog);
    QLabel* passLab = new QLabel(dialog);
    userLab->setText(tr("Username: "******"Password: "******"A username and password are being requested by proxy %1. ").arg(proxyHost));
    formLa->addRow(label);
    formLa->addRow(userLab, user);
    formLa->addRow(passLab, pass);
    formLa->addWidget(box);

    if (dialog->exec() != QDialog::Accepted) {
        *auth = QAuthenticator();
        delete dialog;
        return;
    }

    auth->setUser(user->text());
    auth->setPassword(pass->text());

    delete dialog;
}
コード例 #19
0
void PropertyWidgetBuilder::visitAdvancedList(AdvancedListProperty & property)
{
    QComboBox * comboBox = new QComboBox(m_active_widget);
    comboBox->addItems(property.choices());

    m_active_layout->addRow(property.description(), comboBox);
    
    QStackedWidget * groupBoxesStack = new QStackedWidget(m_active_widget);
    m_active_layout->addRow(groupBoxesStack);

    for (PropertyList * propertyList : property.propertyLists()) {
        QGroupBox * groupBox = new QGroupBox(m_active_widget);
        groupBox->setAlignment(Qt::AlignVCenter);
        QFormLayout * groupboxlayout = new QFormLayout(groupBox);
        
        if (propertyList->isEmpty()) {
            QLabel * label = new QLabel("No Properties to display", groupBox);
            label->setAlignment(Qt::AlignCenter);
            groupboxlayout->addWidget(label);
        }
        
        
        QWidget * former_active_widget = m_active_widget;
        QFormLayout * former_active_layout = m_active_layout;
        
        m_active_widget = groupBox;
        m_active_layout = groupboxlayout;
        
        this->iterateOverProperties(propertyList->list());
        
        m_active_widget = former_active_widget;
        m_active_layout = former_active_layout;
        
        groupBoxesStack->addWidget(groupBox);
    }

    QObject::connect(comboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
        [&property, groupBoxesStack] (const QString & text) {
            property.select(text);
            groupBoxesStack->setCurrentIndex(property.selection());
        
            qDebug("Set Property %s = \"%s\"",
                   qPrintable(property.name()),
                   qPrintable(property.selectedChoice()));
        }
    );
}
コード例 #20
0
ファイル: dialog.cpp プロジェクト: Chebotarev/ECS40_Project6
void Dialog::createInitialPopulationForm()
{
    form_group_box = new QGroupBox(tr("Initial Populations (millions):"));
        QFormLayout *layout = new QFormLayout;


    for(int i = 0; i < NumberofSpecies; i++)
    {
        input_labels[i] = new QLabel(tr("Species %1 : ").arg(i + 1));
        line_edits[i] = new QLineEdit;
        line_edits[i]->setValidator(new QIntValidator);
        layout->addRow(input_labels[i], line_edits[i]);
    }

    start_sim = new QPushButton("Start Simulation");
        connect(start_sim, SIGNAL(clicked()), this, SLOT(startSimulation()));

    layout->addWidget(start_sim);
    form_group_box->setLayout(layout);
}
コード例 #21
0
ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool change)
    : QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
{
    QFormLayout *fl = new QFormLayout;
    this->setLayout(fl);

    QLabel *label = new QLabel(this);
    label->setWordWrap(true);
    if (change)
        label->setText(tr("Please enter the directory in which you want to build your project. "));
    else
        label->setText(tr("Please enter the directory in which you want to build your project. "
                          "Qt Creator recommends to not use the source directory for building. "
                          "This ensures that the source directory remains clean and enables multiple builds "
                          "with different settings."));
    fl->addWidget(label);
    m_pc = new Utils::PathChooser(this);
    m_pc->setPath(m_cmakeWizard->buildDirectory());
    connect(m_pc, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
    fl->addRow(tr("Build directory:"), m_pc);
}
コード例 #22
0
/////////////////////////
// BuildPathPage class
/////////////////////////
BuildPathPage::BuildPathPage(AutotoolsOpenProjectWizard *wizard)
    : QWizardPage(wizard), m_wizard(wizard)
{
    QFormLayout *fl = new QFormLayout;
    this->setLayout(fl);

    QLabel *label = new QLabel(this);
    label->setWordWrap(true);
    label->setText(tr("Please enter the directory in which you want to build your project. "
                      "Qt Creator recommends to not use the source directory for building. "
                      "This ensures that the source directory remains clean and enables multiple builds "
                      "with different settings."));
    fl->addWidget(label);
    m_pc = new Utils::PathChooser(this);
    m_pc->setHistoryCompleter(QLatin1String("AutoTools.BuildDir.History"));
    m_pc->setBaseDirectory(m_wizard->sourceDirectory());
    m_pc->setPath(m_wizard->buildDirectory());
    connect(m_pc, &Utils::PathChooser::rawPathChanged, this, &BuildPathPage::buildDirectoryChanged);
    fl->addRow(tr("Build directory:"), m_pc);
    setTitle(tr("Build Location"));
}
コード例 #23
0
void GPxiBasicAnalogInput::PopulateDeviceWidget(GDeviceWidget* theDeviceWidget )
{
	theDeviceWidget->DontDisplayTitle();
	// The spin box holding the value 
	QWidget* pSpinBox = m_Value.ProvideNewParamSpinBox(theDeviceWidget);

	// Button to access the settings
	QPushButton* pSettingButton = new QPushButton("set...", theDeviceWidget);
	pSettingButton->setMaximumSize(pSpinBox->sizeHint());
//2011-11-22	connect(pSettingButton, SIGNAL(pressed()), m_pDataLogger, SLOT(show()));

	// A QFormLayout, in which we place the label and the spinbox associated with the GParam
	QFormLayout* valueLayout = new QFormLayout();
	theDeviceWidget->AddSubLayout(valueLayout);
	QLabel* nameLabel = m_Value.ProvideNewLabel(theDeviceWidget);
	valueLayout->addRow(nameLabel, pSpinBox);

	QFormLayout* settingLayout = new QFormLayout();
	theDeviceWidget->AddSubLayout(settingLayout);
	settingLayout->addWidget(pSettingButton);

//	UpdateFromPhysicalInput();
}
コード例 #24
0
ファイル: lights_menu.cpp プロジェクト: Leopardob/como
LightsMenu::LightsMenu( LocalLightsSelection* lights ) :
    QFrame(),
    lights_( lights )
{
    // Create the widgets for modifying light properties.
    QFormLayout* layout = new QFormLayout();
    layout->setRowWrapPolicy( QFormLayout::WrapAllRows );
    lightColorButton_ = new ColorButton( QColor( 255, 0, 0, 255 ) );
    lightAmbientCoefficientSpinBox_ = new QDoubleSpinBox;
    lightAmbientCoefficientSpinBox_->setRange( 0.0f, 1.0f );
    lightAmbientCoefficientSpinBox_->setSingleStep( 0.01f );
    lightAmbientCoefficientSpinBox_->setValue( 0.05f );

    // Set this panel's layout.
    layout->addWidget( new QLabel( "Lights panel" ) );
    layout->addRow( "Light color", lightColorButton_ );
    layout->addRow( "Ambient coefficient", lightAmbientCoefficientSpinBox_ );
    setLayout( layout );

    // Connect the signals emitted when user changes a material parameter to
    // the corresponding methods which change those parameters.
    QObject::connect( lightColorButton_, &ColorButton::colorChanged, [=]( Color color )
    {
        lights_->setLightColor( color );
    });

    void (QDoubleSpinBox::*ambientCoefficientChangeSignal)( double ) = &QDoubleSpinBox::valueChanged;
    QObject::connect( lightAmbientCoefficientSpinBox_, ambientCoefficientChangeSignal, [this]( double value ){
        lights_->setAmbientCoefficient( static_cast< float >( value ) );
    } );

    // Initially there is no light selected, so make this panel no visible.
    setVisible( false );

    lights_->Observable::addObserver( this );
}
コード例 #25
0
/**
 * Setup the layout of the widget
 */
void SettingsWidget::setupLayout()
{
    QGroupBox *sampleRateControlGroup = new QGroupBox("Sample rate");
    QGroupBox *sourceControlGroup = new QGroupBox("Source");
    QGroupBox *captureSettingsGroup = new QGroupBox("ECG capture settings");

    QLabel *sampleFreqNote = new QLabel("NOTE: some frames are dropped at 2000 Hz.");
    QLabel *fileNameLabel = new QLabel("Filename: ");
    QLabel *nameLabel = new QLabel("Name: ");
    QLabel *recordingNameLabel = new QLabel("Recording name: ");
    QLabel *genderLabel = new QLabel("Gender: ");
    QLabel *birthdateLabel = new QLabel("Birth date: ");
    QLabel *patientCodeLabel = new QLabel("Patient code: ");
    QLabel *notesLabel = new QLabel("Notes: ");
    QLabel *saveAsEDFLabel = new QLabel("Save as EDF: ");

    //The ECG capture settings options layout
    QFormLayout *captureSettingsLayout = new QFormLayout;
    captureSettingsLayout->addRow(fileNameLabel, fileNameTextBox);
    captureSettingsLayout->addRow(nameLabel, nameTextBox);
    captureSettingsLayout->addRow(recordingNameLabel, recordingNameTextBox);
    captureSettingsLayout->addRow(genderLabel, genderTextBox);
    captureSettingsLayout->addRow(birthdateLabel, birthdateTextBox);
    captureSettingsLayout->addRow(patientCodeLabel, patientCodeTextBox);
    captureSettingsLayout->addRow(notesLabel, notesTextBox);
    captureSettingsLayout->addRow(saveAsEDFLabel, saveAsEDFCheckbox);
    captureSettingsLayout->addWidget(applyCaptureSettingsButton);

    captureSettingsGroup->setLayout(captureSettingsLayout);

    //Source control layout
    QVBoxLayout *sourceControlLayout = new QVBoxLayout;

    sourceControlLayout->addWidget(ecgSource);
    sourceControlLayout->addWidget(sin10Source);
    sourceControlLayout->addWidget(sin150Source);
    sourceControlLayout->addWidget(squareSource);
    sourceControlLayout->addWidget(ecgMockSource);

    sourceControlGroup->setLayout(sourceControlLayout);

    //Sample rate layout
    QVBoxLayout *sampleRateControlLayout = new QVBoxLayout;
    sampleRateControlLayout->addWidget(lowSampleRate);
    sampleRateControlLayout->addWidget(midSampleRate);
    sampleRateControlLayout->addWidget(highSampleRate);
    sampleRateControlLayout->addWidget(sampleFreqNote);

    sampleRateControlGroup->setLayout(sampleRateControlLayout);

    //Main layout
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(sourceControlGroup);
    mainLayout->addStretch();
    mainLayout->addWidget(sampleRateControlGroup);
    mainLayout->addStretch();
    mainLayout->addWidget(captureSettingsGroup);
    mainLayout->addStretch();

    setLayout(mainLayout);
}
コード例 #26
0
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, bool rangemode) :
    GcWindow(parent), _dateRange("{00000000-0000-0000-0000-000000000001}"), home(home), mainWindow(parent), currentRide(NULL), rangemode(rangemode), stale(true), useCustom(false)
{
    setInstanceName("Critical Power Window");

    // main plot area
    QVBoxLayout *vlayout = new QVBoxLayout;
    cpintPlot = new CpintPlot(mainWindow, home.path(), mainWindow->zones());
    vlayout->addWidget(cpintPlot);
    setLayout(vlayout);

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

#ifdef GC_HAVE_LUCENE
    // searchbox
    searchBox = new SearchFilterBox(this, parent);
    connect(searchBox, SIGNAL(searchClear()), cpintPlot, SLOT(clearFilter()));
    connect(searchBox, SIGNAL(searchResults(QStringList)), cpintPlot, SLOT(setFilter(QStringList)));
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(filterChanged()));
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(filterChanged()));
    cl->addRow(new QLabel(tr("Filter")), searchBox);
    cl->addWidget(new QLabel("")); //spacing
#endif

    // picker details
    QLabel *cpintTimeLabel = new QLabel(tr("Duration:"), this);
    cpintTimeValue = new QLineEdit("0 s");
    QLabel *cpintTodayLabel = new QLabel(tr("Today:"), this);
    cpintTodayValue = new QLabel(tr("no data"));
    QLabel *cpintAllLabel = new QLabel(tr("Best:"), this);
    cpintAllValue = new QLabel(tr("no data"));
    QLabel *cpintCPLabel = new QLabel(tr("CP Curve:"), this);
    cpintCPValue = new QLabel(tr("no data"));

    //QFontMetrics metrics(QApplication::font());
    //int width = metrics.width("8888 watts (88/88/8888)") + 10;
    //cpintAllValue->setFixedWidth(width);
    //cpintCPValue->setFixedWidth(width); // so lines up nicely

    cpintTimeValue->setReadOnly(false);
    //cpintTodayValue->setReadOnly(true);
    //cpintAllValue->setReadOnly(true);
    //cpintCPValue->setReadOnly(true);

    QFont font = cpintTimeValue->font();
    font.setPointSize(font.pointSize());
    cpintTodayValue->setFont(font);
    cpintAllValue->setFont(font);
    cpintCPValue->setFont(font);

    cl->addRow(cpintTimeLabel, cpintTimeValue);
    cl->addRow(cpintTodayLabel, cpintTodayValue);
    cl->addRow(cpintAllLabel, cpintAllValue);
    cl->addRow(cpintCPLabel, cpintCPValue);
    cl->addWidget(new QLabel("")); //spacing

    // tools /properties
    seriesCombo = new QComboBox(this);
    addSeries();
    cComboSeason = new QComboBox(this);
    seasons = parent->seasons;
    resetSeasons();
    QLabel *label = new QLabel(tr("Date range"));
    QLabel *label2 = new QLabel(tr("Date range"));
    if (rangemode) {
        cComboSeason->hide();
        label2->hide();
    }

    cpintSetCPButton = new QPushButton(tr("&Save CP value"), this);
    cpintSetCPButton->setEnabled(false);
    cl->addRow(label2, cComboSeason);

    dateSetting = new DateSettingsEdit(this);
    cl->addRow(label, dateSetting);

    if (rangemode == false) {
        dateSetting->hide();
        label->hide();
    }

    cl->addWidget(new QLabel("")); //spacing
    cl->addRow(new QLabel(tr("Data series")), seriesCombo);
    cl->addRow(new QLabel(""), cpintSetCPButton);

    picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                               QwtPicker::VLineRubberBand,
                               QwtPicker::AlwaysOff, cpintPlot->canvas());
    picker->setStateMachine(new QwtPickerDragPointMachine);
    picker->setRubberBandPen(GColor(CPLOTTRACKER));

    connect(picker, SIGNAL(moved(const QPoint &)), SLOT(pickerMoved(const QPoint &)));
    connect(cpintTimeValue, SIGNAL(editingFinished()), this, SLOT(cpintTimeValueEntered()));
    connect(cpintSetCPButton, SIGNAL(clicked()), this, SLOT(cpintSetCPButtonClicked()));
    if (rangemode) {
        connect(this, SIGNAL(dateRangeChanged(DateRange)), SLOT(dateRangeChanged(DateRange)));
    } else {
        connect(cComboSeason, SIGNAL(currentIndexChanged(int)), this, SLOT(seasonSelected(int)));
    }

    connect(seriesCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setSeries(int)));
    //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(mainWindow, SIGNAL(configChanged()), cpintPlot, SLOT(configChanged()));

    // redraw on config change -- this seems the simplest approach
    connect(mainWindow, SIGNAL(configChanged()), this, SLOT(rideSelected()));
    connect(mainWindow, SIGNAL(rideAdded(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
    connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
    connect(seasons, SIGNAL(seasonsChanged()), this, SLOT(resetSeasons()));

    connect(dateSetting, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange)));
    connect(dateSetting, SIGNAL(useThruToday()), this, SLOT(useThruToday()));
    connect(dateSetting, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
}
コード例 #27
0
ファイル: settingspagetask.cpp プロジェクト: Exadios/Cumulus
SettingsPageTask::SettingsPageTask( QWidget *parent) :
  QWidget( parent ),
  m_selectedSwitchScheme(0),
  m_distUnit(Distance::getUnit()),
  m_startLineValue(0),
  m_startRingValue(0),
  m_startSectorInnerRadiusValue(0),
  m_startSectorOuterRadiusValue(0),
  m_startSectorAngleValue(0),
  m_finishLineValue(0),
  m_finishRingValue(0),
  m_finishSectorInnerRadiusValue(0),
  m_finishSectorOuterRadiusValue(0),
  m_finishSectorAngleValue(0),
  m_obsCircleRadiusValue(0),
  m_obsSectorInnerRadiusValue(0),
  m_obsSectorOuterRadiusValue(0),
  m_obsSectorAngleValue(0)
{
  setObjectName("SettingsPageTask");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Task") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal );

  GeneralConfig *conf = GeneralConfig::instance();
  int row = 0;

  QGridLayout *topLayout = new QGridLayout(sw);
  //contentLayout->addLayout(topLayout);

  topLayout->setMargin(10);
  topLayout->setSpacing(20);
  topLayout->setColumnStretch( 3, 5 );

  //---------------------------------------------------------------
  QGroupBox *ssBox = new QGroupBox( tr("Switch Scheme"), this );
  topLayout->addWidget( ssBox, row, 0 );

  ntScheme = new QButtonGroup(this);
  QRadioButton* nearest  = new QRadioButton( tr("Minimum"), this );
  QRadioButton* touched  = new QRadioButton( tr("Touched"), this );

  ntScheme->addButton( nearest, 0 );
  ntScheme->addButton( touched, 1 );

  m_reportSwitch = new QCheckBox( tr("Report"), this );

  QVBoxLayout* vbox = new QVBoxLayout;
  vbox->addWidget( nearest );
  vbox->addWidget( touched );
  vbox->addWidget( m_reportSwitch );
  vbox->addStretch(1);
  ssBox->setLayout(vbox);

  nearest->setEnabled(true);
  touched->setEnabled(true);
  touched->setChecked(true);

  // set active button as selected
  m_selectedSwitchScheme = (int) conf->getActiveTaskSwitchScheme();

  if( ntScheme->button(m_selectedSwitchScheme) )
    {
      ntScheme->button(m_selectedSwitchScheme)->setChecked(true);
    }

  connect( ntScheme, SIGNAL(buttonClicked(int)),
           this, SLOT(slot_buttonPressedNT(int)) );

  //--------------------------------------------------------------
  // as next shape group is added
  QGroupBox* shapeGroup = new QGroupBox( tr("Shape"), this );
  topLayout->addWidget( shapeGroup, row, 1 );

  QGridLayout *gBox = new QGridLayout;
  shapeGroup->setLayout(gBox);

  m_drawShape = new QCheckBox( tr("Draw"), this );
  gBox->addWidget(m_drawShape, 0, 0 );
  m_fillShape = new QCheckBox( tr("Fill"), this );
  gBox->addWidget(m_fillShape, 1, 0 );
  gBox->setColumnStretch( 2, 5 );

  connect( m_fillShape, SIGNAL(stateChanged(int)),
           SLOT(slot_fillShapeStateChanged(int)) );

  m_transShape = new NumberEditor( this );
  m_transShape->setDecimalVisible( false );
  m_transShape->setPmVisible( false );
  m_transShape->setMaxLength(3);
  m_transShape->setSuffix( " %" );
  m_transShape->setRange( 0, 100 );
  m_transShape->setTip(tr("Opacity ") + "0...100");
  m_transShape->setValue( 0 );
  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "(0|[1-9][0-9]{0,2})" ), this );
  m_transShape->setValidator( eValidator );

  // Sets a minimum width for the widget
  int mw1 = QFontMetrics(font()).width("100 %") + 10;
  m_transShape->setMinimumWidth( mw1 );
  gBox->addWidget(m_transShape, 1, 1 );

  m_drawShape->setChecked( conf->getTaskDrawShape() );
  m_fillShape->setChecked( conf->getTaskFillShape() );

  //--------------------------------------------------------------
  // as next auto zoom group is added
  QGroupBox* zoomGroup = new QGroupBox( tr("Zoom"), this );
  topLayout->addWidget( zoomGroup, row, 2 );

  QVBoxLayout *zBox = new QVBoxLayout;
  zoomGroup->setLayout(zBox);

  m_autoZoom = new QCheckBox( tr("Auto"), this );
  zBox->addWidget(m_autoZoom);
  zBox->addStretch(10);

  m_autoZoom->setChecked( conf->getTaskPointAutoZoom() );

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next start group is added
  QGroupBox* startGroup1 = new QGroupBox( tr("Start"), this );
  topLayout->addWidget( startGroup1, row, 0 );
  QFormLayout *formLayout = new QFormLayout;
  startGroup1->setLayout(formLayout);

  m_startLine = createDNE( this );
  m_startLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_startLine);

  m_startRing = createDNE( this );
  m_startRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_startRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* startGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( startGroup2, row, 1 );
  formLayout = new QFormLayout;
  startGroup2->setLayout(formLayout);

  m_startSectorInnerRadius = createDNE( this );
  m_startSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_startSectorInnerRadius);

  m_startSectorOuterRadius = createDNE( this );
  m_startSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_startSectorOuterRadius);

  m_startSectorAngle = createNE( this );
  m_startSectorAngle->setTip(tr("Angle 1...360"));

  formLayout->addRow(tr("Angle:"), m_startSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* startGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( startGroup3, row, 2 );
  formLayout = new QFormLayout;
  startGroup3->setLayout(formLayout);

  QRadioButton* circle  = new QRadioButton( tr("Circle"), this );
  QRadioButton* sector  = new QRadioButton( tr("Sector"), this );
  QRadioButton* keyhole = new QRadioButton( tr("Keyhole"), this );
  QRadioButton* line    = new QRadioButton( tr("Line"), this );

  startScheme = new QButtonGroup(this);
  startScheme->addButton( circle, GeneralConfig::Circle );
  startScheme->addButton( sector, GeneralConfig::Sector );
  startScheme->addButton( keyhole, GeneralConfig::Keyhole );
  startScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedStartScheme = (int) conf->getActiveTaskStartScheme();

  if( startScheme->button(m_selectedStartScheme) )
    {
      startScheme->button(m_selectedStartScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next finish group is added
  QGroupBox* finishGroup1 = new QGroupBox( tr("Finish"), this );
  topLayout->addWidget( finishGroup1, row, 0 );
  formLayout = new QFormLayout;
  finishGroup1->setLayout(formLayout);

  m_finishLine = createDNE( this );
  m_finishLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_finishLine);

  m_finishRing = createDNE( this );
  m_finishRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle"), m_finishRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* finishGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( finishGroup2, row, 1 );
  formLayout = new QFormLayout;
  finishGroup2->setLayout(formLayout);

  m_finishSectorInnerRadius = createDNE( this );
  m_finishSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_finishSectorInnerRadius);

  m_finishSectorOuterRadius = createDNE( this );
  m_finishSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_finishSectorOuterRadius);

  m_finishSectorAngle = createNE( this );
  m_finishSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_finishSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* finishGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( finishGroup3, row, 2 );
  formLayout = new QFormLayout;
  finishGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  line    = new QRadioButton( tr("Line"), this );

  finishScheme = new QButtonGroup(this);
  finishScheme->addButton( circle, GeneralConfig::Circle );
  finishScheme->addButton( sector, GeneralConfig::Sector );
  finishScheme->addButton( keyhole, GeneralConfig::Keyhole );
  finishScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedFinishScheme = (int) conf->getActiveTaskFinishScheme();

  if( finishScheme->button(m_selectedFinishScheme) )
    {
      finishScheme->button(m_selectedFinishScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next observation zone is added
  QGroupBox* obZoneGroup1 = new QGroupBox( tr("Observation"), this );
  topLayout->addWidget( obZoneGroup1, row, 0 );
  formLayout = new QFormLayout;
  obZoneGroup1->setLayout(formLayout);

  m_obsCircleRadius = createDNE( this );
  m_obsCircleRadius->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_obsCircleRadius);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* obZoneGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( obZoneGroup2, row, 1 );
  formLayout = new QFormLayout;
  obZoneGroup2->setLayout(formLayout);

  m_obsSectorInnerRadius = createDNE( this );
  m_obsSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_obsSectorInnerRadius);

  m_obsSectorOuterRadius = createDNE( this );
  m_obsSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_obsSectorOuterRadius);

  m_obsSectorAngle = createNE( this );
  m_obsSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_obsSectorAngle);

  //--------------------------------------------------------------
  // as next inner observer scheme group is added
  QGroupBox* obZoneGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( obZoneGroup3, row, 2 );
  formLayout = new QFormLayout;
  obZoneGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  // no line for observer area

  obsScheme = new QButtonGroup(this);
  obsScheme->addButton( circle, GeneralConfig::Circle );
  obsScheme->addButton( sector, GeneralConfig::Sector );
  obsScheme->addButton( keyhole, GeneralConfig::Keyhole );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);

  // set active button as selected
  m_selectedObsScheme = (int) conf->getActiveTaskObsScheme();

  if( obsScheme->button(m_selectedObsScheme) )
    {
      obsScheme->button(m_selectedObsScheme)->setChecked(true);
    }

  //--------------------------------------------------------------
  // Connect sector check controls.
  connect( m_startSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorStartChanged(const QString&)) );
  connect( m_finishSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorFinishChanged(const QString&)) );
  connect( m_obsSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorObsChanged(const QString&)) );
  connect( startScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedSS(int)) );
  connect( finishScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedFS(int)) );
  connect( obsScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedOS(int)) );

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png"));

  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
コード例 #28
0
ファイル: devicestate.cpp プロジェクト: 4nykey/rockbox
DeviceState::DeviceState(QWidget *parent) :
    QWidget(parent), tabs(this)
{
    /* UI stuff */
    resize(500,400);
    setWindowIcon(QIcon(":/resources/windowicon.png"));
    setWindowTitle(tr("Device Settings"));

    QFormLayout* layout = new QFormLayout(this);
    layout->addWidget(&tabs);
    this->setLayout(layout);

    /* Loading the tabs */
    QScrollArea* currentArea = 0;
    QWidget* panel;

    QFile fin(":/resources/deviceoptions");
    fin.open(QFile::Text | QFile::ReadOnly);
    while(!fin.atEnd())
    {
        QString line = QString(fin.readLine());
        line = line.trimmed();

        /* Continue on a comment or an empty line */
        if(line[0] == '#' || line.length() == 0)
            continue;

        if(line[0] == '[')
        {
            QString buffer;
            for(int i = 1; line[i] != ']'; i++)
                buffer.append(line[i]);
            buffer = buffer.trimmed();

            panel = new QWidget();
            currentArea = new QScrollArea();
            layout = new QFormLayout(panel);
            currentArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
            currentArea->setWidget(panel);
            currentArea->setWidgetResizable(true);

            tabs.addTab(currentArea, buffer);

            continue;
        }

        QStringList elements = line.split(";");
        QString tag = elements[0].trimmed();
        QString title = elements[1].trimmed();
        QString type = elements[2].trimmed();
        QString defVal = elements[3].trimmed();

        elements = type.split("(");
        if(elements[0].trimmed() == "text")
        {
            QLineEdit* temp = new QLineEdit(defVal, currentArea);
            layout->addRow(title, temp);
            inputs.insert(tag, QPair<InputType, QWidget*>(Text, temp));

            temp->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
                                            QSizePolicy::Fixed));

            QObject::connect(temp, SIGNAL(textChanged(QString)),
                             this, SLOT(input()));
        }
        else if(elements[0].trimmed() == "check")
        {
            QCheckBox* temp = new QCheckBox(title, currentArea);
            layout->addRow(temp);
            if(defVal.toLower() == "true")
                temp->setChecked(true);
            else
                temp->setChecked(false);
            inputs.insert(tag, QPair<InputType, QWidget*>(Check, temp));

            QObject::connect(temp, SIGNAL(toggled(bool)),
                             this, SLOT(input()));
        }
        else if(elements[0].trimmed() == "slider")
コード例 #29
0
//
// Constructor
//
HistogramWindow::HistogramWindow(Context *context, bool rangemode) : GcChartWindow(context), context(context), stale(true), source(NULL), active(false), bactive(false), rangemode(rangemode), useCustom(false), useToToday(false), precision(99)
{
    QWidget *c = new QWidget;
    c->setContentsMargins(0,0,0,0);
    QFormLayout *cl = new QFormLayout(c);
    cl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    cl->setSpacing(5);
    setControls(c);

    //
    // reveal controls widget
    //

    // reveal controls
    rWidth = new QLabel(tr("Bin Width"));
    rBinEdit = new QLineEdit();
    rBinEdit->setFixedWidth(40);
    rBinSlider = new QSlider(Qt::Horizontal);
    rBinSlider->setTickPosition(QSlider::TicksBelow);
    rBinSlider->setTickInterval(10);
    rBinSlider->setMinimum(1);
    rBinSlider->setMaximum(100);
    rShade = new QCheckBox(tr("Shade zones"));
    rZones = new QCheckBox(tr("Show in zones"));

    // layout reveal controls
    QHBoxLayout *r = new QHBoxLayout;
    r->setContentsMargins(0,0,0,0);
    r->addStretch();
    r->addWidget(rWidth);
    r->addWidget(rBinEdit);
    r->addWidget(rBinSlider);
    QVBoxLayout *v = new QVBoxLayout;
    v->addWidget(rShade);
    v->addWidget(rZones);
    r->addSpacing(20);
    r->addLayout(v);
    r->addStretch();
    setRevealLayout(r);

    // plot
    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->setSpacing(10);
    powerHist = new PowerHist(context);
    vlayout->addWidget(powerHist);

    setChartLayout(vlayout);

#ifdef GC_HAVE_LUCENE
    // search filter box
    isfiltered = false;
    searchBox = new SearchFilterBox(this, context);
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
    if (!rangemode) searchBox->hide();
    else {
        cl->addRow(new QLabel(tr("Filter")), searchBox);
        cl->addWidget(new QLabel(""));
    }
#endif

    // date selection
    dateSetting = new DateSettingsEdit(this);

    if (rangemode) {

        cl->addRow(new QLabel(tr("Date Range")), dateSetting);
        cl->addWidget(new QLabel("")); // spacing

        // default to data series!
        data = new QRadioButton(tr("Ride Data Samples"));
        metric = new QRadioButton(tr("Ride Metrics"));
        data->setChecked(true);
        metric->setChecked(false);
        QHBoxLayout *radios = new QHBoxLayout;
        radios->addWidget(data);
        radios->addWidget(metric);
        cl->addRow(new QLabel(tr("Plot")), radios);

        connect(data, SIGNAL(toggled(bool)), this, SLOT(dataToggled(bool)));
        connect(metric, SIGNAL(toggled(bool)), this, SLOT(metricToggled(bool)));
    }

    // data series
    seriesCombo = new QComboBox();
    addSeries();
    if (rangemode) comboLabel = new QLabel("");
    else comboLabel = new QLabel(tr("Data Series"));
    cl->addRow(comboLabel, seriesCombo);

    if (rangemode) {

        // TOTAL METRIC
        totalMetricTree = new QTreeWidget;
#ifdef Q_OS_MAC
        totalMetricTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
        totalMetricTree->setColumnCount(2);
        totalMetricTree->setColumnHidden(1, true);
        totalMetricTree->setSelectionMode(QAbstractItemView::SingleSelection);
        totalMetricTree->header()->hide();
        //totalMetricTree->setFrameStyle(QFrame::NoFrame);
        //totalMetricTree->setAlternatingRowColors (true);
        totalMetricTree->setIndentation(5);
        totalMetricTree->setContextMenuPolicy(Qt::CustomContextMenu);

        // ALL METRIC
        distMetricTree = new QTreeWidget;
#ifdef Q_OS_MAC
        distMetricTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
        distMetricTree->setColumnCount(2);
        distMetricTree->setColumnHidden(1, true);
        distMetricTree->setSelectionMode(QAbstractItemView::SingleSelection);
        distMetricTree->header()->hide();
        //distMetricTree->setFrameStyle(QFrame::NoFrame);
        distMetricTree->setIndentation(5);
        distMetricTree->setContextMenuPolicy(Qt::CustomContextMenu);

        // add them all
        const RideMetricFactory &factory = RideMetricFactory::instance();
        for (int i = 0; i < factory.metricCount(); ++i) {

            const RideMetric *m = factory.rideMetric(factory.metricName(i));

            QTextEdit processHTML(m->name()); // process html encoding of(TM)
            QString processed = processHTML.toPlainText();

            QTreeWidgetItem *add;
            add = new QTreeWidgetItem(distMetricTree->invisibleRootItem());
            add->setText(0, processed);
            add->setText(1, m->symbol());

            // we only want totalising metrics
            if (m->type() != RideMetric::Total) continue;

            add = new QTreeWidgetItem(totalMetricTree->invisibleRootItem());
            add->setText(0, processed);
            add->setText(1, m->symbol());
        }

        QHBoxLayout *labels = new QHBoxLayout;

        metricLabel1 = new QLabel(tr("Total (x-axis)"));
        labels->addWidget(metricLabel1);
        metricLabel1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

        metricLabel2 = new QLabel(tr("Distribution (y-axis)"));
        metricLabel2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
        labels->addWidget(metricLabel2);

        cl->addRow((blankLabel1=new QLabel("")), labels);
        QHBoxLayout *trees = new QHBoxLayout;
        trees->addWidget(totalMetricTree);
        trees->addWidget(distMetricTree);
        cl->addRow((blankLabel2 = new QLabel("")), trees);

        colorButton = new ColorButton(this, "Color", QColor(Qt::blue));
        colorLabel = new QLabel(tr("Color"));
        connect(colorButton, SIGNAL(colorChosen(QColor)), this, SLOT(updateChart()));
        cl->addRow(colorLabel, colorButton);

        // by default select number of rides by duration
        // which are the metrics workout_time and ride_count
        selectTotal("ride_count");
        selectMetric("workout_time");
    }

    showSumY = new QComboBox();
    showSumY->addItem(tr("Absolute Time"));
    showSumY->addItem(tr("Percentage Time"));

    showLabel = new QLabel(tr("Show"));
    cl->addRow(showLabel, showSumY);

    showLnY = new QCheckBox;
    showLnY->setText(tr("Log Y"));
    cl->addRow(blankLabel3 = new QLabel(""), showLnY);

    showZeroes = new QCheckBox;
    showZeroes->setText(tr("With zeros"));
    cl->addRow(blankLabel4 = new QLabel(""), showZeroes);

    shadeZones = new QCheckBox;
    shadeZones->setText(tr("Shade zones"));
    cl->addRow(blankLabel5 = new QLabel(""), shadeZones);

    showInZones = new QCheckBox;
    showInZones->setText(tr("Show in zones"));
    cl->addRow(blankLabel6 = new QLabel(""), showInZones);

    // bin width
    QHBoxLayout *binWidthLayout = new QHBoxLayout;
    QLabel *binWidthLabel = new QLabel(tr("Bin width"), this);
    binWidthLineEdit = new QLineEdit(this);
    binWidthLineEdit->setFixedWidth(40);

    binWidthLayout->addWidget(binWidthLineEdit);
    binWidthSlider = new QSlider(Qt::Horizontal);
    binWidthSlider->setTickPosition(QSlider::TicksBelow);
    binWidthSlider->setTickInterval(1);
    binWidthSlider->setMinimum(1);
    binWidthSlider->setMaximum(100);
    binWidthLayout->addWidget(binWidthSlider);
    cl->addRow(binWidthLabel, binWidthLayout);

    // sort out default values
    setBinEditors();
    showLnY->setChecked(powerHist->islnY());
    showZeroes->setChecked(powerHist->withZeros());
    shadeZones->setChecked(powerHist->shade);
    binWidthSlider->setValue(powerHist->binWidth());
    rBinSlider->setValue(powerHist->binWidth());
    rShade->setChecked(powerHist->shade);

    // fixup series selected by default
    seriesChanged();

    // hide/show according to default mode
    switchMode(); // does nothing if not in rangemode

    // set the defaults etc
    updateChart();

    // the bin slider/input update each other
    // only the input box triggers an update to the chart
    connect(binWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(setBinWidthFromSlider()));
    connect(binWidthLineEdit, SIGNAL(editingFinished()), this, SLOT(setBinWidthFromLineEdit()));
    connect(rBinSlider, SIGNAL(valueChanged(int)), this, SLOT(setrBinWidthFromSlider()));
    connect(rBinEdit, SIGNAL(editingFinished()), this, SLOT(setrBinWidthFromLineEdit()));
    connect(rZones, SIGNAL(stateChanged(int)), this, SLOT(setZoned(int)));
    connect(rShade, SIGNAL(stateChanged(int)), this, SLOT(setShade(int)));

    // when season changes we need to retrieve data from the cache then update the chart
    if (rangemode) {
        connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
        connect(dateSetting, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange)));
        connect(dateSetting, SIGNAL(useThruToday()), this, SLOT(useThruToday()));
        connect(dateSetting, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
        connect(distMetricTree, SIGNAL(itemSelectionChanged()), this, SLOT(treeSelectionChanged()));
        connect(totalMetricTree, SIGNAL(itemSelectionChanged()), this, SLOT(treeSelectionChanged()));

        lagger = new QTimer;
        lagger->setSingleShot(true);
        connect(lagger, SIGNAL(timeout()), this, SLOT(treeSelectionTimeout()));

    } else {
        dateSetting->hide();
        connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
        connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    }

    // if any of the controls change we pass the chart everything
    connect(showLnY, SIGNAL(stateChanged(int)), this, SLOT(updateChart()));
    connect(showZeroes, SIGNAL(stateChanged(int)), this, SLOT(updateChart()));
    connect(seriesCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(seriesChanged()));
    connect(showInZones, SIGNAL(stateChanged(int)), this, SLOT(setZoned(int)));
    connect(showInZones, SIGNAL(stateChanged(int)), this, SLOT(updateChart()));
    connect(shadeZones, SIGNAL(stateChanged(int)), this, SLOT(setShade(int)));
    connect(shadeZones, SIGNAL(stateChanged(int)), this, SLOT(updateChart()));
    connect(showSumY, SIGNAL(currentIndexChanged(int)), this, SLOT(updateChart()));

    connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(zonesChanged()));
    connect(context, SIGNAL(configChanged()), powerHist, SLOT(configChanged()));

    connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(rideAddorRemove(RideItem*)));
    connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(rideAddorRemove(RideItem*)));
    connect(context, SIGNAL(filterChanged()), this, SLOT(forceReplot()));
    connect(context, SIGNAL(homeFilterChanged()), this, SLOT(forceReplot()));
}
コード例 #30
0
StockpileNetworkDistributionWidget::StockpileNetworkDistributionWidget(boost::shared_ptr<EpidemicDataSet> dataSet)
{
    dataSet_ = dataSet;

    setTitle("Distribution");

    QFormLayout * layout = new QFormLayout();
    setLayout(layout);

    // add widgets...

    // source stockpile

    // "new inventory" entry
    // use a NULL stockpile value
    QVariant newInventoryStockpilesVariant = QVariant::fromValue(boost::shared_ptr<Stockpile>());
    sourceComboBox_.addItem("New Inventory", newInventoryStockpilesVariant);

    std::vector<boost::shared_ptr<Stockpile> > stockpiles = dataSet->getStockpileNetwork()->getStockpiles();

    for(unsigned int i=0; i<stockpiles.size(); i++)
    {
        QVariant stockpileVariant = QVariant::fromValue(stockpiles[i]);
        sourceComboBox_.addItem(stockpiles[i]->getName().c_str(), stockpileVariant);
    }

    layout->addRow("Source", &sourceComboBox_);

    // destination stockpile

    // "all" entry
    // use a NULL stockpile value
    QVariant allStockpilesVariant = QVariant::fromValue(boost::shared_ptr<Stockpile>());
    destinationComboBox_.addItem("All", allStockpilesVariant);

    for(unsigned int i=0; i<stockpiles.size(); i++)
    {
        QVariant stockpileVariant = QVariant::fromValue(stockpiles[i]);
        destinationComboBox_.addItem(stockpiles[i]->getName().c_str(), stockpileVariant);
    }

    layout->addRow("Destination", &destinationComboBox_);

    // type
    for(unsigned int i=0; i<NUM_STOCKPILE_TYPES; i++)
    {
        typeComboBox_.addItem(Stockpile::getTypeName((STOCKPILE_TYPE)i).c_str());
    }

    layout->addRow("Type", &typeComboBox_);

    // quantity
    quantitySpinBox_.setMaximum(STOCKPILE_WIDGET_NUM_MAX);

    layout->addRow("Quantity", &quantitySpinBox_);

    // transfer time
    transferTimeSpinBox_.setMaximum(365);
    transferTimeSpinBox_.setSuffix(" days");

    layout->addRow("Transfer Time", &transferTimeSpinBox_);

    // results label
    layout->addWidget(&resultLabel_);

    // execute button
    QPushButton * executeButton = new QPushButton("Execute", this);
    layout->addWidget(executeButton);

    // connections
    connect(executeButton, SIGNAL(clicked()), this, SLOT(execute()));
}