コード例 #1
0
void MainWindow::generateReportFromDataRange()
{
    QString absolutePath = QFileDialog::getSaveFileName(this,"Zapisz raport", QString(), tr("Pdf document (*.pdf)"));

    if(absolutePath.trimmed().isEmpty())
        return;

    DialogBusy dialogBusy;
    dialogBusy.setModal(true);
    dialogBusy.setLabelText("Trwa generowanie raportu...");
    dialogBusy.show();

    this->ct->reports->reportFromDataRange(ui->reportDataRangeFrom->value(), ui->reportDataRangeTo->value(), this->getSelectedObjectName(), absolutePath);

    dialogBusy.close();

    QMessageBox msgBox;
    msgBox.setInformativeText(QString::fromUtf8("Raport został pomyślnie wygenerowany."));
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    msgBox.setIcon(QMessageBox::Information);
    msgBox.setWindowTitle(QString::fromUtf8("Raport"));

    // workaround for not working setMinimumWidth:
    QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    msgBox.exec();
}
コード例 #2
0
ファイル: githubmodule.cpp プロジェクト: arcan1s/reportabug
/**
 * @fn githubFinished
 */
void GithubModule::githubFinished(QNetworkReply *reply)
{
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]";
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Error state" << reply->error();
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Reply size" << reply->readBufferSize();

    bool state = true;
    QString answer = reply->readAll();
    if (debug) qDebug() << "[GithubModule]" << "[replyFinished]" << ":" << answer;
    QString messageBody, messageTitle;
    QMessageBox::Icon icon = QMessageBox::NoIcon;
    if (answer.contains(QString("\"html_url\":"))) {
        QString url;
        for (int i=0; i<answer.split(QChar(',')).count(); i++)
            if (answer.split(QChar(','))[i].split(QChar(':'))[0] == QString("\"html_url\"")) {
                url = answer.split(QChar(','))[i].split(QString("\"html_url\":"))[1].remove(QChar('"'));
                break;
            }
        messageBody += QString("%1\n").arg(QApplication::translate("Reportabug", "Message has been sended"));
        messageBody += QString("Url: %2").arg(url);
        messageTitle = QApplication::translate("Reportabug", "Done!");
        icon = QMessageBox::Information;
        state = true;
    }
    else if (answer.contains(QString("\"Bad credentials\""))) {
        messageBody += QApplication::translate("Reportabug", "Incorrect username or password");
        messageTitle = QApplication::translate("Reportabug", "Error!");
        icon = QMessageBox::Critical;
        state = false;
    }
    else {
        messageBody += QApplication::translate("Reportabug", "An error occurs");
        messageTitle = QApplication::translate("Reportabug", "Error!");
        icon = QMessageBox::Critical;
        state = false;
    }
    reply->deleteLater();

    QMessageBox messageBox;
    messageBox.setText(messageTitle);
    messageBox.setInformativeText(messageBody);
    messageBox.setIcon(icon);
    messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Retry);
    messageBox.setDefaultButton(QMessageBox::Ok);
    QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout *layout = (QGridLayout *)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    int ret = messageBox.exec();

    switch (ret) {
    case QMessageBox::Ok:
        if (state) mainWindow->close();
        break;
    case QMessageBox::Retry:
        if (state) mainWindow->externalUpdateTab();
        break;
    default:
        break;
    }
}
コード例 #3
0
CockpitGrid::CockpitGrid(QWidget *parent):
    QFrame(parent)
{
#if QT_VERSION >= 0x040100
    setAutoFillBackground(true);
#endif

    setPalette(colorTheme(QColor(Qt::darkGray).dark(150)));

    QGridLayout *layout = new QGridLayout(this);
    layout->setSpacing(5);
    layout->setMargin(0);

    int i;
    for ( i = 0; i < 3; i++ )
    {
        QwtDial *dial = createDial(i);
        layout->addWidget(dial, 0, i);
    }

#if QT_VERSION < 0x040000
    for ( i = 0; i < layout->numCols(); i++ )
        layout->setColStretch(i, 1);
#else
    for ( i = 0; i < layout->columnCount(); i++ )
        layout->setColumnStretch(i, 1);
#endif
}
コード例 #4
0
QGridLayout* ProjectWindow::setupImageActions() {
    QGridLayout* layout = new QGridLayout;
    layout->setAlignment(Qt::AlignLeft);
    layout->setSpacing(5);
    layout->setMargin(0);

    QPushButton* reindexButton = new QPushButton(ApplicationData::icon("refresh"), "Re-index Images");
    connect(reindexButton, &QPushButton::clicked, &projectData, &ProjectData::indexImages);
    layout->addWidget(reindexButton, 0, 0);

    QPushButton* resetImageConfigsButton = new QPushButton(ApplicationData::icon("reset"), "Reset Image Parameters");
    connect(resetImageConfigsButton, &QPushButton::clicked, &projectData, &ProjectData::resetImageConfigs);
    layout->addWidget(resetImageConfigsButton, 0, 1);

    QPushButton* renumberButton = new QPushButton(ApplicationData::icon("renumber"), "Renumber Images");
    connect(renumberButton, &QPushButton::clicked, &projectData, &ProjectData::renumberImages);
    layout->addWidget(renumberButton, 1, 0);

    QPushButton* evenOddButton = new QPushButton(ApplicationData::icon("odd"), "Assign Even/Odd");
    connect(evenOddButton, &QPushButton::clicked, &projectData, &ProjectData::assignEvenOdd);
    layout->addWidget(evenOddButton, 1, 1);

    for (int i = 0; i < layout->columnCount(); ++i) layout->setColumnStretch(i, 0);

    return layout;
}
コード例 #5
0
int QGridLayoutProto::columnCount() const
{
  QGridLayout *item = qscriptvalue_cast<QGridLayout*>(thisObject());
  if (item)
    return item->columnCount();
  return 0;
}
コード例 #6
0
void PreferenceDialog::on_seeInfoButton_clicked() {
    QMessageBox msgBox;
    msgBox.setText(tr("This data will help improve this application and won't be shared with anyone."));
    msgBox.setDetailedText(uinfo->printJSON());
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    //Fixed size hack
    QSpacerItem* horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    msgBox.exec();
}
コード例 #7
0
void MainWindow::on_actionKupo_triggered()
{
    QSound::play(":/sound/moogle.wav");
    QMessageBox messageBox;
    QSpacerItem* horizontalSpacer = new QSpacerItem(200, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    messageBox.setIconPixmap(QPixmap(":/icon/mog"));
    messageBox.setText("Kupo !");
    messageBox.setWindowTitle("Kupo ?");
    QGridLayout* layout = (QGridLayout*)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    messageBox.exec();
}
コード例 #8
0
void MainWindow::on_actionHelp_triggered()
{
    QSound::play(":/sound/moogle.wav");
    QMessageBox messageBox;
    QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    messageBox.setIconPixmap(QPixmap(":/icon/mog"));
    messageBox.setText("Input the number of cards you obtained since your last reset, and the number of times you've loaded the World Map since your last reset, in order.\nFor example, if you just started the game, obtained the 3 cards from Ticketmaster, went once on the World Map, obtained one card from a random encounter in the Ice Cavern, and went one more time on the World Map before reaching Dali, you would input 3 / 1 / 1 / 1 in this order.\nIf you need help on a specific part of the window, simply hover your mouse on it, a tooltip should appear.");
    messageBox.setWindowTitle("Help meeeeeee, kupo...");
    QGridLayout* layout = (QGridLayout*)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    messageBox.exec();
}
コード例 #9
0
void MainWindow::on_actionAbout_triggered()
{
    QSound::play(":/sound/moogle.wav");
    QMessageBox messageBox;
    QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    messageBox.setIconPixmap(QPixmap(":/icon/mog"));
    messageBox.setTextFormat(Qt::RichText);
    messageBox.setText("RNG Masters, a RNG manipulation tool for Tetra Masters in Final Fantasy IX.\nCoded in C++ with Qt. Hope you enjoy this program !\nYou can contact me on <a href='http://forums.qhimm.com/index.php?action=profile;u=25024'>forums.qhimm.com</a> (froggy25) or on <a href='http://datacrystal.romhacking.net/wiki/User_talk:Mantidactyle'>datacrystal.romhacking.net</a> (Mantidactyle).\nShout out to the FFIX speedrunning community, you guys rock !");
    messageBox.setWindowTitle("About");
    QGridLayout* layout = (QGridLayout*)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    messageBox.exec();
}
コード例 #10
0
bool SeafileApplet::detailedYesOrNoBox(const QString& msg, const QString& detailed_text, QWidget *parent, bool default_val)
{
    QMessageBox *msgBox = new QMessageBox(QMessageBox::Question,
                       getBrand(),
                       msg,
                       QMessageBox::Yes | QMessageBox::No,
                       parent != 0 ? parent : main_win_);
    msgBox->setDetailedText(detailed_text);
    // Turns out the layout box in the QMessageBox is a grid
    // You can force the resize using a spacer this way:
    QSpacerItem* horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox->layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    msgBox->setDefaultButton(default_val ? QMessageBox::Yes : QMessageBox::No);
    return msgBox->exec() == QMessageBox::Yes;
}
コード例 #11
0
void MainWindow::loadDataStandard(){
    int begin = ui->loadFromSpinBox->value();
    int end = ui->loadToSpinBox->value();

    ui->webView->setDataset(ct->dataset->datasetControler->dataset);
    ui->webView->setInterval(begin, end);

    int count = end - begin;
    if(count > CHART_RECORDS_LIMIT)
    {
        QMessageBox msgBox;;
        msgBox.setInformativeText(QString::fromUtf8("Wybrany przedział zawiera ") + QString::number(count) + QString::fromUtf8(" rekordów.\nMaksymalna liczba rekordów do wyświetlenia to ") + QString::number(CHART_RECORDS_LIMIT) + ".");
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.setWindowTitle(QString::fromUtf8("Przekroczono limit"));

        // workaround for not working setMinimumWidth:
        QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        QGridLayout* layout = (QGridLayout*)msgBox.layout();
        layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

        msgBox.exec();
    }
    else if(count > 0)
    {
        ui->webView->setDataset(ct->dataset->datasetControler->dataset);
        ui->webView->setInterval(begin, end);

        QPair<QDateTime,QDateTime> interval = ct->dataset->getDateTimeRecordInterval(begin, end);

        ui->loadFromDateTime->setDateTime(interval.first);
        ui->loadToDateTime->setDateTime(interval.second);

        ui->fromProcessSpinBox->setValue(begin);
        ui->toProcessSpinBox->setValue(end);

        redrawDataset();

        ui->leftBtn->setEnabled(true);
        ui->rightBtn->setEnabled(true);
        ui->linearScaleRadioButton->setEnabled(true);
        ui->logScaleRadioButton->setEnabled(true);
    }


}
コード例 #12
0
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_grid_layout_column_count (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QGridLayout *grid = self->v8_to_qobject<QGridLayout> (Args.This ());
      if (grid) {

         result = v8::Number::New (grid->columnCount ());
      }
   }

   return scope.Close (result);
}
コード例 #13
0
ファイル: tweaks.cpp プロジェクト: willzhou/appleseed
void set_minimum_width(QMessageBox& msgbox, const int minimum_width)
{
    QSpacerItem* spacer =
        new QSpacerItem(
            minimum_width,
            0,
            QSizePolicy::Minimum,
            QSizePolicy::Expanding);

    QGridLayout* layout = static_cast<QGridLayout*>(msgbox.layout());

    layout->addItem(
        spacer,
        layout->rowCount(),         // row
        0,                          // column
        1,                          // row span
        layout->columnCount());     // column span
}
コード例 #14
0
bool AppMessageBox::detailedYesOrNoBox(const QString msg, const QString detailed_text, bool default_val) {
  QMessageBox *msgBox = new QMessageBox(QMessageBox::Question, getBrand(), msg, QMessageBox::Yes | QMessageBox::No,
                      _parent);

  msgBox->setDetailedText(detailed_text);
  // Turns out the layout box in the QMessageBox is a grid
  // You can force the resize using a spacer this way:
  QSpacerItem *horizontalSpacer =
      new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
  QGridLayout *layout = (QGridLayout *)msgBox->layout();

  layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
  msgBox->setDefaultButton(default_val ? QMessageBox::Yes : QMessageBox::No);

//  msgBox->setAttribute( Qt::WA_DeleteOnClose ); //makes sure the msgbox is deleted automatically when closed
  ManageWindow::moveToCenter(msgBox);
  ManageWindow::bringToFocus(msgBox);

  bool b = msgBox->exec() == QMessageBox::Yes;
  return b;
}
コード例 #15
0
ファイル: PTeraStitcher.cpp プロジェクト: abria/TeraStitcher
/**********************************************************************************
* Called when "Help->About" menu action is triggered
***********************************************************************************/
void PTeraStitcher::about()
{
    #ifdef TSP_DEBUG
    printf("TeraStitcher plugin [thread %d] >> PTeraStitcher::about()\n", this->thread()->currentThreadId());
    #endif

    QMessageBox msgBox(this);
    QSpacerItem* horizontalSpacer = new QSpacerItem(600, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    msgBox.setText( QString("<html><h1>TeraStitcher v. ").append(terastitcher::version.c_str()).append("</h1>"
                    "<big>A tool for fast automatic 3D-stitching of teravoxel-sized microscopy images</big><br>"
                    "<a href=\"http://www.biomedcentral.com/1471-2105/13/316\">(BMC Bioinformatics 2012, 13:316)</a><br><br>"
                    "<u>Developed by:</u><ul>"
                    "<li><b>Alessandro Bria</b> (email: [email protected])<br>"
                           "Post-doctoral Fellow at University of Cassino</li>"
                    "<li><b>Giulio Iannello</b> (email: [email protected])<br>"
                           "Full Professor at University Campus Bio-Medico of Rome</li>"
                    "For further info, please visit our <a href=\"http://abria.github.io/TeraStitcher/\">website</a>.</html>" ));

    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    msgBox.exec();
}
コード例 #16
0
void MainWindow::on_actionWczytaj_konfiguracj_triggered()
{
    QString fileName = QFileDialog::getOpenFileName(this, QString::fromUtf8("Wskaż plik konfiguracji"), QString(), tr("Pliki konfiguracji (*.ini)"));
    if(fileName != NULL)
    {
        ct->configuration->importSettings(fileName);

        QMessageBox msgBox;
        msgBox.setInformativeText(QString::fromUtf8("Konfiguracja została wczytana."));
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Information);
        msgBox.setWindowTitle(QString::fromUtf8("Konfiguracja"));

        // workaround for not working setMinimumWidth:
        QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        QGridLayout* layout = (QGridLayout*)msgBox.layout();
        layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

        msgBox.exec();
    }
}
コード例 #17
0
ファイル: compass_grid.cpp プロジェクト: Spinetta/qwt
CompassGrid::CompassGrid( QWidget *parent ):
    QFrame( parent )
{
    QPalette p = palette();
    p.setColor( backgroundRole(), Qt::gray );
    setPalette( p );

    setAutoFillBackground( true );

    QGridLayout *layout = new QGridLayout( this );
    layout->setSpacing( 5 );
    layout->setMargin( 0 );

    int i;
    for ( i = 0; i < 6; i++ )
    {
        QwtCompass *compass = createCompass( i );
        layout->addWidget( compass, i / 3, i % 3 );
    }

    for ( i = 0; i < layout->columnCount(); i++ )
        layout->setColumnStretch( i, 1 );
}
コード例 #18
0
ファイル: mainwidget.cpp プロジェクト: MarcoLeongDev/qcma
void MainWidget::showAboutDialog()
{
    QMessageBox about;

    about.setText(QString("QCMA ") + QCMA_VER);
    about.setWindowTitle(tr("About QCMA"));
#ifndef QCMA_BUILD_HASH
    about.setInformativeText(tr("Copyright (C) 2014  Codestation") + "\n");
#else
    about.setInformativeText(tr("Copyright (C) 2014  Codestation\n\nbuild hash: %1\nbuild branch: %2").arg(QCMA_BUILD_HASH).arg(QCMA_BUILD_BRANCH));
#endif
    about.setStandardButtons(QMessageBox::Ok);
    about.setIconPixmap(QPixmap(":/main/resources/images/qcma.png"));
    about.setDefaultButton(QMessageBox::Ok);

    // hack to expand the messagebox minimum size
    QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)about.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    about.show();
    about.exec();
}
コード例 #19
0
void MainWindow::changeMethodParams(){
    int openedTab = ui->tabWidget_3->currentIndex();
    switch(openedTab){
    case 0:
        changeSOMParams();
        break;
    case 1:
        changeRBFParams();
        break;
    case 2:
        changeBayesParams();
        break;
    case 3:
        changeNeighbourParams();
        break;
    case 4:
        changeDensityParams();
        break;
    default:
        break;
    }

    QMessageBox msgBox;
    msgBox.setInformativeText(QString::fromUtf8("Nowe parametry dla wybranej metody zostały zastosowane."));
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    msgBox.setIcon(QMessageBox::Information);
    msgBox.setWindowTitle(QString::fromUtf8("Parametry"));

    // workaround for not working setMinimumWidth:
    QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    msgBox.exec();
}
コード例 #20
0
ファイル: settings_dialog.cpp プロジェクト: kjetilk/mapper
GeneralPage::GeneralPage(QWidget* parent)
 : SettingsPage(parent)
{
	QGridLayout* layout = new QGridLayout();
	setLayout(layout);
	
	int row = 0;
	layout->addWidget(Util::Headline::create(tr("Appearance")), row, 1, 1, 2);
	
	row++;
	QLabel* language_label = new QLabel(tr("Language:"));
	layout->addWidget(language_label, row, 1);
	
	language_box = new QComboBox(this);
	updateLanguageBox();
	layout->addWidget(language_box, row, 2);
	
	QAbstractButton* language_file_button = new QToolButton();
	language_file_button->setIcon(QIcon(QStringLiteral(":/images/open.png")));
	layout->addWidget(language_file_button, row, 3);
	
	row++;
	layout->addItem(Util::SpacerItem::create(this), row, 1);
	
	row++;
	layout->addWidget(Util::Headline::create(tr("Screen")), row, 1, 1, 2);
	
	row++;
	QLabel* ppi_label = new QLabel(tr("Pixels per inch:"));
	layout->addWidget(ppi_label, row, 1);
	
	ppi_edit = Util::SpinBox::create(2, 0.01, 9999);
	ppi_edit->setValue(Settings::getInstance().getSetting(Settings::General_PixelsPerInch).toFloat());
	layout->addWidget(ppi_edit, row, 2);
	
	QAbstractButton* ppi_calculate_button = new QToolButton();
	ppi_calculate_button->setIcon(QIcon(QStringLiteral(":/images/settings.png")));
	layout->addWidget(ppi_calculate_button, row, 3);
	
	row++;
	layout->addItem(Util::SpacerItem::create(this), row, 1);
	
	row++;
	layout->addWidget(Util::Headline::create(tr("Program start")), row, 1, 1, 2);
	
	row++;
	QCheckBox* open_mru_check = new QCheckBox(AbstractHomeScreenWidget::tr("Open most recently used file"));
	open_mru_check->setChecked(Settings::getInstance().getSetting(Settings::General_OpenMRUFile).toBool());
	layout->addWidget(open_mru_check, row, 1, 1, 2);
	
	row++;
	QCheckBox* tips_visible_check = new QCheckBox(AbstractHomeScreenWidget::tr("Show tip of the day"));
	tips_visible_check->setChecked(Settings::getInstance().getSetting(Settings::HomeScreen_TipsVisible).toBool());
	layout->addWidget(tips_visible_check, row, 1, 1, 2);
	
	row++;
	layout->addItem(Util::SpacerItem::create(this), row, 1);
	
	row++;
	layout->addWidget(Util::Headline::create(tr("Saving files")), row, 1, 1, 2);
	
	row++;
	QCheckBox* compatibility_check = new QCheckBox(tr("Retain compatibility with Mapper %1").arg(QStringLiteral("0.5")));
	compatibility_check->setChecked(Settings::getInstance().getSetting(Settings::General_RetainCompatiblity).toBool());
	layout->addWidget(compatibility_check, row, 1, 1, 2);
	
	// Possible point: limit size of undo/redo journal
	
	int autosave_interval = Settings::getInstance().getSetting(Settings::General_AutosaveInterval).toInt();
	
	row++;
	QCheckBox* autosave_check = new QCheckBox(tr("Save information for automatic recovery"));
	autosave_check->setChecked(autosave_interval > 0);
	layout->addWidget(autosave_check, row, 1, 1, 2);
	
	row++;
	autosave_interval_label = new QLabel(tr("Recovery information saving interval:"));
	layout->addWidget(autosave_interval_label, row, 1);
	
	autosave_interval_edit = Util::SpinBox::create(1, 120, tr("min", "unit minutes"), 1);
	autosave_interval_edit->setValue(qAbs(autosave_interval));
	autosave_interval_edit->setEnabled(autosave_interval > 0);
	layout->addWidget(autosave_interval_edit, row, 2);
	
	row++;
	layout->addItem(Util::SpacerItem::create(this), row, 1);
	
	row++;
	layout->addWidget(Util::Headline::create(tr("File import and export")), row, 1, 1, 2);
	
	row++;
	QLabel* encoding_label = new QLabel(tr("8-bit encoding:"));
	layout->addWidget(encoding_label, row, 1);
	
	encoding_box = new QComboBox();
	encoding_box->addItem(QStringLiteral("System"));
	encoding_box->addItem(QStringLiteral("Windows-1250"));
	encoding_box->addItem(QStringLiteral("Windows-1252"));
	encoding_box->addItem(QStringLiteral("ISO-8859-1"));
	encoding_box->addItem(QStringLiteral("ISO-8859-15"));
	encoding_box->setEditable(true);
	QStringList availableCodecs;
	for (const QByteArray& item : QTextCodec::availableCodecs())
	{
		availableCodecs.append(QString::fromUtf8(item));
	}
	if (!availableCodecs.empty())
	{
		availableCodecs.sort(Qt::CaseInsensitive);
		availableCodecs.removeDuplicates();
		encoding_box->addItem(tr("More..."));
	}
	QCompleter* completer = new QCompleter(availableCodecs, this);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	encoding_box->setCompleter(completer);
	encoding_box->setCurrentText(Settings::getInstance().getSetting(Settings::General_Local8BitEncoding).toString());
	layout->addWidget(encoding_box, row, 2);
	
	row++;
	QCheckBox* ocd_importer_check = new QCheckBox(tr("Use the new OCD importer also for version 8 files"));
	ocd_importer_check->setChecked(Settings::getInstance().getSetting(Settings::General_NewOcd8Implementation).toBool());
	layout->addWidget(ocd_importer_check, row, 1, 1, 2);
	
	row++;
	layout->setRowStretch(row, 1);
	
#if defined(Q_OS_MAC)
	// Center setting items
	layout->setColumnStretch(0, 2);
#endif
	layout->setColumnStretch(2, 1);
	layout->setColumnStretch(2, 2);
	layout->setColumnStretch(layout->columnCount(), 2);
	
	connect(language_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &GeneralPage::languageChanged);
	connect(language_file_button, &QAbstractButton::clicked, this, &GeneralPage::openTranslationFileDialog);
	connect(ppi_edit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &GeneralPage::ppiChanged);
	connect(ppi_calculate_button, &QAbstractButton::clicked, this, &GeneralPage::openPPICalculationDialog);
	connect(open_mru_check, &QAbstractButton::clicked, this, &GeneralPage::openMRUFileClicked);
	connect(tips_visible_check, &QAbstractButton::clicked, this, &GeneralPage::tipsVisibleClicked);
	connect(encoding_box, &QComboBox::currentTextChanged, this, &GeneralPage::encodingChanged);
	connect(ocd_importer_check, &QAbstractButton::clicked, this, &GeneralPage::ocdImporterClicked);
	connect(autosave_check, &QAbstractButton::clicked, this, &GeneralPage::autosaveChanged);
	connect(autosave_interval_edit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &GeneralPage::autosaveIntervalChanged);
	connect(compatibility_check, &QAbstractButton::clicked, this, &GeneralPage::retainCompatibilityChanged);
}
コード例 #21
0
ファイル: qribbonsection.cpp プロジェクト: hdijkema/QRibbon
void QRibbonSection::nextColumn() {
    QGridLayout *l = (QGridLayout *) buttons->layout();
    colBase = l->columnCount();
    col = colBase;
    row = 0;
}
コード例 #22
0
void MainWindow::loadAllObjectRecords()
{
    DataLoader* dl = ct->loader;

    QMessageBox msgBox;
    int amountOfObjectRecords = dl->getAmountOfObjectRecords(objectsData[choosenObjectId].first);
    msgBox.setInformativeText(QString::fromUtf8("Czy chcesz załadować ") + QString::number(amountOfObjectRecords) + QString::fromUtf8(" rekordów?"));
    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
    msgBox.setDefaultButton(QMessageBox::Yes);
    msgBox.setIcon(QMessageBox::Question);
    msgBox.setWindowTitle(QString::fromUtf8("Pobieranie danych"));

    // workaround for not working setMinimumWidth:
    QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    if(msgBox.exec()==QMessageBox::Yes)
    {
        ct->loader->objectId = objectsData[choosenObjectId].first;
        QProgressDialog progress(QString::fromUtf8("Pobieranie rekordów dla wybranego obiektu..."), "Anuluj", 0, amountOfObjectRecords, this);
        progress.setWindowModality(Qt::WindowModal);
        dl->progessBar = &progress;
        progress.show();
        progress.setValue(0);
        dl->initDataRecordTable();
        dl->loadAllRecords();

        if(progress.wasCanceled())
            return;

        progress.setLabelText(QString::fromUtf8("Pobieranie danych anomalii dla wybranego obiektu..."));
        progress.setCancelButtonText("Anuluj");
        progress.setMinimum(0);
        progress.setValue(0);

        dl->loadMeasurementInfo();
        dl->setAlarmFlagToRecords();
        ct->dataset->setMinMaxFromDataset();

        if(!progress.wasCanceled())
        {
            this->statusOfObjectDataLoad = true;
            ui->livelogTab->setEnabled(true);
            ui->changeRefreshTimeBtn->setEnabled(false);
            ui->refreshIntervalSpin->setEnabled(false);
            ui->filterValuesLivelogBtn->setEnabled(false);
            ui->startLivelogBtn->setEnabled(true);
            ui->stopLivelogBtn->setEnabled(false);
            ui->linearScaleLivelogRadioButton->setEnabled(false);
            ui->logScaleLivelogRadioButton->setEnabled(false);

            ui->anomalyDetectionTab->setEnabled(true);
            ui->leftBtn->setEnabled(false);
            ui->rightBtn->setEnabled(false);
            ui->linearScaleRadioButton->setEnabled(false);
            ui->logScaleRadioButton->setEnabled(false);

            ui->dataOverviewTab->setEnabled(true);
            ui->refreshDatabaseTable->setEnabled(true);
            ui->datasetTableView->setEnabled(true);

            ui->reportsTab->setEnabled(true);
            ui->subscriptionTab->setEnabled(true);

            ui->reportDataRangeFrom->setMaximum(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-2);
            ui->reportDataRangeTo->setMaximum(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-1);
            ui->reportDataRangeTo->setValue(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-1);

            ct->dataRecordSize = ct->dataset->datasetControler->dataset->dataTable->dataNames.size();

            ui->webView->initFilter(ct->dataRecordSize);

            registerMethods();

            QMessageBox msgBoxOK;
            msgBoxOK.setInformativeText(QString::fromUtf8("Dane zostały pobrane."));
            msgBoxOK.setStandardButtons(QMessageBox::Ok);
            msgBoxOK.setDefaultButton(QMessageBox::Ok);
            msgBoxOK.setIcon(QMessageBox::Information);
            msgBoxOK.setWindowTitle(QString::fromUtf8("Pobrano"));

            // workaround for not working setMinimumWidth:
            QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
            QGridLayout* layout = (QGridLayout*)msgBoxOK.layout();
            layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

            msgBoxOK.exec();
        }
    }
}
コード例 #23
0
void MainWindow::loadDataDate(){
    QDateTime beginDate = ui->loadFromDateTime->dateTime();
    QDateTime endDate = ui->loadToDateTime->dateTime();

    QPair<int,int> interval = ct->dataset->getIndexRecordInterval(beginDate, endDate);


    int count = interval.second - interval.first;
    if(endDate <= beginDate)
    {
        QMessageBox msgBox;;
        msgBox.setInformativeText(QString::fromUtf8("Data końca musi być późniejsza niż początku"));
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.setWindowTitle(QString::fromUtf8("Błędny zakres dat"));

        // workaround for not working setMinimumWidth:
        QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        QGridLayout* layout = (QGridLayout*)msgBox.layout();
        layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

        msgBox.exec();
    }
    else if(count > CHART_RECORDS_LIMIT)
    {
        QMessageBox msgBox;;
        msgBox.setInformativeText(QString::fromUtf8("Wybrany przedział zawiera ") + QString::number(count) + QString::fromUtf8(" rekordów.\nMaksymalna liczba rekordów do wyświetlenia to ") + QString::number(CHART_RECORDS_LIMIT) + ".");
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.setWindowTitle(QString::fromUtf8("Przekroczono limit"));

        // workaround for not working setMinimumWidth:
        QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        QGridLayout* layout = (QGridLayout*)msgBox.layout();
        layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

        msgBox.exec();
    }
    else if(count <= 0)
    {
        QMessageBox msgBox;;
        msgBox.setInformativeText(QString::fromUtf8("Brak pomiarów w wybranym przedziale czasu"));
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.setWindowTitle(QString::fromUtf8("Brak rekordów"));

        // workaround for not working setMinimumWidth:
        QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        QGridLayout* layout = (QGridLayout*)msgBox.layout();
        layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

        msgBox.exec();
    }
    else
    {
        ui->webView->setDataset(ct->dataset->datasetControler->dataset);
        ui->webView->setInterval(interval.first, interval.second);

        ui->loadFromSpinBox->setValue(interval.first);
        ui->loadToSpinBox->setValue(interval.second);

        ui->fromProcessSpinBox->setValue(interval.first);
        ui->toProcessSpinBox->setValue(interval.second);

        redrawDataset();

        ui->leftBtn->setEnabled(true);
        ui->rightBtn->setEnabled(true);
        ui->linearScaleRadioButton->setEnabled(true);
        ui->logScaleRadioButton->setEnabled(true);
    }

}
コード例 #24
0
ファイル: toolsbar.cpp プロジェクト: hfiguiere/rolisteam
void ToolsBar::createTools()
{
    // Creationm_actionGroup des boutons du toolBar
    m_actionGroup = new QActionGroup(this);
    QToolButton *penButton     = new QToolButton(m_mainWidget);
    QToolButton *LineButton      = new QToolButton(m_mainWidget);
    QToolButton *emptyRectButton   = new QToolButton(m_mainWidget);
    QToolButton *filledRectButton  = new QToolButton(m_mainWidget);
    QToolButton *emptyEllipseButton   = new QToolButton(m_mainWidget);
    QToolButton *FilledEllipseButton  = new QToolButton(m_mainWidget);
    QToolButton *textButton      = new QToolButton(m_mainWidget);
    QToolButton *handButton       = new QToolButton(m_mainWidget);
    QToolButton *addNpcButton   = new QToolButton(m_mainWidget);
    QToolButton *delNpcButton   = new QToolButton(m_mainWidget);
    QToolButton *moveNpcButton = new QToolButton(m_mainWidget);
    QToolButton *stateNpcButton    = new QToolButton(m_mainWidget);
    QToolButton *resetNumberButton  = new QToolButton(m_mainWidget);

	// Association des boutons avec les actions
    penButton     ->setDefaultAction(m_pencilAct);
    LineButton      ->setDefaultAction(m_lineAct);
    emptyRectButton   ->setDefaultAction(m_rectAct);
    filledRectButton  ->setDefaultAction(m_filledRectAct);
    emptyEllipseButton   ->setDefaultAction(m_ellipseAct);
    FilledEllipseButton  ->setDefaultAction(m_filledEllipseAct);
    textButton      ->setDefaultAction(m_textAct);
    handButton       ->setDefaultAction(m_handAct);
    addNpcButton   ->setDefaultAction(m_addNpcAct);
    delNpcButton   ->setDefaultAction(m_delNpcAct);
    moveNpcButton ->setDefaultAction(m_moveCharacterAct);
    stateNpcButton    ->setDefaultAction(m_changeCharacterState);
    resetNumberButton  ->setDefaultAction(m_resetCountAct);


	m_actionGroup->addAction(m_pencilAct);
	m_actionGroup->addAction(m_lineAct);
	m_actionGroup->addAction(m_rectAct);
	m_actionGroup->addAction(m_filledRectAct);
	m_actionGroup->addAction(m_ellipseAct);
	m_actionGroup->addAction(m_filledEllipseAct);
	m_actionGroup->addAction(m_textAct);

	m_actionGroup->addAction(m_handAct);
	m_actionGroup->addAction(m_addNpcAct);
	m_actionGroup->addAction(m_delNpcAct);
	m_actionGroup->addAction(m_moveCharacterAct);
	m_actionGroup->addAction(m_changeCharacterState);
    //m_actionGroup->addAction(actionRazChrono);

    connect(m_actionGroup,SIGNAL(triggered(QAction*)),this,SLOT(currentToolHasChanged(QAction*)));

	// Boutons en mode AutoRaise, plus lisible
    penButton->setAutoRaise(true);
    LineButton->setAutoRaise(true);
    emptyRectButton->setAutoRaise(true);
    filledRectButton->setAutoRaise(true);
    emptyEllipseButton->setAutoRaise(true);
    FilledEllipseButton->setAutoRaise(true);
    textButton->setAutoRaise(true);
    handButton->setAutoRaise(true);
    addNpcButton->setAutoRaise(true);
    delNpcButton->setAutoRaise(true);
    moveNpcButton->setAutoRaise(true);
    stateNpcButton->setAutoRaise(true);
    resetNumberButton->setAutoRaise(true);
	
	// Changement de la taille des icones
	QSize tailleIcones(DEFAULT_ICON_SIZE,DEFAULT_ICON_SIZE);
    penButton     ->setIconSize(tailleIcones);
    LineButton      ->setIconSize(tailleIcones);
    emptyRectButton   ->setIconSize(tailleIcones);
    filledRectButton  ->setIconSize(tailleIcones);
    emptyEllipseButton   ->setIconSize(tailleIcones);
    FilledEllipseButton  ->setIconSize(tailleIcones);
    textButton      ->setIconSize(tailleIcones);
    handButton       ->setIconSize(tailleIcones);
    addNpcButton   ->setIconSize(tailleIcones);
    delNpcButton   ->setIconSize(tailleIcones);
    moveNpcButton ->setIconSize(tailleIcones);
    stateNpcButton    ->setIconSize(tailleIcones);
    resetNumberButton  ->setIconSize(tailleIcones);
				
	// Creation du layout vertical qui constitue la barre d'outils
    QVBoxLayout *outilsLayout = new QVBoxLayout(m_mainWidget);
	outilsLayout->setSpacing(0);
	outilsLayout->setMargin(2);

	// Creation du layout qui contient les outils de dessin
	QGridLayout *layoutDessin = new QGridLayout();
	layoutDessin->setSpacing(0);
	layoutDessin->setMargin(0);
    layoutDessin->addWidget(penButton, 0, 0);
    layoutDessin->addWidget(LineButton, 0, 1);
    layoutDessin->addWidget(emptyRectButton, 1, 0);
    layoutDessin->addWidget(filledRectButton, 1, 1);
    layoutDessin->addWidget(emptyEllipseButton, 2, 0);
    layoutDessin->addWidget(FilledEllipseButton, 2, 1);
    layoutDessin->addWidget(textButton, 3, 0);
    layoutDessin->addWidget(handButton, 3, 1);

	// Creation des zones de texte et de nom de PNJ
    m_textEdit = new QLineEdit(m_mainWidget);
    m_textEdit->setToolTip(tr("Text"));

    m_npcNameEdit = new QLineEdit(m_mainWidget);
    m_npcNameEdit->setToolTip(tr("NPC name"));
	
	// Creation de l'afficheur du numero de PNJ
    m_showPnjNumber = new QLCDNumber(2, m_mainWidget);
    m_showPnjNumber->setSegmentStyle(QLCDNumber::Flat);
    m_showPnjNumber->setMaximumSize(DEFAULT_ICON_SIZE + 7, DEFAULT_ICON_SIZE);
    m_showPnjNumber->display(1);
    m_showPnjNumber->setToolTip(tr("NPC Number"));

	m_currentNpcNumber = 1;
	
    // Creation du selecteur de m_color
    m_color = new ColorSelector(m_mainWidget);

	// Creation du layout contient les outils de deplcement des PNJ
	QHBoxLayout *layoutMouvementPnj = new QHBoxLayout();
	layoutMouvementPnj->setSpacing(0);
	layoutMouvementPnj->setMargin(0);
    layoutMouvementPnj->addWidget(moveNpcButton);
    layoutMouvementPnj->addWidget(stateNpcButton);

	// Creation du layout contient les outils d'ajout et de suppression des PNJ
	QGridLayout *layoutAjoutPnj = new QGridLayout();
	layoutAjoutPnj->setSpacing(0);
	layoutAjoutPnj->setMargin(0);
    layoutAjoutPnj->addWidget(addNpcButton, 0, 0);
    layoutAjoutPnj->addWidget(delNpcButton, 0, 1);
    layoutAjoutPnj->addWidget(resetNumberButton, 1, 0);
    layoutAjoutPnj->addWidget(m_showPnjNumber, 1, 1, Qt::AlignHCenter);
	
	// Creation du selecteur de diametre du trait
    m_lineDiameter = new DiameterSelector(m_mainWidget, true, 1, 45);
	m_lineDiameter->setToolTip(tr("Line's Width"));
	connect(m_lineDiameter,SIGNAL(diameterChanged(int)),this,SIGNAL(currentPenSizeChanged(int)));


    // Creation du selecteur de diametre des PNJ
    m_npcDiameter = new DiameterSelector(m_mainWidget, false, 12, 200);
    m_npcDiameter->setToolTip(tr("NPC Size"));
	connect(m_npcDiameter,SIGNAL(diameterChanged(int)),this,SIGNAL(currentNpcSizeChanged(int)));

	//Creation du separateur se trouvant entre le selecteur de couleur et les outils de dessin
    QFrame *separateur1 = new QFrame(m_mainWidget);
	separateur1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur1->setMinimumHeight(15);
	separateur1->setLineWidth(1);
	separateur1->setMidLineWidth(0);
	
	// Creation du separateur se trouvant entre les outils de dessin et le selecteur de diametre du trait
    QWidget *separateur2 = new QWidget(m_mainWidget);
	separateur2->setFixedHeight(3);
	
	//Creation du separateur se trouvant entre les outils de dessin et ceux de deplacement des PNJ
    QFrame *separateur3 = new QFrame(m_mainWidget);
	separateur3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur3->setMinimumHeight(10);
	separateur3->setLineWidth(1);
	separateur3->setMidLineWidth(0);

	//Creation du separateur se trouvant entre les outils de deplacement et ceux d'ajout des PNJ
    QFrame *separateur4 = new QFrame(m_mainWidget);
	separateur4->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	separateur4->setMinimumHeight(10);
	separateur4->setLineWidth(1);
	separateur4->setMidLineWidth(0);

	// Creation du separateur se trouvant au dessus du selecteur de diametre des PNJ
    QWidget *separateur5 = new QWidget(m_mainWidget);
	separateur5->setFixedHeight(3);
	
	// Ajout des differents layouts et widgets dans outilsLayout
    outilsLayout->addWidget(m_color);
	outilsLayout->addWidget(separateur1);
	outilsLayout->addLayout(layoutDessin);

	outilsLayout->addWidget(m_textEdit);
	outilsLayout->addWidget(separateur2);
	outilsLayout->addWidget(m_lineDiameter);
	outilsLayout->addWidget(separateur3);
	outilsLayout->addLayout(layoutMouvementPnj);
	outilsLayout->addWidget(separateur4);
	outilsLayout->addLayout(layoutAjoutPnj);

	outilsLayout->addWidget(m_npcNameEdit);
	outilsLayout->addWidget(separateur5);
        //if(PlayersList::instance().localPlayer()->isGM())
    outilsLayout->addWidget(m_npcDiameter);
        //outilsLayout->addWidget(m_pcDiameter);
	// Alignement du widget outils sur le haut du dockWidget
    layout()->setAlignment(m_mainWidget, Qt::AlignTop | Qt::AlignHCenter);
	// Contraintes de taille sur la barre d'outils
    m_mainWidget->setFixedWidth((DEFAULT_ICON_SIZE+8)*layoutDessin->columnCount());
	setMaximumWidth((DEFAULT_ICON_SIZE+8)*layoutDessin->columnCount()+10);
}