コード例 #1
0
void PropertiesDialog::createPublishingBox()
{
	publishingBox = new QWidget;
	
	QFormLayout *publishingLayout = new QFormLayout;

    publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);

	QHBoxLayout * date = new QHBoxLayout;
	date->addWidget(new QLabel(tr("Day:")));
	date->addWidget(dayEdit = new YACReaderFieldEdit());
	dayValidator.setRange(1,31);
	dayEdit->setValidator(&dayValidator);
	date->addWidget(new QLabel(tr("Month:")));
	date->addWidget(monthEdit = new YACReaderFieldEdit());
	monthValidator.setRange(1,12);
	monthEdit->setValidator(&monthValidator);
	date->addWidget(new QLabel(tr("Year:")));
	date->addWidget(yearEdit = new YACReaderFieldEdit());
	yearValidator.setRange(1,9999);
	yearEdit->setValidator(&yearValidator);
	date->addStretch(1);

	publishingLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
	publishingLayout->addRow(date);
	publishingLayout->addRow(tr("Publisher:"), publisherEdit = new YACReaderFieldEdit());
	publishingLayout->addRow(tr("Format:"), formatEdit = new YACReaderFieldEdit());
	publishingLayout->addRow(tr("Color/BW:"), colorCheck = new QCheckBox());
	publishingLayout->addRow(tr("Age rating:"), ageRatingEdit = new YACReaderFieldEdit());

	publishingBox->setLayout(publishingLayout);
}
コード例 #2
0
JTextField::JTextField(MidpItem *item, JForm *form,
                       QString labelText, int layout, QString text,
                       int maxSize, int constraints, QString initialInputMode)
  : JItem(item, form)
{
  (void) layout;
  (void) maxSize;
//  (void) constraints;
  (void) initialInputMode;
  
  QFormLayout *formLayout = new QFormLayout(this);
  formLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
  tf_label = new QLabel(labelText, this);
  tf_body = new ExpandableTextEdit(text, this);
  tf_body->installEventFilter(this);
  setFocusProxy(tf_body);
  tf_label->setBuddy(tf_body);
  tf_label->setTextFormat(Qt::PlainText);
  tf_label->setWordWrap(true);
  formLayout->addRow(tf_label, tf_body);
  if (labelText.isEmpty())
    tf_label->hide();
  setConstraints(constraints);
  cont_changed = false;
  connect(tf_body, SIGNAL(textChanged()), SLOT(contentsModified()));
}
コード例 #3
0
/*!
    Constructs an UiSelectSignalDialog with the given \a parent.
*/
UiSelectSignalDialog::UiSelectSignalDialog(QWidget *parent) :
    QDialog(parent),
    mDigitalSignalsMap(),
    mAnalogSignalsMap()
{
    mAnalyzersBox = NULL;

    setWindowTitle(tr("Add Signal or Analyzer"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    // Deallocation:
    //   formLayout will be re-parented when calling verticalLayout->addLayout
    //   which means that it will be deleted when UiSimulatorConfigDialog is
    //   deleted.
    QFormLayout* formLayout = new QFormLayout;
    formLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);

    CaptureDevice* device = DeviceManager::instance().activeDevice()
            ->captureDevice();

    // digital signals
    QList<int> s = device->unusedDigitalIds();
    if (s.size() > 0) {
        formLayout->addRow(tr("Digital signals: "), createDigitalSignalBox(s));
    }


    // analog signals
    s = device->unusedAnalogIds();
    if (s.size() > 0) {
        formLayout->addRow(tr("Analog signals: "), createAnalogSignalBox(s));
    }

    // analyzers
    mAnalyzersBox = createAnalyzerBox();
    formLayout->addRow(tr("Analyzers: "), mAnalyzersBox);

    // Deallocation:
    //   Ownership is transfered to UiSelectSignalDialog when calling
    //   setLayout below.
    QVBoxLayout* verticalLayout = new QVBoxLayout();

    // Deallocation: "Qt Object trees" (See UiMainWindow)
    QDialogButtonBox* bottonBox = new QDialogButtonBox(
                QDialogButtonBox::Ok|QDialogButtonBox::Cancel,
                Qt::Horizontal,
                this);
    bottonBox->setCenterButtons(true);

    connect(bottonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(bottonBox, SIGNAL(rejected()), this, SLOT(reject()));

    verticalLayout->addLayout(formLayout);
    verticalLayout->addWidget(bottonBox);


    setLayout(verticalLayout);
}
コード例 #4
0
ファイル: transformation_tab.cpp プロジェクト: Leopardob/como
TransformationTab::TransformationTab( ComoAppPtr comoApp ) :
    comoApp_( comoApp )
{
    // Set this widget's layout.
    QFormLayout* layout = new QFormLayout;
    layout->setRowWrapPolicy( QFormLayout::WrapAllRows );
    layout->addRow( "Select pivot point mode:",
                    createPivotPointModeSelector( comoApp->getScene()->getEntitiesManager()->getLocalSelection() ) );
    setLayout( layout );
}
コード例 #5
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;
}
コード例 #6
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;
}
コード例 #7
0
void PropertiesDialog::createPlotBox()
{
	plotBox = new QWidget;

	QFormLayout *plotLayout = new QFormLayout;
    plotLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);

	plotLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
	plotLayout->addRow(tr("Synopsis:"), synopsis = new YACReaderFieldPlainTextEdit());
	plotLayout->addRow(tr("Characters:"), characters = new YACReaderFieldPlainTextEdit());
	plotLayout->addRow(tr("Notes:"), notes = new YACReaderFieldPlainTextEdit());

	plotBox->setLayout(plotLayout);

}
コード例 #8
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;
}
コード例 #9
0
void tst_QFormLayout::wrapping()
{
    QWidget *w = new QWidget;
    QFormLayout *fl = new QFormLayout(w);
    fl->setRowWrapPolicy(QFormLayout::WrapLongRows);

    QLineEdit *le = new QLineEdit;
    QLabel *lbl = new QLabel("A long label");
    le->setMinimumWidth(200);
    fl->addRow(lbl, le);

    w->setFixedWidth(240);
    w->show();

    QCOMPARE(le->geometry().y() > lbl->geometry().y(), true);

    //TODO: additional tests covering different wrapping cases

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

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

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

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

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

    lights_->Observable::addObserver( this );
}
コード例 #11
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;
}
コード例 #12
0
TextureWallEditor::TextureWallEditor( TextureWallsManager* textureWallsManager, TexturesManager* texturesManager ) :
    currentTextureWall_( nullptr ),
    texturesManager_( texturesManager ),
    textureWallsManager_( textureWallsManager ),
    texturesViewer_( new TexturesViewer( texturesManager, this ) )
{
    QFormLayout* layout = new QFormLayout;
    layout->setRowWrapPolicy( QFormLayout::WrapAllRows );
    textureOffsetXSpinBox_ = new QDoubleSpinBox;
    textureOffsetYSpinBox_ = new QDoubleSpinBox;
    textureScaleXSpinBox_ = new QDoubleSpinBox;
    textureScaleYSpinBox_ = new QDoubleSpinBox;
    textureInput_ = new QPushButton( "Select a texture" );

    // Set the parameters for the widget used for modifying
    // texture offset (X)
    textureOffsetXSpinBox_->setDecimals( 2 );
    textureOffsetXSpinBox_->setSingleStep( 1.0 );
    textureOffsetXSpinBox_->setRange( 0.0, 100.0 );

    // Set the parameters for the widget used for modifying
    // texture offset (Y)
    textureOffsetYSpinBox_->setDecimals( 2 );
    textureOffsetYSpinBox_->setSingleStep( 1.0 );
    textureOffsetYSpinBox_->setRange( 0.0, 100.0 );

    // Set the parameters for the widget used for modifying
    // texture scale (X)
    textureScaleXSpinBox_->setDecimals( 2 );
    textureScaleXSpinBox_->setSingleStep( 1.0 );
    textureScaleXSpinBox_->setRange( 0.0, 100.0 );

    // Set the parameters for the widget used for modifying
    // texture scale (Y)
    textureScaleYSpinBox_->setDecimals( 2 );
    textureScaleYSpinBox_->setSingleStep( 1.0 );
    textureScaleYSpinBox_->setRange( 0.0, 100.0 );

    // When user click on texture input widget, open the textures
    // viewer.
    QObject::connect( textureInput_, &QPushButton::clicked, [=](){
        // Before executing the textures viewer, make a signal / slot
        // connection so whenever a texture is selected, display a
        // message to user.
        QObject::connect( texturesViewer_,
                          &TexturesViewer::textureSelected,
                          [this]( ResourceID textureID ){
            currentTextureWall_->setTextureID( textureID );
        });

        texturesViewer_->exec();
    });

    // Whenever a spin box's value is changed, update the associated value.
    void (QDoubleSpinBox::*signal)( double ) = &QDoubleSpinBox::valueChanged;
    QObject::connect( textureOffsetXSpinBox_, signal, [this]( double newValue ){
        currentTextureWall_->setTextureOffsetX( static_cast< float >( newValue ) );
    });
    QObject::connect( textureOffsetYSpinBox_, signal, [this]( double newValue ){
        currentTextureWall_->setTextureOffsetY( static_cast< float >( newValue ) );
    });
    QObject::connect( textureScaleXSpinBox_, signal, [this]( double newValue ){
        currentTextureWall_->setTextureScaleX( static_cast< float >( newValue ) );
    });
    QObject::connect( textureScaleYSpinBox_, signal, [this]( double newValue ){
        currentTextureWall_->setTextureScaleY( static_cast< float >( newValue ) );
    });

    // Set this widget's layout.
    layout->addRow( "Texture: ", textureInput_ );
    layout->addRow( "Texture offset % (X)", textureOffsetXSpinBox_ );
    layout->addRow( "Texture offset % (Y)", textureOffsetYSpinBox_ );
    layout->addRow( "Texture scale (X)", textureScaleXSpinBox_ );
    layout->addRow( "Texture scale (Y)", textureScaleYSpinBox_ );
    setLayout( layout );
}
コード例 #13
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;
}
コード例 #14
0
QWidget* AutoImportWindow::setupStatusContinaer() {

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

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

    return mainWid;
}
コード例 #15
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);
}