コード例 #1
0
QFormLayout* RenderSettingsWindow::create_form_layout()
{
    QFormLayout* layout = new QFormLayout();
    layout->setLabelAlignment(Qt::AlignRight);
    layout->setSpacing(10);
    return layout;
}
コード例 #2
0
void OBSPropertiesView::RefreshProperties()
{
	children.clear();
	if (widget)
		widget->deleteLater();

	widget = new QWidget();

	QFormLayout *layout = new QFormLayout;
	layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
	widget->setLayout(layout);

	QSizePolicy mainPolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	//widget->setSizePolicy(policy);
	layout->setSizeConstraint(QLayout::SetMaximumSize);
	layout->setLabelAlignment(Qt::AlignRight);

	obs_property_t property = obs_properties_first(properties);

	while (property) {
		AddProperty(property, layout);
		obs_property_next(&property);
	}

	setWidgetResizable(true);
	setWidget(widget);
	setSizePolicy(mainPolicy);

	lastFocused.clear();
	if (lastWidget) {
		lastWidget->setFocus(Qt::OtherFocusReason);
		lastWidget = nullptr;
	}
}
コード例 #3
0
QWidget* AutoImportWindow::setupInputFolderContainer() {
    GroupContainer* container = new GroupContainer();
    container->setTitle("Import Folder");

    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(0);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

    BrowserWidget* filesDirBrowser_ = new BrowserWidget(BrowserWidget::BrowseType::DIRECTORY);
    ParametersConfiguration* conf  = projectData.projectParameterData();
    QString importImagesPath = conf->getValue("import_dir");
    filesDirBrowser_->setPath(importImagesPath);
    setupWatcherPaths();
    connect(filesDirBrowser_, &BrowserWidget::pathChanged, [ = ] (const QString & value){
        conf->set("import_dir", value);
        setupWatcherPaths();
        analyzeImport();
    });
    layout->addRow(filesDirBrowser_);

    QLabel* introLabel = new QLabel(introText());
    introLabel->setWordWrap(true);
    QPalette pal = introLabel->palette();
    pal.setColor(QPalette::WindowText, Qt::darkGray);
    introLabel->setPalette(pal);
    layout->addRow(introLabel);

    QCheckBox* restartCheck = new QCheckBox("Import new images in the import folder on start");
    restartCheck->setChecked(ProjectPreferences().importRestartCheck());
    connect(restartCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportRestartCheck(check);
    });
    layout->addRow(restartCheck);

    
    layout->addRow(continuous);
    
    deleteCheck = new QCheckBox("DELETE the original images in import folder after importing them");
    deleteCheck->setChecked(ProjectPreferences().importDeleteCheck());
    deleteLabel_->setVisible(deleteCheck->isChecked());
    connect(deleteCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportDeleteCheck(check);
        deleteLabel_->setVisible(check);
    });
    layout->addRow(deleteCheck);
    
    container->setContainerLayout(layout);

    return container;
}
コード例 #4
0
QWidget* PreferencesDialog::getGeneralPage() {
    GroupContainer* widget = new GroupContainer();
    widget->setTitle("General");
    
    QFormLayout* mainLayout = new QFormLayout;
    mainLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);
    mainLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    mainLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    mainLayout->setLabelAlignment(Qt::AlignRight);
    
    QCheckBox* autoSaveBox = new QCheckBox("Automatically save configurations when they are changed");
    autoSaveBox->setChecked(UserPreferences().autoSaveConfigs());
    connect(autoSaveBox, &QCheckBox::toggled, [=](bool check){
        UserPreferences().setAutoSaveConfigs(check);
        projectData.setAutoSave(check);
    });
    mainLayout->addRow(autoSaveBox);
    
    QCheckBox* advancedBox = new QCheckBox("Show advanced by default (valid on restart)");
    advancedBox->setChecked(UserPreferences().showAdvanced());
    connect(advancedBox, &QCheckBox::toggled, [=](bool check){
        UserPreferences().setShowAdvanced(check);
    });
    mainLayout->addRow(advancedBox);
     
    QSlider* outputVerbosityControl = new QSlider;
    outputVerbosityControl->setOrientation(Qt::Horizontal);
    outputVerbosityControl->setFixedSize(100, 20);
    outputVerbosityControl->setMinimum(0);
    outputVerbosityControl->setMaximum(3);
    outputVerbosityControl->setTickPosition(QSlider::TicksBothSides);
    outputVerbosityControl->setTickInterval(1);
    outputVerbosityControl->setSingleStep(1);
    outputVerbosityControl->setValue(UserPreferences().userLevel());
    connect(outputVerbosityControl, &QSlider::valueChanged, [=] (int level) {
        UserPreferences().setUserLevel(level);
    });
    mainLayout->addRow("Default verbosity level (valid on restart)", outputVerbosityControl);
    
    widget->setContainerLayout(mainLayout);
    
    QWidget* pageWid = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(widget);
    layout->addStretch(1);
    pageWid->setLayout(layout);
    
    return pageWid;
}
コード例 #5
0
ファイル: editTrackContent.cpp プロジェクト: tavu/karakaxa
void editTrackContent::tagInit()
{

    for ( int i=0; i<FRAME_NUM; i++ )
    {
        if ( i==COMMENT )
        {
            editors[i]=0;
            continue;
        }

        editors[i]=views::getEditor ( i,this );
        if ( editors[i]==0 )
        {
            continue;
        }

        QVariant v=file->tag ( i,audioFile::ONCACHE & ~audioFile::TITLEFP );
        QByteArray n = editors[i]->metaObject()->userProperty().name();
        editors[i]->setProperty ( n, v );
    }

    commentL=new QTextEdit ( this );
    commentL->setPlainText ( file->tag ( COMMENT,audioFile::ONCACHE ).toString() );

    tagW=new QWidget ( this );
    QFormLayout *form = new QFormLayout();
    form->setLabelAlignment ( Qt::AlignLeft );

    year.setText ( tr ( "Year:" ) );

    QHBoxLayout *hLayout=new QHBoxLayout();
    hLayout->addWidget ( editors[TRACK] );
    hLayout->addWidget ( &year );
    hLayout->addWidget ( editors[YEAR] );

    form->addRow ( tr ( "Title: " ),editors[TITLE] );
    form->addRow ( tr ( "Album: " ),editors[ALBUM] );
    form->addRow ( tr ( "Artist: " ),editors[ARTIST] );
    form->addRow ( tr ( "Lead Artist: " ),editors[LEAD_ARTIST] );
    form->addRow ( tr ( "Genre:" ),editors[GENRE] );
    form->addRow ( tr ( "Composer: " ),editors[COMPOSER] );
    form->addRow ( tr ( "Track:" ),hLayout );
    form->addRow ( tr ( "Comment " ),commentL );

    tagW->setLayout ( form );
}
コード例 #6
0
QWidget* PreferencesDialog::getFontsPage() {
    QWidget* widget = new QWidget();

    //---------------------
    // Font
    //---------------------
    GroupContainer *fontGroup = new GroupContainer;
    fontGroup->setTitle("Font");

    //Font Size
    QSpinBox* fontSizeCombo = new QSpinBox;
    fontSizeCombo->setMinimum(8);
    fontSizeCombo->setMaximum(14);
    fontSizeCombo->setValue(QApplication::font().pointSize());

    connect(fontSizeCombo, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), 
            [=] (int i){UserPreferences().setFontSize(i);});

    //Font Weight
    QComboBox *fontWeightCombo = new QComboBox;
    fontWeightCombo->addItems(QStringList() << "0" << "25" << "50" << "75");
    fontWeightCombo->setCurrentText(QString::number(QApplication::font().weight()));

    connect(fontWeightCombo, static_cast<void(QComboBox::*)(const QString&)> (&QComboBox::currentTextChanged),
            [ = ] (const QString & value){UserPreferences().setFontWeight(value);});

    QFormLayout *fontLayout = new QFormLayout;
    fontLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);
    fontLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    fontLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    fontLayout->setLabelAlignment(Qt::AlignRight);
    fontLayout->addRow("Font Size", fontSizeCombo);
    fontLayout->addRow("Font Weight", fontWeightCombo);

    fontGroup->setContainerLayout(fontLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(fontGroup);
    mainLayout->addStretch(1);
    widget->setLayout(mainLayout);
    return widget;
}
コード例 #7
0
ファイル: editTrackContent.cpp プロジェクト: tavu/karakaxa
void editTrackContent::infoInit()
{
    infoW=new QWidget ( this );

    QFormLayout *form = new QFormLayout();
    form->setLabelAlignment ( Qt::AlignLeft );

    lengthF.setText ( "<b>"+prettyLength ( file->tag ( LENGTH ).toInt() ) +"</b>" );
    form->addRow ( tr ( "length: " ),&lengthF );

    bitRateF.setText ( "<b>"+file->tag ( BITRATE ).toString() +"</b>" );
    form->addRow ( tr ( "Bit rate: " ),&bitRateF );

    sizeF.setText ( "<b>"+prettySize ( file->size() ) +"</b>" );
    form->addRow ( tr ( "Size: " ),&sizeF );

    formatF.setText ( "<b>"+file->format() +"</b>" );
    form->addRow ( tr ( "Format: " ),&formatF );

    infoW->setLayout ( form );
}
コード例 #8
0
SVNCommitDialog::SVNCommitDialog(QWidget *parent, const QString &workingDir,
                                 const QStringList &files, bool folderOnly,
                                 int sceneIconAdded)
    : Dialog(TApp::instance()->getMainWindow(), true, false)
    , m_commitSceneContentsCheckBox(0)
    , m_workingDir(workingDir)
    , m_files(files)
    , m_folderOnly(folderOnly)
    , m_targetTempFile(0)
    , m_selectionCheckBox(0)
    , m_selectionLabel(0)
    , m_sceneIconAdded(sceneIconAdded)
    , m_folderAdded(0) {
  setModal(false);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(tr("Version Control: Put changes"));

  if (m_folderOnly)
    setMinimumSize(320, 320);
  else
    setMinimumSize(300, 180);

  QWidget *container = new QWidget;

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->setAlignment(Qt::AlignHCenter);
  mainLayout->setMargin(0);

  m_treeWidget = new QTreeWidget;
  m_treeWidget->header()->hide();
  m_treeWidget->hide();

  if (m_folderOnly) {
    m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_treeWidget->setIconSize(QSize(21, 17));
  }
  m_treeWidget->setStyleSheet("QTreeWidget { border: 1px solid gray; }");

  if (m_folderOnly) {
    mainLayout->addWidget(m_treeWidget);

    QHBoxLayout *belowTreeLayout = new QHBoxLayout;
    belowTreeLayout->setMargin(0);

    m_selectionCheckBox = new QCheckBox(tr("Select / Deselect All"), 0);
    connect(m_selectionCheckBox, SIGNAL(clicked(bool)), this,
            SLOT(onSelectionCheckBoxClicked(bool)));

    m_selectionLabel = new QLabel;
    m_selectionLabel->setText(tr("0 Selected / 0 Total"));

    m_selectionCheckBox->hide();
    m_selectionLabel->hide();

    belowTreeLayout->addWidget(m_selectionCheckBox);
    belowTreeLayout->addStretch();
    belowTreeLayout->addWidget(m_selectionLabel);

    mainLayout->addLayout(belowTreeLayout);
  }

  QHBoxLayout *hLayout = new QHBoxLayout;

  m_waitingLabel      = new QLabel;
  QMovie *waitingMove = new QMovie(":Resources/waiting.gif");
  waitingMove->setParent(this);

  m_waitingLabel->setMovie(waitingMove);
  waitingMove->setCacheMode(QMovie::CacheAll);
  waitingMove->start();

  m_textLabel = new QLabel;
  m_textLabel->setText(tr("Getting repository status..."));

  hLayout->addStretch();
  hLayout->addWidget(m_waitingLabel);
  hLayout->addWidget(m_textLabel);
  hLayout->addStretch();

  mainLayout->addLayout(hLayout);

  if (!m_folderOnly)
    mainLayout->addWidget(m_treeWidget);
  else
    mainLayout->addSpacing(10);

  QFormLayout *formLayout = new QFormLayout;
  formLayout->setLabelAlignment(Qt::AlignRight);
  formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
  formLayout->setSpacing(10);
  formLayout->setMargin(0);

  m_commentTextEdit = new QPlainTextEdit;
  m_commentTextEdit->setMaximumHeight(50);
  m_commentTextEdit->hide();

  m_commentLabel = new QLabel(tr("Comment:"));
  m_commentLabel->setFixedWidth(55);
  m_commentLabel->hide();

  formLayout->addRow(m_commentLabel, m_commentTextEdit);

  if (!m_folderOnly) {
    m_commitSceneContentsCheckBox = new QCheckBox(this);
    connect(m_commitSceneContentsCheckBox, SIGNAL(toggled(bool)), this,
            SLOT(onCommiSceneContentsToggled(bool)));
    m_commitSceneContentsCheckBox->setChecked(false);
    m_commitSceneContentsCheckBox->hide();
    m_commitSceneContentsCheckBox->setText(tr("Put Scene Contents"));
    formLayout->addRow("", m_commitSceneContentsCheckBox);
  }
コード例 #9
0
void REIXSXASScanConfigurationView::setupUi()
{
	setWindowTitle("Form");

	// mono groupBox layout
	QFormLayout *monoGroupBoxFormLayout = new QFormLayout();
	monoGroupBoxFormLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
	monoGroupBoxFormLayout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

	applyGratingBox_ = new QCheckBox("Grating");
	gratingBox_ = new QComboBox();
	monoGroupBoxFormLayout->setWidget(0, QFormLayout::LabelRole, applyGratingBox_);
	monoGroupBoxFormLayout->setWidget(0, QFormLayout::FieldRole, gratingBox_);

	applyMirrorBox_ = new QCheckBox("Mirror");
	mirrorBox_ = new QComboBox();
	monoGroupBoxFormLayout->setWidget(1, QFormLayout::LabelRole, applyMirrorBox_);
	monoGroupBoxFormLayout->setWidget(1, QFormLayout::FieldRole, mirrorBox_);

	applySlitWidthBox_ = new QCheckBox("Slit Width");
	slitWidthBox_ = createDoubleSpinBox(0, -500, 500, " um", 1, 5);
	monoGroupBoxFormLayout->setWidget(2, QFormLayout::LabelRole, applySlitWidthBox_);
	monoGroupBoxFormLayout->setWidget(2, QFormLayout::FieldRole, slitWidthBox_);

	monoGroupBoxFormLayout->setItem(3, QFormLayout::FieldRole, new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));

	estimatedTimeLabel_ = new QLabel("0 s");
	monoGroupBoxFormLayout->setWidget(4, QFormLayout::LabelRole, new QLabel("Estimated time:"));
	monoGroupBoxFormLayout->setWidget(4, QFormLayout::FieldRole, estimatedTimeLabel_);

	totalPointsLabel_ = new QLabel("0");
	monoGroupBoxFormLayout->setWidget(5, QFormLayout::LabelRole, new QLabel("Total points:"));
	monoGroupBoxFormLayout->setWidget(5, QFormLayout::FieldRole, totalPointsLabel_);


	// polarization groupBox layout
	QFormLayout *polarizationGroupBoxFormLayout = new QFormLayout();

	applyPolarizationBox_ = new QCheckBox("Polarization");
	polarizationBox_ = new QComboBox();
	polarizationGroupBoxFormLayout->setWidget(0, QFormLayout::LabelRole, applyPolarizationBox_);
	polarizationGroupBoxFormLayout->setWidget(0, QFormLayout::FieldRole, polarizationBox_);

	polarizationAngleBox_ = createDoubleSpinBox(0, -180, 180, " deg", 1, 10);
	polarizationGroupBoxFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Angle"));
	polarizationGroupBoxFormLayout->setWidget(1, QFormLayout::FieldRole, polarizationAngleBox_);

	// scan metal info layout
	QFormLayout *scanMetaInfoFormLayout = new QFormLayout();
	scanMetaInfoFormLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);

	nameEdit_ = new QLineEdit();
	scanMetaInfoFormLayout->setWidget(0, QFormLayout::LabelRole, new QLabel("Name"));
	scanMetaInfoFormLayout->setWidget(0, QFormLayout::FieldRole, nameEdit_);

	sampleSelector_ = new AMSamplePre2013Selector(AMDatabase::database("user"));
	scanMetaInfoFormLayout->setWidget(1, QFormLayout::LabelRole, new QLabel("Sample"));
	scanMetaInfoFormLayout->setWidget(1, QFormLayout::FieldRole, sampleSelector_);

	namedAutomaticallyBox_ = new QCheckBox("from current sample");
	scanMetaInfoFormLayout->setWidget(2, QFormLayout::LabelRole, new QLabel("Set automatically"));
	scanMetaInfoFormLayout->setWidget(2, QFormLayout::FieldRole, namedAutomaticallyBox_);


	// layout the components
	topFrame_ = new AMTopFrame("Setup XAS Scan", QIcon(":/utilities-system-monitor.png"));

	QGroupBox *monoGroupBox = new QGroupBox("Monochromator");
	monoGroupBox->setLayout(monoGroupBoxFormLayout);

	QGroupBox *polarizationGroupBox = new QGroupBox("Polarization");
	polarizationGroupBox->setLayout(polarizationGroupBoxFormLayout);

	QGroupBox *scanMetaInfoGroupBox = new QGroupBox("Scan Meta-Information");
	scanMetaInfoGroupBox->setLayout(scanMetaInfoFormLayout);

	QHBoxLayout *horizontalLayout = new QHBoxLayout();
	horizontalLayout->addWidget(monoGroupBox);
	horizontalLayout->addItem(new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
	horizontalLayout->addWidget(polarizationGroupBox);
	horizontalLayout->addItem(new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
	horizontalLayout->addWidget(scanMetaInfoGroupBox);

	QVBoxLayout *innerVLayout = new QVBoxLayout();
	innerVLayout->setSpacing(0);
	innerVLayout->setContentsMargins(12, 12, 12, 12);
	innerVLayout->addLayout(horizontalLayout);
	innerVLayout->insertWidget(0, new AMStepScanAxisView("Region Configuration", config_));
	innerVLayout->addStretch();

	QVBoxLayout *outerVLayout = new QVBoxLayout();
	outerVLayout->insertWidget(0, topFrame_);
	outerVLayout->setContentsMargins(0, 0, 0, 0);
	outerVLayout->addLayout(innerVLayout);
	setLayout(outerVLayout);

}
コード例 #10
0
ファイル: ProcessingManager.cpp プロジェクト: C-CINA/2dx
QWidget* ProcessingManager::setupQueueContainer() {
    queueModel_ = new ProcessingModel(this);
    connect(&projectData, &ProjectData::toBeAddedToProcessingQueue, queueModel_, &ProcessingModel::addProcesses);
    
    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(2);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

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

    GroupContainer* container = new GroupContainer;
    container->setTitle("Processing Queue");
    container->setContainerLayout(queueLayout);
    
    
    QVBoxLayout* mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(10);
    mainLayout->addStretch(0);
    mainLayout->addWidget(jobcontainer, 0);
    mainLayout->addWidget(container, 1);
    
    QWidget* mainContainer = new QWidget;
    mainContainer->setLayout(mainLayout);
    mainContainer->setMaximumWidth(500);
    
    return mainContainer;
}
コード例 #11
0
HistoryWidget::HistoryWidget(QWidget *parent)
    : QDialog(parent)
{
    setObjectName("HistoryWidget");
    setWindowTitle(tr("History Data View"));

    // layout - top
    QHBoxLayout *horiLayoutTop = new QHBoxLayout();

    QPushButton *buttonQuit = new QPushButton(this);
    buttonQuit->setObjectName("buttonQuit");
    horiLayoutTop->addSpacing(25);
    horiLayoutTop->addWidget(buttonQuit, 0, Qt::AlignLeft);
    horiLayoutTop->addStretch();

    // button-export
    QPushButton *buttonExport = new QPushButton(this);
    buttonExport->setObjectName("buttonExport");
    horiLayoutTop->addWidget(buttonExport);
    horiLayoutTop->addStretch();

    // button-open
    QPushButton *buttonOpen = new QPushButton(this);
    buttonOpen->setObjectName("buttonOpen");
    horiLayoutTop->addWidget(buttonOpen);
    horiLayoutTop->addStretch();

    QFormLayout *formLayoutTime = new QFormLayout();
    formLayoutTime->setFormAlignment(Qt::AlignVCenter);
    horiLayoutTop->addLayout(formLayoutTime);
    horiLayoutTop->addStretch();

    QDateTimeEdit *dateTimeEditStart = new QDateTimeEdit(this);
    dateTimeEditStart->setObjectName("dateTimeEditStart");
    dateTimeEditStart->setDisplayFormat("yyyy-MM-dd HH:mm:ss");
    formLayoutTime->addRow(tr("Start Time:"), dateTimeEditStart);

    QDateTimeEdit *dateTimeEditEnd = new QDateTimeEdit(this);
    dateTimeEditEnd->setObjectName("dateTimeEditEnd");
    dateTimeEditEnd->setDisplayFormat("yyyy-MM-dd HH:mm:ss");
    formLayoutTime->addRow(tr("End Time:"), dateTimeEditEnd);

    //LBP
    QFormLayout *formLayoutLBP = new QFormLayout();
    formLayoutLBP->setFormAlignment(Qt::AlignVCenter);
    formLayoutLBP->setLabelAlignment(Qt::AlignRight);
    horiLayoutTop->addLayout(formLayoutLBP);
    horiLayoutTop->addStretch();
    QCheckBox *checkBoxLBPMajor = new QCheckBox(tr("Major"), this);
    checkBoxLBPMajor->setProperty("curveColor", "#101010");
    QCheckBox *checkBoxLBPMinor = new QCheckBox(tr("Minor"), this);
    checkBoxLBPMinor->setProperty("curveColor", "#101010");
    formLayoutLBP->addRow(tr("LBP:"), checkBoxLBPMajor);
    formLayoutLBP->addRow("", checkBoxLBPMinor);

    //RBP
    QFormLayout *formLayoutRBP = new QFormLayout();
    formLayoutRBP->setFormAlignment(Qt::AlignVCenter);
    formLayoutRBP->setLabelAlignment(Qt::AlignRight);
    horiLayoutTop->addLayout(formLayoutRBP);
    horiLayoutTop->addStretch();
    QCheckBox *checkBoxRBPMajor = new QCheckBox(tr("Major"), this);
    checkBoxRBPMajor->setProperty("curveColor", "#101010");
    QCheckBox *checkBoxRBPMinor = new QCheckBox(tr("Minor"), this);
    checkBoxRBPMinor->setProperty("curveColor", "#101010");
    formLayoutRBP->addRow(tr("RBP:"), checkBoxRBPMajor);
    formLayoutRBP->addRow("", checkBoxRBPMinor);

    //LRP
    QFormLayout *formLayoutLRP = new QFormLayout();
    formLayoutLRP->setFormAlignment(Qt::AlignVCenter);
    formLayoutLRP->setLabelAlignment(Qt::AlignRight);
    horiLayoutTop->addLayout(formLayoutLRP);
    horiLayoutTop->addStretch();
    QCheckBox *checkBoxLRPTheory = new QCheckBox(tr("Theory"), this);
    checkBoxLRPTheory->setProperty("curveColor", "#101010");
    QCheckBox *checkBoxLRPReal = new QCheckBox(tr("Real"), this);
    checkBoxLRPReal->setProperty("curveColor", "#101010");
    formLayoutLRP->addRow(tr("LRP:"), checkBoxLRPTheory);
    formLayoutLRP->addRow("", checkBoxLRPReal);

    //RRP
    QFormLayout *formLayoutRRP = new QFormLayout();
    formLayoutRRP->setFormAlignment(Qt::AlignVCenter);
    formLayoutRRP->setLabelAlignment(Qt::AlignRight);
    horiLayoutTop->addLayout(formLayoutRRP);
    horiLayoutTop->addStretch();
    QCheckBox *checkBoxRRPTheory = new QCheckBox(tr("Theory"), this);
    checkBoxRRPTheory->setProperty("curveColor", "#101010");
    QCheckBox *checkBoxRRPReal = new QCheckBox(tr("Real"), this);
    checkBoxRRPReal->setProperty("curveColor", "#101010");
    formLayoutRRP->addRow(tr("RRP:"), checkBoxRRPTheory);
    formLayoutRRP->addRow("", checkBoxRRPReal);

    // button-update
    QPushButton *buttonUpdate = new QPushButton(this);
    buttonUpdate->setObjectName("buttonUpdate");
    horiLayoutTop->addWidget(buttonUpdate);
    horiLayoutTop->addStretch();
/*
    // button-undo
    QPushButton *buttonUndo = new QPushButton(this);
    buttonUndo->setObjectName("buttonUndo");
    horiLayoutTop->addWidget(buttonUndo);
    horiLayoutTop->addStretch();
*/
    // middle - curves
    CurveWidget* curveHistory = new CurveWidget(tr("History Data View"), this, true);
    curveHistory->setMaximumWidth(10000000);
    curveHistory->setScaleLabelFormat("yyyy/MM/dd\n  HH:mm:ss");
    curveHistory->clear();

    QVBoxLayout *vertLayoutMain = new QVBoxLayout(this);
    vertLayoutMain->addLayout(horiLayoutTop);
    vertLayoutMain->addWidget(curveHistory);

    connect(buttonQuit, &QPushButton::clicked, this, [=](){
        this->accept();
    });

    connect(buttonOpen, &QPushButton::clicked, this, [=](){
        QFileDialog fileDialog(this,
                               tr("Open history database files"),
                               QApplication::applicationDirPath().append("/../data"),
                               tr("Data Base File (*.db *.mdb)"));
        if (fileDialog.exec() == QDialog::Rejected) {
            return;
        }

        // clear curve
        curveHistory->clear();

        //
        QStringList filePaths = fileDialog.selectedFiles();
        if (filePaths.isEmpty()) {
            return;
        }

        QString filePath = filePaths.first();
        if (filePath.isEmpty()) {
            return;
        }

        // open database
        if (!DataBaseMgr::instance().open(filePath)) {
            Q_ASSERT(false);
            return;
        }

        //
        QDateTime startTime = QDateTime::fromMSecsSinceEpoch(DataBaseMgr::instance().startTime());
        QDateTime endTime = QDateTime::fromMSecsSinceEpoch(DataBaseMgr::instance().endTime());
        dateTimeEditStart->setDateTimeRange(startTime, endTime);
        dateTimeEditEnd->setDateTimeRange(startTime, endTime);
        dateTimeEditEnd->setDateTime(endTime);
        dateTimeEditStart->setDateTime(startTime);

        // curve title
        curveHistory->setTitle(tr("History Data View")
                               .append(" (")
                               .append(QFileInfo(filePath).fileName())
                               .append(")"));
    });
    connect(buttonExport, &QPushButton::clicked, this, [=](){
        QStringList filePaths = QFileDialog::getOpenFileNames(this,
                                                              tr("Convert data base files to txt format and save..."),
                                                              QApplication::applicationDirPath().append("/../data"),
                                                              tr("Data Base File (*.db *.mdb)"));
        if (filePaths.isEmpty()) {
            return;
        }

        //
        if (DataBaseMgr::instance().convertToText(filePaths)) {
            QMessageBox::information(this, tr("Convert Database file"), tr("Convert successfully!"));
        } else {
            QMessageBox::information(this, tr("Convert Database file"), tr("Convert failed!"));
        }
    });

    connect(dateTimeEditStart, &QDateTimeEdit::dateTimeChanged, this, [=](const QDateTime &dateTime){
        QDateTime endDateTime = dateTimeEditEnd->dateTime();
        if (dateTime > endDateTime) {
            dateTimeEditStart->setDateTime(endDateTime);
        }
    });

    connect(dateTimeEditEnd, &QDateTimeEdit::dateTimeChanged, this, [=](const QDateTime &dateTime){
        QDateTime startDateTime = dateTimeEditStart->dateTime();
        if (dateTime < startDateTime) {
            dateTimeEditEnd->setDateTime(startDateTime);
        }
    });

    connect(checkBoxLBPMajor, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[0] = checked;
    });
    connect(checkBoxLBPMinor, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[1] = checked;
    });
    connect(checkBoxRBPMajor, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[2] = checked;
    });
    connect(checkBoxRBPMinor, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[3] = checked;
    });
    connect(checkBoxLRPTheory, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[4] = checked;
    });
    connect(checkBoxLRPReal, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[5] = checked;
    });
    connect(checkBoxRRPTheory, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[6] = checked;
    });
    connect(checkBoxRRPReal, &QCheckBox::toggled, this, [=](bool checked){
        _v_curve_checked[7] = checked;
    });

    connect(buttonUpdate, &QPushButton::clicked, this, [=](){
        // clear curve
        curveHistory->clear();

        QVector<QPointF> points;
        quint64 startTime = dateTimeEditStart->dateTime().toMSecsSinceEpoch();
        quint64 endTime = dateTimeEditEnd->dateTime().toMSecsSinceEpoch();

        // LBP-Major
        if (checkBoxLBPMajor->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("lMBrakeP", points, startTime, endTime)) {
                curveHistory->addCurve(tr("LBP-Major"), QPen(randomColor(0)), points);
            }
        }

        //QApplication::processEvents();

        // LBP-Minor
        if (checkBoxLBPMinor->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("lABrakeP", points, startTime, endTime)) {
                curveHistory->addCurve(tr("LBP-Minor"), QPen(randomColor(1)), points);
            }
        }

        //QApplication::processEvents();

        // RBP-Major
        if (checkBoxRBPMajor->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("rMBrakeP", points, startTime, endTime)) {
                curveHistory->addCurve(tr("RBP-Major"), QPen(randomColor(2)), points);
            }
        }

        //QApplication::processEvents();

        // RBP-Minor
        if (checkBoxRBPMinor->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("rABrakeP", points, startTime, endTime)) {
                curveHistory->addCurve(tr("RBP-Minor"), QPen(randomColor(3)), points);
            }
        }

        //QApplication::processEvents();

        // LRP-Theory
        if (checkBoxLRPTheory->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("lTheorySpd", points, startTime, endTime)) {
                curveHistory->addCurve(tr("LRP-Theory"), QPen(randomColor(4)), points);
            }
        }

        //QApplication::processEvents();

        // LRP-Real
        if (checkBoxLRPReal->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("lWheelSpd", points, startTime, endTime)) {
                curveHistory->addCurve(tr("LRP-Real"), QPen(randomColor(5)), points);
            }
        }

        //QApplication::processEvents();

        // RRP-Theory
        if (checkBoxRRPTheory->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("rTheorySpd", points, startTime, endTime)) {
                curveHistory->addCurve(tr("RRP-Theory"), QPen(randomColor(6)), points);
            }
        }

        //QApplication::processEvents();

        // RRP-Real
        if (checkBoxRRPReal->isChecked()) {
            // read
            points.clear();
            if (DataBaseMgr::instance().read("rWheelSpd", points, startTime, endTime)) {
                curveHistory->addCurve(tr("RRP-Real"), QPen(randomColor(7)), points);
            }
        }
    });
/*
    connect(buttonUndo, &QPushButton::clicked, this, [=](){
        curveHistory->setNormalScale();
    });
*/
    // finaly initialize
    checkBoxLBPMajor->setChecked(_v_curve_checked[0]);
    checkBoxLBPMinor->setChecked(_v_curve_checked[1]);
    checkBoxRBPMajor->setChecked(_v_curve_checked[2]);
    checkBoxRBPMinor->setChecked(_v_curve_checked[3]);
    checkBoxLRPTheory->setChecked(_v_curve_checked[4]);
    checkBoxLRPReal->setChecked(_v_curve_checked[5]);
    checkBoxRRPTheory->setChecked(_v_curve_checked[6]);
    checkBoxRRPReal->setChecked(_v_curve_checked[7]);
}
コード例 #12
0
MiniTargetWidget::MiniTargetWidget(Target *target, QWidget *parent) :
    QWidget(parent), m_target(target)
{
    Q_ASSERT(m_target);

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

    QGridLayout *gridLayout = new QGridLayout(this);

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

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

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

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

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

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

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

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

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

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

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

    gridLayout->addWidget(m_targetName, 0, 0);
    gridLayout->addWidget(m_targetIcon, 0, 1, 2, 1, Qt::AlignTop|Qt::AlignHCenter);
    gridLayout->addLayout(formLayout, 1, 0);
}
コード例 #13
0
ファイル: SIGEN_plugin.cpp プロジェクト: arosh/Vaa3D-SIGEN
static bool getConfig(QWidget *parent, sigen::interface::Options *options) {
  // http://vivi.dyndns.org/vivi/docs/Qt/layout.html
  QFormLayout *fLayout = new QFormLayout(parent);
  fLayout->setLabelAlignment(Qt::AlignRight);

  // http://doc.qt.io/qt-4.8/qlineedit.html
  QLineEdit *sxy_lineEdit = addDoubleEdit("1.0", parent);
  fLayout->addRow(QObject::tr("Scale XY"), sxy_lineEdit);

  QLineEdit *sz_lineEdit = addDoubleEdit("1.0", parent);
  fLayout->addRow(QObject::tr("Scale Z"), sz_lineEdit);

  QCheckBox *interp_checkbox = new QCheckBox("Interpolation", parent);
  interp_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", interp_checkbox);

  QLineEdit *vt_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Interpolation VT"), vt_lineEdit);

  QLineEdit *dt_lineEdit = addDoubleEdit("0.0", parent);
  fLayout->addRow(QObject::tr("Interpolation DT"), dt_lineEdit);

  // http://www.qtforum.org/article/2430/qcheckbox.html
  QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), vt_lineEdit, SLOT(setEnabled(bool)));
  QObject::connect(interp_checkbox, SIGNAL(toggled(bool)), dt_lineEdit, SLOT(setEnabled(bool)));

  QCheckBox *smoothing_checkbox = new QCheckBox("Smoothing", parent);
  smoothing_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", smoothing_checkbox);

  QLineEdit *sm_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Smoothing Level"), sm_lineEdit);

  QObject::connect(smoothing_checkbox, SIGNAL(toggled(bool)), sm_lineEdit, SLOT(setEnabled(bool)));

  QCheckBox *clipping_checkbox = new QCheckBox("Clipping", parent);
  clipping_checkbox->setCheckState(Qt::Checked);
  fLayout->addRow("", clipping_checkbox);

  QLineEdit *cl_lineEdit = addIntEdit("0", parent);
  fLayout->addRow(QObject::tr("Clipping Level"), cl_lineEdit);

  QObject::connect(clipping_checkbox, SIGNAL(toggled(bool)), cl_lineEdit, SLOT(setEnabled(bool)));

  QDialogButtonBox *buttonBox = new QDialogButtonBox(
      QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
      Qt::Horizontal,
      parent);

  QVBoxLayout *vLayout = new QVBoxLayout(parent);
  vLayout->addLayout(fLayout);
  vLayout->addWidget(buttonBox);

  QDialog *dialog = new QDialog(parent);
  dialog->setWindowTitle("SIGEN");
  dialog->setLayout(vLayout);
  dialog->setFixedSize(dialog->sizeHint());

  QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
  QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));

  bool retval;
  switch (dialog->exec()) {
  case QDialog::Accepted:
    retval = true;
    break;
  case QDialog::Rejected:
    retval = false;
    break;
  default:
    assert(false);
    break;
  }

  // v3d_msg(vt_lineEdit->text() + "/" + dt_lineEdit->text() + "/" + sm_lineEdit->text() + "/" + cl_lineEdit->text(), true);

  if (retval) {
    options->scale_xy = sxy_lineEdit->text().toDouble();
    options->scale_z = sz_lineEdit->text().toDouble();

    options->enable_interpolation = interp_checkbox->checkState() == Qt::Checked;
    options->volume_threshold = vt_lineEdit->text().toInt();
    options->distance_threshold = dt_lineEdit->text().toDouble();

    options->enable_smoothing = smoothing_checkbox->checkState() == Qt::Checked;
    options->smoothing_level = sm_lineEdit->text().toInt();

    options->enable_clipping = clipping_checkbox->checkState() == Qt::Checked;
    options->clipping_level = cl_lineEdit->text().toInt();
  }

  return retval;
}
コード例 #14
0
void SearchTab::createGui()
{
	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(2);
	layout->setSpacing(0);

	Splitter = new QSplitter(Qt::Horizontal, this);
	layout->addWidget(Splitter);

	QWidget *queryWidget = new QWidget(Splitter);
	QVBoxLayout *queryLayout = new QVBoxLayout(queryWidget);
	queryLayout->setMargin(3);

	QWidget *queryFormWidget = new QWidget(queryWidget);
	queryLayout->addWidget(queryFormWidget);

	QFormLayout *queryFormLayout = new QFormLayout(queryFormWidget);
	queryFormLayout->setLabelAlignment(Qt::AlignLeft | Qt::AlignHCenter);
	queryFormLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
	queryFormLayout->setMargin(0);

	Query = new QLineEdit(queryFormWidget);
	Query->setMinimumWidth(200);
	queryFormLayout->addRow(tr("Search for:"), Query);

	connect(Query, SIGNAL(returnPressed()), this, SLOT(performSearch()));

	SearchInChats = new QRadioButton(tr("Chats"), queryFormWidget);
	SearchInChats->setChecked(true);
	SelectChat = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectChat->setAllLabel(tr(" - All chats - "));
	SelectChat->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	queryFormLayout->addRow(SearchInChats, SelectChat);

	SearchInStatuses = new QRadioButton(tr("Statuses"), queryFormWidget);
	SelectStatusBuddy = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectStatusBuddy->setAllLabel(tr(" - All buddies - "));
	SelectStatusBuddy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	SelectStatusBuddy->setEnabled(false);
	queryFormLayout->addRow(SearchInStatuses, SelectStatusBuddy);

	SearchInSmses = new QRadioButton(tr("Smses"), queryFormWidget);
	SelectSmsRecipient = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectSmsRecipient->setAllLabel(tr(" - All recipients - "));
	SelectSmsRecipient->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	SelectSmsRecipient->setEnabled(false);
	queryFormLayout->addRow(SearchInSmses, SelectSmsRecipient);

	QButtonGroup *kindRadioGroup = new QButtonGroup(queryFormWidget);
	kindRadioGroup->addButton(SearchInChats);
	kindRadioGroup->addButton(SearchInStatuses);
	kindRadioGroup->addButton(SearchInSmses);
	connect(kindRadioGroup, SIGNAL(buttonReleased(QAbstractButton*)),
	        this, SLOT(kindChanged(QAbstractButton*)));

	SearchByDate = new QCheckBox(tr("By date"), queryFormWidget);
	SearchByDate->setCheckState(Qt::Unchecked);

	QWidget *dateWidget = new QWidget(queryFormWidget);

	QHBoxLayout *dateLayout = new QHBoxLayout(dateWidget);

	FromDate = new QDateEdit(dateWidget);
	FromDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	FromDate->setCalendarPopup(true);
	FromDate->setDate(QDate::currentDate().addDays(-7));
	dateLayout->addWidget(FromDate);

	dateLayout->addWidget(new QLabel(tr("to"), dateWidget));

	ToDate = new QDateEdit(dateWidget);
	ToDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	ToDate->setCalendarPopup(true);
	ToDate->setDate(QDate::currentDate());
	dateLayout->addWidget(ToDate);

	connect(FromDate, SIGNAL(dateChanged(QDate)), this, SLOT(fromDateChanged(QDate)));
	connect(ToDate, SIGNAL(dateChanged(QDate)), this, SLOT(toDateChanged(QDate)));
	connect(SearchByDate, SIGNAL(toggled(bool)), dateWidget, SLOT(setEnabled(bool)));

	dateWidget->setEnabled(false);
	queryFormLayout->addRow(SearchByDate, dateWidget);

	QPushButton *searchButton = new QPushButton(tr("Search"), queryFormWidget);
	searchButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	queryFormLayout->addRow(0, searchButton);

	connect(searchButton, SIGNAL(clicked()), this, SLOT(performSearch()));

	TimelineView = m_pluginInjectedFactory->makeInjected<TimelineChatMessagesView>(Splitter);
	TimelineView->setTalkableVisible(true);
	TimelineView->setTitleVisible(true);
	TimelineView->setLengthHeader(tr("Found"));
	connect(TimelineView, SIGNAL(currentDateChanged()), this, SLOT(currentDateChanged()));
	connect(TimelineView, SIGNAL(messagesDisplayed()), this, SLOT(messagesDisplayed()));

	TimelineView->searchBar()->setAutoVisibility(false);
	TimelineView->searchBar()->setSearchWidget(this);
	connect(TimelineView->searchBar(), SIGNAL(clearSearch()), this, SLOT(clearSelect()));

	setFocusProxy(Query);
}
コード例 #15
0
/// Display a form layout with an edit box
/// \param const QString& title title to display
/// \param const QScriptValue form to display (array containing labels and values)
/// \return QScriptValue result form (unchanged is dialog canceled)
QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptValue form) {
    if (form.isArray() && form.property("length").toInt32() > 0) {
        QDialog* editDialog = new QDialog(Application::getInstance()->getWindow());
        editDialog->setWindowTitle(title);
        
        QVBoxLayout* layout = new QVBoxLayout();
        editDialog->setLayout(layout);
        
        QScrollArea* area = new QScrollArea();
        layout->addWidget(area);
        area->setWidgetResizable(true);
        QWidget* container = new QWidget();
        QFormLayout* formLayout = new QFormLayout();
        container->setLayout(formLayout);
        container->sizePolicy().setHorizontalStretch(1);
        formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
        formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
        formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
        formLayout->setLabelAlignment(Qt::AlignLeft);
        
        area->setWidget(container);
        
        QVector<QLineEdit*> edits;
        for (int i = 0; i < form.property("length").toInt32(); ++i) {
            QScriptValue item = form.property(i);
            edits.push_back(new QLineEdit(item.property("value").toString()));
            formLayout->addRow(item.property("label").toString(), edits.back());
        }
        QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok);
        connect(buttons, SIGNAL(accepted()), editDialog, SLOT(accept()));
        layout->addWidget(buttons);
        
        if (editDialog->exec() == QDialog::Accepted) {
            for (int i = 0; i < form.property("length").toInt32(); ++i) {
                QScriptValue item = form.property(i);
                QScriptValue value = item.property("value");
                bool ok = true;
                if (value.isNumber()) {
                    value = edits.at(i)->text().toDouble(&ok);
                } else if (value.isString()) {
                    value = edits.at(i)->text();
                } else if (value.isBool()) {
                    if (edits.at(i)->text() == "true") {
                        value = true;
                    } else if (edits.at(i)->text() == "false") {
                        value = false;
                    } else {
                        ok = false;
                    }
                }
                if (ok) {
                    item.setProperty("value", value);
                    form.setProperty(i, item);
                }
            }
        }
        
        delete editDialog;
    }
    
    return form;
}
コード例 #16
0
void AM2DScanConfigurationGeneralView::createView(const QString &databaseName, const QString &tableName, int dbId)
{
	AMDatabase *database = AMDatabase::database(databaseName);
	if(database){
		QSqlQuery q = database->query();
		q.prepare("PRAGMA table_info("%tableName%")");
		if(!database->execQuery(q)) {
			q.finish();
			AMErrorMon::report(AMErrorReport(0, AMErrorReport::Debug, -275002, QString("2D Scan Configuration Generl View: There was an error while trying to read meta data on table %1.").arg(tableName)));
		}
		else{
			QStringList columnNames;
			while(q.next()){
				columnNames << q.value(1).toString();
			}
			columnNames.removeFirst();
			q.finish();

			QVariantList columnValues = database->retrieve(dbId, tableName, columnNames);

			QFormLayout *fl = new QFormLayout();
			QLabel *tempLabel;
			QString labelValue;

			labelValue = columnValues.at(columnNames.indexOf("xStart")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("X Start", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("xStep")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("X Step", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("xEnd")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("X End", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("yStart")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("Y Start", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("yStep")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("Y Step", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("yEnd")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("Y End", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("timeStep")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("Dwell Time", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("fastAxis")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("fastAxis", tempLabel);

			labelValue = columnValues.at(columnNames.indexOf("slowAxis")).toString();
			tempLabel = new QLabel(labelValue);
			fl->addRow("Slow Axis", tempLabel);

			fl->setLabelAlignment(Qt::AlignLeft);
			setLayout(fl);
		}
	}
}
コード例 #17
0
void SpriteGraphicsViewOption::_initWidgets ()
{
    _showSceneBorder = new QCheckBox(tr("Show scene border"));
    _backColor = new ColorButton;
    _zoom = new QComboBox;
    _showGrid = new QGroupBox(tr("Show grid"));
    _snap = new QCheckBox(tr("Snap to grid"));
    _gridColor = new ColorButton;
    _gridOpacity = new QSpinBox;
    _gridWidth = new QSpinBox;
    _gridHeight = new QSpinBox;
    _displaySelectionShadow = new QCheckBox(tr("Display selection shadow"));
    _selectionColor = new ColorButton;

    _zoom->addItem("800%", 8.0);
    _zoom->addItem("400%", 4.0);
    _zoom->addItem("200%", 2.0);
    _zoom->addItem("100%", 1.0);
    _zoom->addItem("50%", 0.5);
    _zoom->addItem("25%", 0.25);
    _showGrid->setStyleSheet("QGroupBox::title{font-bold:false}");
    _showGrid->setFlat(true);
    _showGrid->setCheckable(true);
    _gridOpacity->setMaximum(100);
    _gridOpacity->setSuffix("%");
    _gridWidth->setMinimum(1);
    _gridWidth->setSingleStep(8);
    _gridHeight->setMinimum(1);
    _gridHeight->setSingleStep(8);

    QFormLayout *styleLayout = new QFormLayout;
    styleLayout->addRow(tr("Color:"), _gridColor);
    styleLayout->addRow(tr("Opacity:"), _gridOpacity);
    styleLayout->setAlignment(_gridColor, Qt::AlignCenter);
    styleLayout->setLabelAlignment(Qt::AlignRight);
    _showGrid->setLayout(styleLayout);

    QGroupBox *gridGroup = new QGroupBox(tr("Grid"));
    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(_snap, 0, 0, 1, 2, Qt::AlignCenter);
    gridLayout->addWidget(new QLabel(tr("Width:")), 1, 0, 1, 1, Qt::AlignRight);
    gridLayout->addWidget(_gridWidth, 1, 1);
    gridLayout->addWidget(
        new QLabel(tr("Height:")), 2, 0, 1, 1, Qt::AlignRight
    );
    gridLayout->addWidget(_gridHeight, 2, 1);
    gridLayout->addWidget(_showGrid, 0, 3, 3, 1);
    gridLayout->setColumnMinimumWidth(2, 15);
    gridGroup->setLayout(gridLayout);

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(_showSceneBorder, 0, 0, 1, 2, Qt::AlignCenter);
    layout->addWidget(
        new QLabel(tr("Background color:")), 1, 0, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_backColor, 1, 1, 1, 1, Qt::AlignCenter);
    layout->addWidget(
        new QLabel(tr("Zoom:")), 2, 0, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_zoom, 2, 1);
    layout->addWidget(
        new QLabel(tr("Selection color:")), 0, 3, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_selectionColor, 0, 4);
    layout->addWidget(_displaySelectionShadow, 1, 3, 1, 2, Qt::AlignCenter);
    layout->addWidget(gridGroup, 3, 0, 1, 5, Qt::AlignCenter);
    layout->setColumnMinimumWidth(2, 15);
    setLayout(layout);
}
コード例 #18
0
ファイル: chatappearance.cpp プロジェクト: akahan/qutim
void ChatAppearance::makeSettings() {
	m_current_variables.clear();
	if (settingsWidget)
		delete settingsWidget;
	settingsWidget = new QWidget(this);
	QFormLayout *layout = new QFormLayout(settingsWidget);
	layout->setLabelAlignment(Qt::AlignLeft|Qt::AlignVCenter);
	QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	settingsWidget->setLayout(layout);
	QString category = "webkitstyle";
	StyleVariants variants = ChatStyleGenerator::listVariants(ThemeManager::path(category, m_current_style_name)
															  .append("/Contents/Resources/Variants"));
	if (!variants.isEmpty()) {
		QLabel *label = new QLabel(tr("Style variant:"), settingsWidget);
		label->setSizePolicy(sizePolicy);
		QComboBox *variantBox = new QComboBox(settingsWidget);
		layout->addRow(label, variantBox);
		StyleVariants::const_iterator it;
		for (it=variants.begin(); it!=variants.end(); it++)
			variantBox->addItem(it.key());
		connect(variantBox, SIGNAL(currentIndexChanged(QString)), SLOT(onVariantChanged(QString)));
		int index = isLoad ? variantBox->findText(m_current_variant) : 0;
		m_current_variant = variantBox->itemText(index);
		variantBox->setCurrentIndex(index);
		onVariantChanged(m_current_variant);
	}
	Config achat(QStringList()
				 << "appearance/adiumChat"
				 << ThemeManager::path(category,m_current_style_name)
				 .append("/Contents/Resources/custom.json"));
	ConfigGroup variables = achat;
	int count = variables.beginArray(m_current_style_name);
	for (int num = 0; num < count; num++) {
		ConfigGroup parameter = variables.arrayElement(num);
		QString type = parameter.value("type", QString());
		QString text = parameter.value("label", QString());
		text = parameter.value(QString("label-").append(QLocale().name()), text);
		CustomChatStyle style;
		style.parameter = parameter.value("parameter", QString());
		style.selector = parameter.value("selector", QString());
		style.value = parameter.value("value", QString());
		if (type == "font") {
			QLabel *label = new QLabel(text % ":", settingsWidget);
			label->setSizePolicy(sizePolicy);
			ChatFont *fontField = new ChatFont(style, settingsWidget);
			layout->addRow(label, fontField);
			connect(fontField, SIGNAL(changeValue()), SLOT(onVariableChanged()));
			if (ChatVariable *widget = qobject_cast<ChatVariable*>(fontField))
				m_current_variables.append(widget);
		} else if (type == "color") {
			QLabel *label = new QLabel(text % ":", settingsWidget);
			label->setSizePolicy(sizePolicy);
			ChatColor *colorField = new ChatColor(style, settingsWidget);
			layout->addRow(label, colorField);
			connect(colorField, SIGNAL(changeValue()), SLOT(onVariableChanged()));
			if (ChatVariable *widget = qobject_cast<ChatVariable*>(colorField))
				m_current_variables.append(widget);
		} else if (type == "numeric") {
			QLabel *label = new QLabel(text % ":", settingsWidget);
			label->setSizePolicy(sizePolicy);
			double min = parameter.value<double>("min", 0);
			double max = parameter.value<double>("max", 0);
			double step = parameter.value<double>("step", 1);
			ChatNumeric *numField = new ChatNumeric(style, min, max, step, settingsWidget);
			layout->addRow(label, numField);
			connect(numField, SIGNAL(changeValue()), SLOT(onVariableChanged()));
			if (ChatVariable *widget = qobject_cast<ChatVariable*>(numField))
				m_current_variables.append(widget);
		} else if (type == "boolean") {
			QString trueValue = parameter.value("true", QString());
			QString falseValue = parameter.value("false", QString());
			ChatBoolean *boolField = new ChatBoolean(style, trueValue, falseValue, settingsWidget);
			boolField->setText(text);
			layout->addRow(boolField);
			connect(boolField, SIGNAL(changeValue()), SLOT(onVariableChanged()));
			if (ChatVariable *widget = qobject_cast<ChatVariable*>(boolField))
				m_current_variables.append(widget);
		}
	}
	onVariableChanged();
	QSpacerItem *space = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
	layout->addItem(space);
	ui->scrollAreaLayout->addWidget(settingsWidget);
}
コード例 #19
0
ファイル: Dialog_Mail.cpp プロジェクト: Majestio/RegClient
Dialog_Mail::Dialog_Mail(QWidget *parent, QString iTitle, int *iIdx, DialogMailType iMode)
    : QDialog(parent)
{
    Mode = iMode;
    Idx = iIdx;
    setWindowTitle(iTitle);

    QAction *ActSend = new QAction(tr("Отправить"),this);
    ActSend->setIcon(QPixmap(":img/SendMail.png"));
    ActSend->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
    ActSend->setText(tr("&Отправить Сообщения"));
    ActSend->setToolTip(tr("Отправить Сообщения"));
    ActSend->setStatusTip(tr("Отправить Сообщения"));
    connect(ActSend, SIGNAL(triggered()), this, SLOT(SlotSend()));

    QAction *ActSave = new QAction(tr("Сохранить"),this);
    ActSave->setIcon(QPixmap(":img/Save.png"));
    ActSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
    ActSave->setText(tr("&Сохранить Сообщение"));
    ActSave->setToolTip(tr("Сохранить Сообщение"));
    ActSave->setStatusTip(tr("Сохранить Сообщение"));
    connect(ActSave, SIGNAL(triggered()), this, SLOT(SlotSave()));

    QAction *ActCancel = new QAction(tr("Отменить"),this);
    ActCancel->setIcon(QPixmap(":img/Cancel.png"));
    ActCancel->setShortcut(QKeySequence("ESC"));
    ActCancel->setText(tr("&Отменить Сообщение"));
    ActCancel->setToolTip(tr("Отменить Сообщение"));
    ActCancel->setStatusTip(tr("Отменить Сообщение"));
    connect(ActCancel, SIGNAL(triggered()), this, SLOT(SlotCancel()));

    QHBoxLayout *ToolLayout = new QHBoxLayout();
    ToolLayout->setMargin(0);
    QToolBar *ToolBar = new QToolBar();
    ToolBar->setOrientation(Qt::Horizontal);
    ToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    ToolLayout->addWidget(ToolBar);

    ToolBar->addAction(ActSend);
    ToolBar->addSeparator();
    ToolBar->addAction(ActSave);
    ToolBar->addSeparator();
    ToolBar->addAction(ActCancel);

    QFrame *ToolFrame = new QFrame();
    ToolFrame->setStyleSheet(QString("background-color: %1").arg(Global.Palette.color(QPalette::Window).name()));
    ToolFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    ToolFrame->setLayout(ToolLayout);

    QVBoxLayout *TBox = new QVBoxLayout();
    TBox->setMargin(0);
    Receiver = new QComboBox();
    Subj = new QLineEdit();
    Message = new QTextEdit();
    QFormLayout *Form = new QFormLayout();
    Form->addRow(tr("Получатель: "), Receiver);
    Form->addRow(tr("Тема: "), Subj);
    Form->setLabelAlignment(Qt::AlignRight);
    TBox->addLayout(Form,0);
    TBox->addWidget(Message,1);

    QFrame *Center = new QFrame();
    Center->setLayout(TBox);

    QVBoxLayout *Out = new QVBoxLayout();
    Out->addWidget(ToolFrame,0);
    Out->addSpacing(4);
    Out->addWidget(Center,1);
    setLayout(Out);
    setMinimumSize(480,320);
    Init();
}