Example #1
0
QWidget* PropertyEditor::createWidgetForInt(const QString& name, int value, const QString& detail, QWidget* parent)
{
    mProperties[name] = value;
    QSpinBox *box = new QSpinBox(parent);
    if (!detail.isEmpty())
        box->setToolTip(detail);
    box->setObjectName(name);
    box->setValue(value);
    connect(box, SIGNAL(valueChanged(int)), SLOT(onIntChange(int)));
    return box;
}
Example #2
0
    void retranslateUi(SAPenSetWidget *par)
    {
        par->setWindowTitle(QApplication::translate("SAPenSetWidget", "Form", 0));
        labelColor->setText(QApplication::translate("SAPenSetWidget", "Color", 0));
#ifndef QT_NO_TOOLTIP
        pushButtonColor->setToolTip(QApplication::translate("SAPenSetWidget", "<html><head/><body><p>set curve line color</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
        pushButtonColor->setText(QString());
        labelWidth->setText(QApplication::translate("SAPenSetWidget", "Width", 0));
#ifndef QT_NO_TOOLTIP
        spinBoxPenWidth->setToolTip(QApplication::translate("SAPenSetWidget", "<html><head/><body><p>set curve line width</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
        labelStyle->setText(QApplication::translate("SAPenSetWidget", "Style", 0));
#ifndef QT_NO_TOOLTIP
        comboBoxPenStyle->setToolTip(QApplication::translate("SAPenSetWidget", "<html><head/><body><p>set curve line style</p></body></html>", 0));
#endif // QT_NO_TOOLTIP
    } // retranslateUi
/*!
    Create and return the box used to modify number of states.
*/
QSpinBox* UiDigitalGenerator::createStatesBox()
{
    GeneratorDevice* device = DeviceManager::instance().activeDevice()
            ->generatorDevice();

    // Deallocation:
    //   Toolbar takes ownership when adding this box by call to
    //   toolBar->addWidget(mStatesBox) in createToolBar
    QSpinBox* box = new QSpinBox();
    box->setToolTip(tr("The number of digital states to use"));


    box->setRange(2, device->maxNumDigitalStates());

    connect(box, SIGNAL(valueChanged(int)), this, SLOT(setNumStates(int)));

    return box;
}
Example #4
0
std::pair<QWidget *, QWidget *> CSMPrefs::IntSetting::makeWidgets (QWidget *parent)
{
    QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);

    QSpinBox *widget = new QSpinBox (parent);
    widget->setRange (mMin, mMax);
    widget->setValue (mDefault);

    if (!mTooltip.empty())
    {
        QString tooltip = QString::fromUtf8 (mTooltip.c_str());
        label->setToolTip (tooltip);
        widget->setToolTip (tooltip);
    }

    connect (widget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int)));

    return std::make_pair (label, widget);
}
Example #5
0
VPiano::VPiano() : QMainWindow()
{
	QWidget *central = new QWidget(this);
	QVBoxLayout *vb = new QVBoxLayout;
	QHBoxLayout *octaves = new QHBoxLayout;

	QSignalMapper *octaveSignalMapper = new QSignalMapper(this);

	for(int i = 0; i < 9; i++)
	{
		QString title;
		title.setNum(i);
		QPushButton *o = new QPushButton(title, central);
		o->setFixedSize(fontMetrics().width(title)*4, o->height());
		QString shortcut;
		shortcut.setNum(i+1);
		o->setShortcut(QKeySequence(QString("F") + shortcut));
		octaves->addWidget(o);

		connect(o, SIGNAL(clicked()), octaveSignalMapper, SLOT(map()));
		octaveSignalMapper->setMapping(o, i);
	}

	OctaveRangeWidget *octRange = new OctaveRangeWidget(central);
	octaves->addWidget(octRange);

	QSlider *velocity = new QSlider(Qt::Horizontal, central);
	velocity->setMinimum(1);
	velocity->setMaximum(127);
	velocity->setValue(96); // TODO: read prev value from config
	velocity->setToolTip(tr("Velocity"));
	octaves->addWidget(velocity);

	QSpinBox *channel = new QSpinBox(central);
	channel->setPrefix(tr("Ch ", "Midi Channel number"));
	channel->setMinimum(0);
	channel->setMaximum(127);
	channel->setValue(0); // TODO: read prev value from config
	channel->setToolTip(tr("Select MIDI channel number to send messages to"));
	octaves->addWidget(channel);

	vb->addLayout(octaves);

	QHBoxLayout *keyarea = new QHBoxLayout;

	KeyboardWidget *kw = new KeyboardWidget(central);
	keyarea->addWidget(kw);

	QVBoxLayout *rightside = new QVBoxLayout;

	QSlider *pitchWheel = new QSlider(Qt::Vertical, central);
	pitchWheel->setMinimum(-64);
	pitchWheel->setMaximum(63);
	pitchWheel->setValue(0); // TODO: read prev value from config
	pitchWheel->setToolTip(tr("Pitch wheel"));

	rightside->addWidget(pitchWheel);

	QCheckBox *porta = new QCheckBox(central);
	porta->setToolTip(tr("Enable portamento"));

	rightside->addWidget(porta);
	keyarea->addLayout(rightside);

	vb->addLayout(keyarea);

	central->setLayout(vb);
	setCentralWidget(central);
	setWindowTitle(tr("Virtual MIDI keyboard"));

	// TODO: connect pitchWheel
	connect(octaveSignalMapper, SIGNAL(mapped(int)), kw, SLOT(octaveSelected(int)));
	connect(channel, SIGNAL(valueChanged(int)), kw, SLOT(midiChannelSelected(int)));
	connect(kw, SIGNAL(highlightOctaves(int,int)), octRange, SLOT(highlightOctaves(int,int)));

	kw->octaveSelected(0); // TODO: use value read from config
}
Example #6
0
void ToolBar::initializeItems()
{
    mCursorButton = createToolButton(mActMap[CURSOR]);
    mEraserButton = createToolButton(mActMap[ERASER]);
    mPenButton = createToolButton(mActMap[PEN]);
    mLineButton = createToolButton(mActMap[LINE]);
    mColorPickerButton = createToolButton(mActMap[COLORPICKER]);
    mMagnifierButton = createToolButton(mActMap[MAGNIFIER]);
    mSprayButton = createToolButton(mActMap[SPRAY]);
    mFillButton = createToolButton(mActMap[FILL]);
    mRectangleButton = createToolButton(mActMap[RECTANGLE]);
    mEllipseButton = createToolButton(mActMap[ELLIPSE]);
    mCurveButton = createToolButton(mActMap[CURVELINE]);
    mTextButton = createToolButton(mActMap[TEXT]);

    QGridLayout *bLayout = new QGridLayout();
    bLayout->setMargin(3);
    bLayout->addWidget(mCursorButton, 0, 0);
    bLayout->addWidget(mEraserButton, 0, 1);
    bLayout->addWidget(mColorPickerButton, 1, 0);
    bLayout->addWidget(mMagnifierButton, 1, 1);
    bLayout->addWidget(mPenButton, 2, 0);
    bLayout->addWidget(mLineButton, 2, 1);
    bLayout->addWidget(mSprayButton, 3, 0);
    bLayout->addWidget(mFillButton, 3, 1);
    bLayout->addWidget(mRectangleButton, 4, 0);
    bLayout->addWidget(mEllipseButton, 4, 1);
    bLayout->addWidget(mCurveButton, 5, 0);
    bLayout->addWidget(mTextButton, 5, 1);

    QWidget *bWidget = new QWidget();
    bWidget->setLayout(bLayout);

    mPColorChooser = new ColorChooser(0, 0, 0, this);
    mPColorChooser->setStatusTip(tr("Primary color"));
    mPColorChooser->setToolTip(tr("Primary color"));
    connect(mPColorChooser, SIGNAL(sendColor(QColor)), this, SLOT(primaryColorChanged(QColor)));
    connect(mPColorChooser, SIGNAL(colorDialogClosed()), this, SIGNAL(colorDialogClosed()));

    mSColorChooser = new ColorChooser(255, 255, 255, this);
    mSColorChooser->setStatusTip(tr("Secondary color"));
    mSColorChooser->setToolTip(tr("Secondary color"));
    connect(mSColorChooser, SIGNAL(sendColor(QColor)), this, SLOT(secondaryColorChanged(QColor)));
    connect(mSColorChooser, SIGNAL(colorDialogClosed()), this, SIGNAL(colorDialogClosed()));

    QSpinBox *penSizeSpin = new QSpinBox();
    penSizeSpin->setRange(1, 20);
    penSizeSpin->setValue(1);
    penSizeSpin->setStatusTip(tr("Pen size"));
    penSizeSpin->setToolTip(tr("Pen size"));
    connect(penSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(penValueChanged(int)));

    QGridLayout *tLayout = new QGridLayout();
    tLayout->setMargin(3);
    tLayout->addWidget(mPColorChooser, 0, 0);
    tLayout->addWidget(mSColorChooser, 0, 1);
    tLayout->addWidget(penSizeSpin, 1, 0, 1, 2);

    QWidget *tWidget = new QWidget();
    tWidget->setLayout(tLayout);

    addWidget(bWidget);
    addSeparator();
    addWidget(tWidget);
}
Example #7
0
void DkDisplayPreference::createLayout() {

	// zoom settings
	QCheckBox* invertZoom = new QCheckBox(tr("Invert mouse wheel behaviour for zooming"), this);
	invertZoom->setObjectName("invertZoom");
	invertZoom->setToolTip(tr("If checked, the mouse wheel behaviour is inverted while zooming."));
	invertZoom->setChecked(Settings::param().display().invertZoom);

	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);

	QSpinBox* sbInterpolation = new QSpinBox(this);
	sbInterpolation->setObjectName("interpolationBox");
	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
	sbInterpolation->setSuffix("%");
	sbInterpolation->setMinimum(0);
	sbInterpolation->setMaximum(10000);
	sbInterpolation->setValue(Settings::param().display().interpolateZoomLevel);

	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
	zoomGroup->addWidget(invertZoom);
	zoomGroup->addWidget(interpolationLabel);
	zoomGroup->addWidget(sbInterpolation);

	// keep zoom radio buttons
	QVector<QRadioButton*> keepZoomButtons;
	keepZoomButtons.resize(DkSettings::zoom_end);
	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);

	QCheckBox* cbZoomToFit = new QCheckBox(tr("Always zoom to fit"), this);
	cbZoomToFit->setObjectName("zoomToFit");
	cbZoomToFit->setChecked(Settings::param().display().zoomToFit);

	// check wrt the current settings
	keepZoomButtons[Settings::param().display().keepZoom]->setChecked(true);

	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
	keepZoomButtonGroup->setObjectName("keepZoom");
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);

	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
	keepZoomGroup->addWidget(cbZoomToFit);
	
	// icon size
	QSpinBox* sbIconSize = new QSpinBox(this);
	sbIconSize->setObjectName("iconSizeBox");
	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
	sbIconSize->setSuffix(" px");
	sbIconSize->setMinimum(16);
	sbIconSize->setMaximum(1024);
	sbIconSize->setValue(Settings::param().display().iconSize);

	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
	iconGroup->addWidget(sbIconSize);

	// slideshow
	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);

	QComboBox* cbTransition = new QComboBox(this);
	cbTransition->setObjectName("transition");
	cbTransition->setToolTip(tr("Choose a transition when loading a new image"));

	for (int idx = 0; idx < DkSettings::trans_end; idx++) {

		QString str = tr("Unknown Transition");

		switch (idx) {
		case DkSettings::trans_appear:	str = tr("Appear"); break;
		case DkSettings::trans_swipe:	str = tr("Swipe");	break;
		case DkSettings::trans_fade:	str = tr("Fade");	break;
		}

		cbTransition->addItem(str);
	}
	cbTransition->setCurrentIndex(Settings::param().display().transition);

	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
	fadeImageBox->setObjectName("fadeImageBox");
	fadeImageBox->setToolTip(tr("Define the image transition speed."));
	fadeImageBox->setSuffix(" sec");
	fadeImageBox->setMinimum(0.0);
	fadeImageBox->setMaximum(3);
	fadeImageBox->setSingleStep(.2);
	fadeImageBox->setValue(Settings::param().display().animationDuration);

	QCheckBox* cbAlwaysAnimate = new QCheckBox(tr("Always Animate Image Loading"), this);
	cbAlwaysAnimate->setObjectName("alwaysAnimate");
	cbAlwaysAnimate->setToolTip(tr("If unchecked, loading is only animated if nomacs is fullscreen"));
	cbAlwaysAnimate->setChecked(Settings::param().display().alwaysAnimate);

	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);
	
	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
	displayTimeBox->setObjectName("displayTimeBox");
	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
	displayTimeBox->setSuffix(" sec");
	displayTimeBox->setMinimum(0.0);
	displayTimeBox->setMaximum(30);
	displayTimeBox->setSingleStep(.2);
	displayTimeBox->setValue(Settings::param().slideShow().time);

	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
	slideshowGroup->addWidget(fadeImageLabel);
	slideshowGroup->addWidget(cbTransition);
	slideshowGroup->addWidget(fadeImageBox);
	slideshowGroup->addWidget(cbAlwaysAnimate);
	slideshowGroup->addWidget(displayTimeLabel);
	slideshowGroup->addWidget(displayTimeBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->setAlignment(Qt::AlignTop);
	leftLayout->addWidget(zoomGroup);
	leftLayout->addWidget(keepZoomGroup);
	leftLayout->addWidget(iconGroup);
	leftLayout->addWidget(slideshowGroup);

	// right column
	QWidget* rightWidget = new QWidget(this);
	QVBoxLayout* rightLayout = new QVBoxLayout(rightWidget);
	rightLayout->setAlignment(Qt::AlignTop);

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

	layout->addWidget(leftWidget);
	layout->addWidget(rightWidget);
}
    void setupUi(QWidget *q)
    {
        groupBoxGeneral = new QGroupBox(q);
        groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));

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

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

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

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

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

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

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

        checkBoxWarnOnReleaseBuilds = new QCheckBox(groupBoxGeneral);
        checkBoxWarnOnReleaseBuilds->setText(GdbOptionsPage::tr(
            "Warn when debugging \"Release\" builds"));
        checkBoxWarnOnReleaseBuilds->setToolTip(GdbOptionsPage::tr(
            "Show a warning when starting the debugger "
            "on a binary with insufficient debug information."));

        labelDangerous = new QLabel(GdbOptionsPage::tr(
            "The options below should be used with care."));

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

        checkBoxAutoEnrichParameters = new QCheckBox(groupBoxGeneral);
        checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr(
            "Use common locations for debug information"));
        checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr(
            "This adds common paths to locations of debug information\n"
            "at debugger startup."));

        checkBoxBreakOnWarning = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnWarning->setText(GdbOptionsPage::tr("Stop when a qWarning is issued"));

        checkBoxBreakOnFatal = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnFatal->setText(GdbOptionsPage::tr("Stop when a qFatal is issued"));

        checkBoxBreakOnAbort = new QCheckBox(groupBoxGeneral);
        checkBoxBreakOnAbort->setText(GdbOptionsPage::tr("Stop when abort() is called"));

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

        checkBoxAttemptQuickStart = new QCheckBox(groupBoxGeneral);
        checkBoxAttemptQuickStart->setText(GdbOptionsPage::tr("Attempt quick start"));
        checkBoxAttemptQuickStart->setToolTip(GdbOptionsPage::tr("Checking this option "
            "will postpone reading debug information as long as possible. This can result "
            "in faster startup times at the price of not being able to set breakpoints "
            "by file and number."));

        groupBoxStartupCommands = new QGroupBox(q);
        groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));

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

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

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

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

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

        lineEditSelectedPluginBreakpointsPattern = new QLineEdit(groupBoxPluginDebugging);

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

        QFormLayout *formLayout = new QFormLayout(groupBoxGeneral);
        formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
        formLayout->addRow(checkBoxSkipKnownFrames);
        formLayout->addRow(checkBoxUseMessageBoxForSignals);
        formLayout->addRow(checkBoxAdjustBreakpointLocations);
        formLayout->addRow(checkBoxUseDynamicType);
        formLayout->addRow(checkBoxLoadGdbInit);
        formLayout->addRow(checkBoxWarnOnReleaseBuilds);
        formLayout->addRow(new QLabel(QString()));
        formLayout->addRow(labelDangerous);
        formLayout->addRow(checkBoxTargetAsync);
        formLayout->addRow(checkBoxAutoEnrichParameters);
        formLayout->addRow(checkBoxBreakOnWarning);
        formLayout->addRow(checkBoxBreakOnFatal);
        formLayout->addRow(checkBoxBreakOnAbort);
        formLayout->addRow(checkBoxEnableReverseDebugging);
        formLayout->addRow(checkBoxAttemptQuickStart);

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

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

        QGridLayout *gridLayout = new QGridLayout(q);
        gridLayout->addWidget(groupBoxGeneral, 0, 0);
        gridLayout->addWidget(groupBoxStartupCommands, 0, 1);

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

        //gridLayout->addLayout(horizontalLayout, 2, 0, 1, 1);
        //gridLayout->addWidget(radioButtonNoPluginBreakpoints, 3, 0, 1, 1);
        //gridLayout->addWidget(groupBoxPluginDebugging, 1, 0, 1, 2);
    }
Example #9
0
Phraktalus::Phraktalus(QWidget *parent) :
        QMainWindow(parent),
        lastDir(QString()),
        ui(new Ui::Phraktalus),
        viewport(new GLViewPort(this)),
        ms(new ModelStacker(this)),
        dots(new QSpinBox(this)),
        statusLabel(new QLabel("Welcome to Phraktalus"))
{
    //Sets up the premade ui
    ui->setupUi(this);
    setWindowTitle(windowTitle());
    setStatusBar(new QStatusBar(this));
    statusBar()->addWidget(statusLabel);
    statusBar()->show();
    //Populate the menuBar
    ui->menuBar->addAction(ui->action_About);
    //Populate toolBars
    //File menu
    ui->toolBar->addAction(ui->action_New);
    ui->toolBar->addAction(ui->action_Open);
    ui->toolBar->addSeparator();
    //View Menu
    QSpinBox *gridPrecision = new QSpinBox(this);
    gridPrecision->setMinimum(1);
    gridPrecision->setMaximum(5);
    gridPrecision->setToolTip("Adjusts Grid precision");
    ui->toolBar->addWidget(gridPrecision);

    QAction* showGrids = new QAction(QIcon(":/icons/rule.png"), "Show Grids", this);
    showGrids->setCheckable(true);
    showGrids->setChecked(true);
    showGrids->setMenu(ui->menu_Grids);
    ui->toolBar->addAction(showGrids);

    ui->toolBar->addAction(ui->action_Show_Labels);
    ui->toolBar->addAction(ui->action_Surface);
    ui->toolBar->addAction(ui->action_Lighting);
    ui->toolBar->addAction(ui->action_Reset_Camera);
    ui->toolBar->addSeparator();
    //Process Menu
    dots->setMinimum(1);
    dots->setMaximum(4);
    dots->setToolTip("Adjusts number of visible dots");
    ui->toolBar->addWidget(dots);

    ui->toolBar->addAction(ui->action_Previous);
    connect(ms, SIGNAL(hasPrevious(bool)), ui->action_Previous, SLOT(setEnabled(bool)));
    ui->toolBar->addAction(ui->action_Next);
    connect(ms, SIGNAL(hasNext(bool)), ui->action_Next, SLOT(setEnabled(bool)));
    ui->toolBar->addAction(ui->action_Zoom);
    connect(ms, SIGNAL(isEmpty(bool)), ui->action_Zoom, SLOT(setDisabled(bool)));
    ms->emitSignals();

    ui->toolBar->setVisible(true);
    //Set main viewport
    setCentralWidget(viewport);
    //Connect actions relative to GL
    connect(ui->action_Lighting, SIGNAL(toggled(bool)), viewport, SLOT(setLighting(bool)));
    connect(ui->action_Reset_Camera, SIGNAL(triggered()), viewport, SLOT(resetCamera()));
    connect(ui->action_Horizontal, SIGNAL(toggled(bool)), viewport, SLOT(showHorizontalGrid(bool)));
    connect(ui->action_Vertical, SIGNAL(toggled(bool)), viewport, SLOT(showVerticalGrid(bool)));
    connect(ui->action_Surface, SIGNAL(toggled(bool)), viewport, SLOT(showSurface(bool)));
    connect(gridPrecision, SIGNAL(valueChanged(int)), viewport, SLOT(setGridPrecision(int)));
    connect(ui->action_Show_Labels, SIGNAL(toggled(bool)), viewport, SLOT(showLabels(bool)));
    connect(ms, SIGNAL(topChanged(ElevationModel*)), viewport, SLOT(setModel(ElevationModel*)));
    connect(ms, SIGNAL(topChanged(ElevationModel*)), this, SLOT(onTopChanged(ElevationModel*)));
    //Zoom region
    connect(ui->action_Zoom, SIGNAL(toggled(bool)), viewport, SLOT(zoomModeEnable(bool)));
    connect(viewport, SIGNAL(doZoom(uint,uint,uint)), this, SLOT(zoomHandle(uint, uint, uint)));
    connect(showGrids, SIGNAL(toggled(bool)), ui->action_Vertical, SLOT(setChecked(bool)));
    connect(showGrids, SIGNAL(toggled(bool)), ui->action_Horizontal, SLOT(setChecked(bool)));

    gridPrecision->setValue(GRIDPRECISION);
    dots->setValue(VISIBLEDOTS);
}
Example #10
0
QSofaMainWindow::QSofaMainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    setFocusPolicy(Qt::ClickFocus);

    mainViewer = new QSofaViewer(&sofaScene,this);
    setCentralWidget(mainViewer);

    QToolBar* toolbar = addToolBar(tr("Controls"));
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QMenu* simulationMenu = menuBar()->addMenu(tr("&Simulation"));
    QMenu* viewMenu = menuBar()->addMenu(tr("&View"));

    // find icons at https://www.iconfinder.com/search

    // start/stop
    {
        _playPauseAct = new QAction(QIcon(":/icons/start.svg"), tr("&Play..."), this);
        _playPauseAct->setIcon(this->style()->standardIcon(QStyle::SP_MediaPlay));
        _playPauseAct->setShortcut(QKeySequence(Qt::Key_Space));
        _playPauseAct->setToolTip(tr("Play/Pause simulation"));
        connect(_playPauseAct, SIGNAL(triggered()), &sofaScene, SLOT(playpause()));
        connect(&sofaScene, SIGNAL(sigPlaying(bool)), this, SLOT(isPlaying(bool)) );
        this->addAction(_playPauseAct);
        simulationMenu->addAction(_playPauseAct);
        toolbar->addAction(_playPauseAct);
    }

    // reset
    {
        QAction* resetAct = new QAction(QIcon(":/icons/reset.svg"), tr("&Reset..."), this);
        resetAct->setIcon(this->style()->standardIcon(QStyle::SP_MediaSkipBackward));
        resetAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R));
        resetAct->setToolTip(tr("Restart from the beginning, without reloading"));
        connect(resetAct, SIGNAL(triggered()), &sofaScene, SLOT(reset()));
        this->addAction(resetAct);
        simulationMenu->addAction(resetAct);
        toolbar->addAction(resetAct);
    }

    // open
    {
        QAction* openAct = new QAction(QIcon(":/icons/reset.svg"), tr("&Open..."), this);
        openAct->setIcon(this->style()->standardIcon(QStyle::SP_FileIcon));
        openAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O));
        openAct->setToolTip(tr("Open new scene"));
        openAct->setStatusTip(tr("Opening scene…"));
        connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
        this->addAction(openAct);
        fileMenu->addAction(openAct);
        toolbar->addAction(openAct);
    }

    // time step
    {
        QSpinBox* spinBox = new QSpinBox(this);
        toolbar->addWidget(spinBox);
        spinBox->setValue(40);
        spinBox->setMaxValue(40000);
        spinBox->setToolTip(tr("Simulation time step (ms)"));
        connect(spinBox,SIGNAL(valueChanged(int)), this, SLOT(setDt(int)));
    }

    // reload
    {
        QAction* reloadAct = new QAction(QIcon(":/icons/reload.svg"), tr("&Reload..."), this);
        reloadAct->setIcon(this->style()->standardIcon(QStyle::SP_BrowserReload));
        reloadAct->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_R));
        reloadAct->setStatusTip(tr("Reloading scene…"));
        reloadAct->setToolTip(tr("Reload file and restart from the beginning"));
        connect(reloadAct, SIGNAL(triggered()), &sofaScene, SLOT(reload()));
        this->addAction(reloadAct);
        fileMenu->addAction(reloadAct);
        toolbar->addAction(reloadAct);
    }

    // viewAll
    {
        QAction* viewAllAct = new QAction(QIcon(":/icons/eye.svg"), tr("&ViewAll..."), this);
        viewAllAct->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_V));
        viewAllAct->setToolTip(tr("Adjust camera to view all"));
        connect(viewAllAct, SIGNAL(triggered()), mainViewer, SLOT(viewAll()));
        this->addAction(viewAllAct);
        simulationMenu->addAction(viewAllAct);
        toolbar->addAction(viewAllAct);
    }

    // print
    {
        QAction* printAct = new QAction( QIcon(":/icons/print.svg"), tr("&PrintGraph..."), this);
        printAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_P));
        printAct->setToolTip(tr("Print the graph on the standard output"));
        connect(printAct, SIGNAL(triggered()), &sofaScene, SLOT(printGraph()));
        this->addAction(printAct);
        simulationMenu->addAction(printAct);
        toolbar->addAction(printAct);
    }

//    {
//        QAction* toggleFullScreenAct = new QAction( tr("&FullScreen"), this );
//        toggleFullScreenAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_F));
//        toggleFullScreenAct->setToolTip(tr("Show full screen"));
//        connect(toggleFullScreenAct, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
//        this->addAction(toggleFullScreenAct);
//        viewMenu->addAction(toggleFullScreenAct);
//        toolbar->addAction(toggleFullScreenAct);
//        _fullScreen = false;
//    }

    {
        QAction* createAdditionalViewerAct = new QAction( tr("&Additional viewer"), this );
        createAdditionalViewerAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_V));
        createAdditionalViewerAct->setToolTip(tr("Add/remove additional viewer"));
        connect(createAdditionalViewerAct, SIGNAL(triggered()), this, SLOT(createAdditionalViewer()));
        this->addAction(createAdditionalViewerAct);
        viewMenu->addAction(createAdditionalViewerAct);
        toolbar->addAction(createAdditionalViewerAct);
    }

    //=======================================
    mainViewer->setFocus();

}
Example #11
0
TimeControls::TimeControls(QWidget* parent) : QToolBar(parent) {

	QSettings settings("Pencil","Pencil");

	//QFrame* frame = new QFrame();

	QSpinBox* fpsBox = new QSpinBox();
	//fpsBox->setFixedWidth(50);
	fpsBox->setFont( QFont("Helvetica", 10) );
	fpsBox->setFixedHeight(22);
	fpsBox->setValue(settings.value("fps").toInt());
	fpsBox->setMinimum(1);
	fpsBox->setMaximum(50);
	fpsBox->setToolTip("Frames per second");
	fpsBox->setFocusPolicy(Qt::NoFocus);

	QPushButton* playButton = new QPushButton();
	loopButton = new QPushButton();
	soundButton = new QPushButton();
	QLabel* separator = new QLabel();
	separator->setPixmap(QPixmap(":icons/controls/separator.png"));
	separator->setFixedSize(QSize(37,31));
	QLabel* spacingLabel = new QLabel(""); spacingLabel->setIndent(6);
	QLabel* fpsLabel = new QLabel(tr("Fps: ")); fpsLabel->setIndent(6);

	QIcon playIcon(":icons/controls/play.png");
	QIcon loopIcon(":icons/controls/loop.png");
	QIcon soundIcon(":icons/controls/sound.png");
#ifdef Q_WS_MAC
	/*loopButton->setFixedSize( QSize(35,30) );
	loopButton->setIconSize( QSize(35,30) );
	loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Normal, QIcon::On );
	loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Normal, QIcon::Off);
	loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Disabled, QIcon::On );
	loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Disabled, QIcon::Off);
	loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Active, QIcon::On );
	loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Active, QIcon::Off);*/
#endif
	playButton->setIcon(playIcon);
	loopButton->setIcon(loopIcon);
	soundButton->setIcon(soundIcon);

	playButton->setToolTip(tr("Play"));
	loopButton->setToolTip(tr("Loop"));
	soundButton->setToolTip(tr("Sound on/off"));

	loopButton->setCheckable(true);
	soundButton->setCheckable(true);
	soundButton->setChecked(true);

	addWidget(separator);
	addWidget(playButton);
	addWidget(loopButton);
	addWidget(soundButton);
	addWidget(fpsLabel);
	addWidget(fpsBox);
	
	/*QHBoxLayout* frameLayout = new QHBoxLayout();
	frameLayout->setMargin(0);
	frameLayout->setSpacing(0);
	frameLayout->addWidget(separator);
	frameLayout->addWidget(playButton);
	frameLayout->addWidget(loopButton);
	frameLayout->addWidget(soundButton);
	frameLayout->addWidget(fpsLabel);
	frameLayout->addWidget(fpsBox);
	frameLayout->addWidget(spacingLabel);
	
	setLayout(frameLayout);
	setFixedSize(300,32);*/
	
	//QHBoxLayout* layout = new QHBoxLayout();
	//layout->setAlignment(Qt::AlignRight);
	//layout->addWidget(frame);
	//layout->setMargin(0);
	//layout->setSizeConstraint(QLayout::SetNoConstraint);
	
	//setLayout(frameLayout);
	
	connect(playButton, SIGNAL(clicked()), this, SIGNAL(playClick()));
	connect(loopButton, SIGNAL(clicked()), this, SIGNAL(loopClick()));
	connect(soundButton, SIGNAL(clicked()), this, SIGNAL(soundClick()));
	connect(fpsBox,SIGNAL(valueChanged(int)), this, SIGNAL(fpsClick(int)));
	
	//updateButtons(false);
}
Example #12
0
void DeviceWizardOptions::comBox()
{
    QGroupBox *gbCom = new QGroupBox();
    gbCom->setTitle("Communication");
    gbCom->setLayout(new QVBoxLayout());
    this->layout()->addWidget(gbCom);

    this->comPort = new QComboBox();

    this->comPort->setToolTip(
        "Choose the port to which your device is connected");
    gbCom->layout()->addWidget(this->comPort);

    QGridLayout *baudFlowDBits = new QGridLayout();
    dynamic_cast<QVBoxLayout *>(gbCom->layout())->addLayout(baudFlowDBits);

    QLabel *baudLabel = new QLabel("Baud Rate");
    QComboBox *baudBox = new QComboBox();
    baudBox->addItems(
        {"1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200"});
    baudBox->setCurrentText("9600");
    baudFlowDBits->addWidget(baudLabel, 0, 0);
    baudFlowDBits->addWidget(baudBox, 1, 0);

    QLabel *flowctlLabel = new QLabel("Flow Control");
    QComboBox *flowctlBox = new QComboBox();
    flowctlBox->addItems(
        {"No flow control", "Hardware flow control", "Software flow control"});
    flowctlBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(flowctlLabel, 0, 1);
    baudFlowDBits->addWidget(flowctlBox, 1, 1);

    QLabel *dbitsLabel = new QLabel("Data Bits");
    QComboBox *dbitsBox = new QComboBox();
    dbitsBox->addItems({"5", "6", "7", "8"});
    dbitsBox->setCurrentText("8");
    baudFlowDBits->addWidget(dbitsLabel, 0, 2);
    baudFlowDBits->addWidget(dbitsBox, 1, 2);

    QLabel *parityLabel = new QLabel("Parity");
    QComboBox *parityBox = new QComboBox();
    parityBox->addItem("No Parity", 0);
    parityBox->addItem("Even Parity", 2);
    parityBox->addItem("Odd Parity", 3);
    parityBox->addItem("Space Parity", 4);
    parityBox->addItem("Mark Parity", 5);
    parityBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(parityLabel, 2, 0);
    baudFlowDBits->addWidget(parityBox, 3, 0);

    QLabel *stopLabel = new QLabel("Stop Bits");
    QComboBox *stopBox = new QComboBox();
    stopBox->addItem("1", 1);
    stopBox->addItem("1.5", 3);
    stopBox->addItem("2", 2);
    stopBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(stopLabel, 2, 1);
    baudFlowDBits->addWidget(stopBox, 3, 1);

    QLabel *pollingFreqLabel = new QLabel("Polling frequency");
    QComboBox *pollFreqBox = new QComboBox();
    pollFreqBox->setToolTip("Polling Frequency in Hertz");
    pollFreqBox->addItem("10 Hz", 100);
    pollFreqBox->addItem("5 Hz", 200);
    pollFreqBox->addItem("2 Hz", 500);
    pollFreqBox->addItem("1 Hz", 1000);
    pollFreqBox->addItem("0.5 Hz", 2000);
    pollFreqBox->addItem("0.2 Hz", 5000);
    pollFreqBox->addItem("0.1 Hz", 10000);
    pollFreqBox->setCurrentIndex(1);
    baudFlowDBits->addWidget(pollingFreqLabel, 4, 0);
    baudFlowDBits->addWidget(pollFreqBox, 5, 0);

    QLabel *sportTimeoutLabel = new QLabel("Serial port timeout");
    QSpinBox *sportTimeout = new QSpinBox();
    sportTimeout->setMinimum(1);
    sportTimeout->setMaximum(10000);
    sportTimeout->setSuffix("ms");
    sportTimeout->setValue(10);
    sportTimeout->setToolTip(
        "Time in Milliseconds the Serialport will wait \n"
        "for an answer from the device. Tuning this option \n"
        "might improve communication resulting in a higher \n"
        "polling frequency. If this value is to low you \n"
        "will encounter partial or complete data loss on \n"
        "the serial port connection.");
    baudFlowDBits->addWidget(sportTimeoutLabel, 4, 1);
    baudFlowDBits->addWidget(sportTimeout, 5, 1);

    // we need the comport string not index
    registerField("comPort", this->comPort, "currentText");
    registerField("baudBox", baudBox, "currentText");
    registerField("flowctlBox", flowctlBox);
    registerField("dbitsBox", dbitsBox, "currentText");
    registerField("parityBox", parityBox, "currentData");
    registerField("stopBox", stopBox, "currentData");
    registerField("pollFreqBox", pollFreqBox, "currentData");
    registerField("sportTimeout", sportTimeout);
}
void DkDisplayPreference::createLayout() {

	// zoom settings
	QCheckBox* invertZoom = new QCheckBox(tr("Invert zoom wheel behaviour"), this);
	invertZoom->setObjectName("invertZoom");
	invertZoom->setChecked(Settings::param().display().invertZoom);

	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);

	QSpinBox* sbInterpolation = new QSpinBox(this);
	sbInterpolation->setObjectName("interpolationBox");
	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
	sbInterpolation->setSuffix("%");
	sbInterpolation->setMinimum(0);
	sbInterpolation->setMaximum(10000);
	sbInterpolation->setValue(Settings::param().display().interpolateZoomLevel);

	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
	zoomGroup->addWidget(invertZoom);
	zoomGroup->addWidget(interpolationLabel);
	zoomGroup->addWidget(sbInterpolation);

	// keep zoom radio buttons
	QVector<QRadioButton*> keepZoomButtons;
	keepZoomButtons.resize(DkSettings::zoom_end);
	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);

	// check wrt the current settings
	keepZoomButtons[Settings::param().display().keepZoom]->setChecked(true);

	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
	keepZoomButtonGroup->setObjectName("keepZoom");
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);

	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
	
	// icon size
	QSpinBox* sbIconSize = new QSpinBox(this);
	sbIconSize->setObjectName("iconSizeBox");
	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
	sbIconSize->setSuffix(" px");
	sbIconSize->setMinimum(16);
	sbIconSize->setMaximum(1024);
	sbIconSize->setValue(Settings::param().display().iconSize);

	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
	iconGroup->addWidget(sbIconSize);

	// slideshow
	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);

	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
	fadeImageBox->setObjectName("fadeImageBox");
	fadeImageBox->setToolTip(tr("Define the image transition speed."));
	fadeImageBox->setSuffix(" sec");
	fadeImageBox->setMinimum(0.0);
	fadeImageBox->setMaximum(3);
	fadeImageBox->setSingleStep(.2);
	fadeImageBox->setValue(Settings::param().display().fadeSec);

	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);

	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
	displayTimeBox->setObjectName("displayTimeBox");
	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
	displayTimeBox->setSuffix(" sec");
	displayTimeBox->setMinimum(0.0);
	displayTimeBox->setMaximum(30);
	displayTimeBox->setSingleStep(.2);
	displayTimeBox->setValue(Settings::param().slideShow().time);

	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
	slideshowGroup->addWidget(fadeImageLabel);
	slideshowGroup->addWidget(fadeImageBox);
	slideshowGroup->addWidget(displayTimeLabel);
	slideshowGroup->addWidget(displayTimeBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->setAlignment(Qt::AlignTop);
	leftLayout->addWidget(zoomGroup);
	leftLayout->addWidget(keepZoomGroup);
	leftLayout->addWidget(iconGroup);
	leftLayout->addWidget(slideshowGroup);

	// right column
	QWidget* rightWidget = new QWidget(this);
	QVBoxLayout* rightLayout = new QVBoxLayout(rightWidget);
	rightLayout->setAlignment(Qt::AlignTop);

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

	layout->addWidget(leftWidget);
	layout->addWidget(rightWidget);
}
Example #14
0
/*!
	\brief Reset the subcontrols to reflect the data of the format scheme being edited

	The name can be a bit misleading at first, it has been chosen
	because it directly maps to the effect a "cancel" button would
	have on the widget
*/
void QFormatConfig::cancel()
{
	m_table->clearContents();

	QTime T; T.start();
	QFontDatabase database;
	QStringList fonts = database.families();
	fonts.insert(0, tr("<default>"));
	
	if ( m_currentScheme )
	{
		if (m_categories.isEmpty()) {
			QList<QString> &temp=addCategory("");
			for ( int i = 0; i < m_currentScheme->formatCount(); i++ )
				temp.append(m_currentScheme->id(i));
		}


		int n = 0;
		foreach ( const QList<QString> c, m_categories)
			n+=c.size();
		n+=m_categories.size()-1;
		m_table->setRowCount(n);

		int r = 0;
		for ( int c = 0; c < m_categories.size(); c++ ) {
			if (c!=0) {
				m_table->setItem(r, 0, new QTableWidgetItem());
				m_table->setSpan(r++, 0, 1, 13);
			}
			QTableWidgetItem *item = new QTableWidgetItem(m_categories[c][0]);
			QFont f = item->font(); f.setBold(true); item->setFont(f); item->setBackground(QApplication::palette().mid());
			m_table->setItem(r, 0, item);
			m_table->setSpan(r++, 0, 1, 13);

			for ( int f = 1; f < m_categories[c].size(); f++ ) {
				QString fid = m_categories[c][f];
				const QFormat& fmt = m_currentScheme->format(fid);

				QTableWidgetItem *item;

				item = new QTableWidgetItem(tr(qPrintable(fid)));
				item->setData(Qt::UserRole, fid);
				item->setFlags(Qt::ItemIsEnabled);
				m_table->setItem(r, 0, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.weight == QFont::Bold ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(1)->toolTip());
				m_table->setItem(r, 1, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.italic ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(2)->toolTip());
				m_table->setItem(r, 2, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.underline ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(3)->toolTip());
				m_table->setItem(r, 3, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.overline ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(4)->toolTip());
				m_table->setItem(r, 4, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.strikeout ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(5)->toolTip());
				m_table->setItem(r, 5, item);

				item = new QTableWidgetItem;
				item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
				item->setCheckState(fmt.waveUnderline ? Qt::Checked : Qt::Unchecked);
				item->setToolTip(m_table->horizontalHeaderItem(6)->toolTip());
				m_table->setItem(r, 6, item);

				m_table->setCellWidget(r, 7, new QSimpleColorPicker(fmt.foreground));
				m_table->cellWidget(r, 7)->setToolTip(m_table->horizontalHeaderItem(7)->toolTip());
				//m_table->cellWidget(i, 7)->setMaximumSize(22, 22);

				m_table->setCellWidget(r, 8, new QSimpleColorPicker(fmt.background));
				m_table->cellWidget(r, 8)->setToolTip(m_table->horizontalHeaderItem(8)->toolTip());
				//m_table->cellWidget(i, 8)->setMaximumSize(22, 22);

				m_table->setCellWidget(r, 9, new QSimpleColorPicker(fmt.linescolor));
				m_table->cellWidget(r, 9)->setToolTip(m_table->horizontalHeaderItem(9)->toolTip());
				//m_table->cellWidget(i, 9)->setMaximumSize(22, 22);

				//item = new QTableWidgetItem;
				QFontComboBox *fcmb=new QFontComboBox();
				fcmb->insertItem(0, "<default>");
				int ind=fcmb->findText(fmt.fontFamily);
				if(ind>-1) fcmb->setCurrentIndex(ind);
				else fcmb->setCurrentIndex(0);
				//int ind=fcmb->findText(fmt.fontFamily);
				//if(ind>-1) fcmb->setCurrentIndex(ind);
				//else fcmb->setCurrentIndex(0);
				//QComboBox *fcmb=new QComboBox();
				//fcmb->addItems(fonts);
				//int ind=fcmb->findText(fmt.fontFamily);
				//if(ind>-1) fcmb->setCurrentIndex(ind);
				//else fcmb->setCurrentIndex(0);
				m_table->setCellWidget(r, 10, fcmb);
				fcmb->setToolTip(m_table->horizontalHeaderItem(10)->toolTip());

				QDoubleSpinBox* sb = new QDoubleSpinBox();
				sb->setMaximum(100000);
				sb->setMinimum(1);
				sb->setDecimals(0);
				sb->setSuffix("%");
				sb->setAlignment(Qt::AlignRight);
				sb->setFrame(false);
				double v = fmt.pointSize?100.0*fmt.pointSize/basePointSize:100;
				sb->setValue(v);
				sb->setToolTip(m_table->horizontalHeaderItem(11)->toolTip());
				m_table->setCellWidget(r, 11, sb);

				QSpinBox *psb = new QSpinBox();
				psb->setMaximum(100);
				psb->setMinimum(-1);
				psb->setAlignment(Qt::AlignRight);
				psb->setFrame(false);
				psb->setValue(fmt.priority);
				psb->setToolTip(m_table->horizontalHeaderItem(12)->toolTip());
				m_table->setCellWidget(r, 12, psb);
				r++;
			}
		}
	}

	m_table->resizeColumnsToContents();
	
	qDebug () << T.elapsed();
}