void DlgPreferences::slotButtonPressed(QAbstractButton* pButton) { QDialogButtonBox::ButtonRole role = buttonBox->buttonRole(pButton); DlgPreferencePage* pCurrentPage = currentPage(); switch (role) { case QDialogButtonBox::ResetRole: // Only reset to defaults on the current page. if (pCurrentPage != NULL) { pCurrentPage->slotResetToDefaults(); } break; case QDialogButtonBox::ApplyRole: // Only apply settings on the current page. if (pCurrentPage != NULL) { pCurrentPage->slotApply(); } break; case QDialogButtonBox::AcceptRole: emit(applyPreferences()); accept(); break; case QDialogButtonBox::RejectRole: emit(cancelPreferences()); reject(); break; default: break; } }
void DlgPreferences::addPageWidget(DlgPreferencePage* pWidget) { connect(this, SIGNAL(showDlg()), pWidget, SLOT(slotShow())); connect(this, SIGNAL(closeDlg()), pWidget, SLOT(slotHide())); connect(this, SIGNAL(showDlg()), pWidget, SLOT(slotUpdate())); connect(this, SIGNAL(applyPreferences()), pWidget, SLOT(slotApply())); connect(this, SIGNAL(cancelPreferences()), pWidget, SLOT(slotCancel())); connect(this, SIGNAL(resetToDefaults()), pWidget, SLOT(slotResetToDefaults())); QScrollArea* sa = new QScrollArea(pagesWidget); sa->setWidgetResizable(true); sa->setWidget(pWidget); pagesWidget->addWidget(sa); int iframe = 2 * sa->frameWidth(); m_pageSizeHint = m_pageSizeHint.expandedTo( pWidget->sizeHint()+QSize(iframe, iframe)); }
/* ColorimetryPrefsPanel::onChoiceGreyscalePresetSelected * Called when the greyscale 'preset' dropdown choice is changed * Standard NTSC weights: 0.299, 0.587, 0.114 * Id Software's typoed weights: 0.299, 0.587, 0.144 * http://www.doomworld.com/idgames/?id=16644 * Grafica Obscura's weights for linear RGB: 0.3086, 0.6094, 0.0820 * http://www.graficaobscura.com/matrix/index.html *******************************************************************/ void ColorimetryPrefsPanel::onChoiceGreyscalePresetSelected(wxCommandEvent& e) { int preset = choice_presets_grey->GetSelection(); switch (preset) { case 0: // Standard spin_grey_r->SetValue(0.299); spin_grey_g->SetValue(0.587); spin_grey_b->SetValue(0.114); break; case 1: // Id Software's typoed variant spin_grey_r->SetValue(0.299); spin_grey_g->SetValue(0.587); spin_grey_b->SetValue(0.144); break; case 2: // Some linear RGB formula spin_grey_r->SetValue(0.3086); spin_grey_g->SetValue(0.6094); spin_grey_b->SetValue(0.0820); break; }; applyPreferences(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RIApplication::RIApplication(int& argc, char** argv) : QApplication(argc, argv) { // USed to get registry settings in the right place QCoreApplication::setOrganizationName(RI_COMPANY_NAME); QCoreApplication::setApplicationName(RI_APPLICATION_NAME); // For idle processing // m_idleTimerStarted = false; installEventFilter(this); //cvf::Trace::enable(false); m_preferences = new RIPreferences; readPreferences(); applyPreferences(); if (useShaders()) { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::SHADER_BASED); } else { caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION); } // Start with a project m_project = new RimProject; setWindowIcon(QIcon(":/AppLogo48x48.png")); m_socketServer = new RiaSocketServer( this); m_workerProcess = NULL; }
/* PreferencesDialog::onButtonClicked * Called when a button is clicked *******************************************************************/ void PreferencesDialog::onButtonClicked(wxCommandEvent& e) { // Check if it was the apply button if (e.GetId() == wxID_APPLY) applyPreferences(); else e.Skip(); }
void VPiano::slotPreferences() { releaseKb(); if (dlgPreferences.exec() == QDialog::Accepted) { applyPreferences(); } grabKb(); }
// ----------------------------------------------------------------------------- // Called when the 'preset' dropdown choice is changed // ----------------------------------------------------------------------------- void GraphicsPrefsPanel::onChoicePresetSelected(wxCommandEvent& e) { int preset = choice_presets_->GetSelection(); switch (preset) { case 1: // Black cp_colour1_->SetColour(wxColour(0, 0, 0)); cp_colour2_->SetColour(wxColour(0, 0, 0)); break; case 2: // Black (checkered) cp_colour1_->SetColour(wxColour(0, 0, 0)); cp_colour2_->SetColour(wxColour(30, 30, 30)); break; case 3: // Cyan cp_colour1_->SetColour(wxColour(0, 255, 255)); cp_colour2_->SetColour(wxColour(0, 255, 255)); break; case 4: // Cyan (checkered) cp_colour1_->SetColour(wxColour(0, 255, 255)); cp_colour2_->SetColour(wxColour(20, 225, 225)); break; case 5: // Magenta cp_colour1_->SetColour(wxColour(255, 0, 255)); cp_colour2_->SetColour(wxColour(255, 0, 255)); break; case 6: // Magenta (checkered) cp_colour1_->SetColour(wxColour(255, 0, 255)); cp_colour2_->SetColour(wxColour(225, 20, 225)); break; case 7: // White cp_colour1_->SetColour(wxColour(255, 255, 255)); cp_colour2_->SetColour(wxColour(255, 255, 255)); break; case 8: // White (checkered) cp_colour1_->SetColour(wxColour(255, 255, 255)); cp_colour2_->SetColour(wxColour(225, 225, 225)); break; case 9: // Yellow cp_colour1_->SetColour(wxColour(255, 255, 0)); cp_colour2_->SetColour(wxColour(255, 255, 0)); break; case 10: // Yellow (checkered) cp_colour1_->SetColour(wxColour(255, 255, 0)); cp_colour2_->SetColour(wxColour(225, 225, 20)); break; case 11: // Vintage Id Software (aka Doom PLAYPAL index 255) cp_colour1_->SetColour(wxColour(167, 107, 107)); cp_colour2_->SetColour(wxColour(167, 107, 107)); break; default: // Default cp_colour1_->SetColour(wxColour(64, 64, 80)); cp_colour2_->SetColour(wxColour(80, 80, 96)); break; }; applyPreferences(); }
void kdvi::optionsPreferences() { if ( !prefs ) { prefs = new kdviprefs; connect( prefs, SIGNAL(preferencesChanged()), SLOT(applyPreferences())); } prefs->show(); }
void VPiano::initialization() { initMidi(); refreshConnections(); readSettings(); initToolBars(); applyPreferences(); applyConnections(); applyInitialSettings(); }
void VPiano::initialization() { if (m_initialized = initMidi()) { refreshConnections(); readSettings(); initToolBars(); applyPreferences(); applyConnections(); applyInitialSettings(); initExtraControllers(); } }
void KMixApplet::preferences() { if ( !m_pref ) { m_pref = new AppletConfigDialog( this ); connect(m_pref, SIGNAL(finished()), SLOT(preferencesDone())); connect( m_pref, SIGNAL(applied()), SLOT(applyPreferences()) ); m_pref->setActiveColors(_colors.high , _colors.low , _colors.back); m_pref->setMutedColors (_colors.mutedHigh, _colors.mutedLow, _colors.mutedBack); m_pref->setUseCustomColors( _customColors ); } m_pref->show(); m_pref->raise(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_scene(new QGraphicsScene), m_turtleGraphics(new TurtleCanvasGraphicsItem), m_cmds(m_turtleGraphics), m_prefsDialog(new PreferencesDialog(this)), m_aboutDialog(new AboutDialog(this)), m_canvasSaveOptionsDialog(new CanvasSaveOptionsDialog(this)), m_settings("settings.ini") { ui->setupUi(this); m_scene->addItem(m_turtleGraphics); ui->graphicsView->setScene(m_scene); ui->graphicsView->centerOn(0.0, 0.0); // Add the graphics view actions QAction* centerAction = new QAction("&Center View", NULL); QAction* clearAction = new QAction("C&lear Canvas", NULL); ui->graphicsView->addAction(centerAction); ui->graphicsView->addAction(clearAction); connect(centerAction, SIGNAL(triggered()), this, SLOT(centerGraphicsScene())); connect(clearAction, SIGNAL(triggered()), this, SLOT(clearCanvas())); ui->graphicsView->setContextMenuPolicy(Qt::ActionsContextMenu); ui->errorMessagesTextEdit->setTextColor(Qt::red); // These buttons are only enabled while a script is running. ui->haltButton->setEnabled(false); ui->pauseButton->setEnabled(false); ui->resumeButton->setEnabled(false); // Messages dock is hidden by default. ui->messagesDockWidget->hide(); connect(m_turtleGraphics, SIGNAL(canvasResized()), this, SLOT(resizeGraphicsScene())); connect(ui->runButton, SIGNAL(clicked()), this, SLOT(runScript())); connect(ui->haltButton, SIGNAL(clicked()), this, SLOT(haltScript())); connect(ui->pauseButton, SIGNAL(clicked()), this, SLOT(pauseScript())); connect(ui->resumeButton, SIGNAL(clicked()), this, SLOT(resumeScript())); connect(ui->action_Open_Script, SIGNAL(triggered()), this, SLOT(loadScript())); connect(ui->action_Save_Script, SIGNAL(triggered()), this, SLOT(saveScript())); connect(ui->action_Save_Canvas, SIGNAL(triggered()), this, SLOT(saveCanvas())); connect(ui->action_Preferences, SIGNAL(triggered()), m_prefsDialog, SLOT(show())); connect(ui->action_About, SIGNAL(triggered()), m_aboutDialog, SLOT(show())); connect(ui->action_Errors, SIGNAL(triggered(bool)), this, SLOT(showErrors())); connect(ui->action_Script_Output, SIGNAL(triggered(bool)), this, SLOT(showScriptOutputs())); connect(m_prefsDialog, SIGNAL(rejected()), this, SLOT(loadPreferences())); connect(m_prefsDialog, SIGNAL(accepted()), this, SLOT(applyPreferences())); connect(m_prefsDialog, SIGNAL(accepted()), this, SLOT(savePreferences())); connect(&m_cmds, SIGNAL(scriptError(QString)), this, SLOT(showScriptError(QString)), Qt::QueuedConnection); connect(&m_cmds, SIGNAL(scriptMessageReceived()), this, SLOT(showScriptOutput()), Qt::QueuedConnection); loadPreferences(); applyPreferences(); m_cmds.start(); m_cmds.setRequirePaths(""); for (const QString& path : m_settings.requirePaths()) { m_cmds.addRequirePath(path); } for (const QString& filename : m_settings.startupScripts()) { m_cmds.runScriptFile(filename); } // Don't connect this until all the startup scripts have run // to prevent the error messages box from being cleared by successful scripts. connect(&m_cmds, SIGNAL(scriptFinished(bool)), this, SLOT(scriptFinished(bool)), Qt::QueuedConnection); }
void PreferencesDialog::savePreferences() { applyPreferences(); QSettings().setValue("showMainWindowOnLaunch", ui->mainWindowOnLaunchCb->isChecked()); QSettings().setValue("displayTrayIcon", ui->displaySystrayCb->isChecked()); }
kdvi::kdvi( char *fname, QWidget *, const char *name ) : KTopLevelWidget( name ) { msg = NULL; ssmenu = NULL; hbl = NULL; prefs = NULL; keys = new KAccel(this); readConfig(); setMinimumSize( 400, 60 ); setCaption( kapp->getCaption() ); tipgroup = new QToolTipGroup( this, "TipGroup" ); connect( tipgroup, SIGNAL(showTip(const char *)), SLOT(showTip(const char *)) ); connect( tipgroup, SIGNAL(removeTip()), SLOT(removeTip()) ); // Create KPanner for toolBar2 and dviwindow kpan = new KPanner( this, "panner", KPanner::O_VERTICAL|KPanner::U_ABSOLUTE, 100); setView( kpan, TRUE ); setFrameBorderWidth( 4 ); kpan->setAbsSeparator( pannerValue ); connect( kpan, SIGNAL(positionChanged()), SLOT(pannerChanged()) ); // Create a dvi window dviwin = new dviWindow( basedpi, mfmode, paper, makepk, kpan->child1(), "dviWindow" ); connect( dviwin, SIGNAL(currentPage(int)), SLOT(setPage(int)) ); connect( dviwin, SIGNAL(shrinkChanged(int)), SLOT(shrinkChanged(int)) ); connect( dviwin, SIGNAL(fileChanged()), SLOT(fileChanged()) ); connect( dviwin, SIGNAL(statusChange(const char *)), SLOT(showTip(const char *)) ); connect( dviwin, SIGNAL(setPoint(QPoint)), SLOT(showPoint(QPoint)) ); // Create a menubar menuBar = NULL; makeMenuBar(); // Create toolbars toolBar = NULL; makeButtons(); makeToolBar2( kpan->child0() ); // Create a statusbar statusBar = NULL; makeStatusBar( i18n("No document") ); // Lay out widgets QBoxLayout *l; l = new QBoxLayout( kpan->child0(), QBoxLayout::LeftToRight ); l->addWidget( toolBar2 ); l->activate(); l = new QBoxLayout( kpan->child1(), QBoxLayout::LeftToRight ); l->addWidget( dviwin ); l->activate(); // Create RMB menu rmbmenu = new QPopupMenu; rmbmenu->setMouseTracking( TRUE ); rmbmenu->connectItem( rmbmenu->insertItem(i18n("Toggle Menubar")), this, SLOT(toggleShowMenubar()) ); rmbmenu->connectItem( rmbmenu->insertItem(i18n("Mark page")), marklist, SLOT(markSelected()) ); rmbmenu->connectItem( rmbmenu->insertItem(i18n("Redraw")), dviwin, SLOT(drawPage()) ); rmbmenu->connectItem( rmbmenu->insertItem(i18n("Preferences ...")), this, SLOT(optionsPreferences()) ); // Bind keys bindKeys(); updateMenuAccel(); // Drag and drop KDNDDropZone * dropZone = new KDNDDropZone( this , DndURL); connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ), SLOT( dropEvent( KDNDDropZone *) ) ); // Read config options applyPreferences(); selectSmall(); dviwin->installEventFilter( this ); message( "" ); openFile(QString(fname)); }
/* ColorimetryPrefsPanel::onChoiceTristimPresetSelected * Called when the tristimulus 'preset' dropdown choice is changed * CIE Lab tristimulus values are normalized so that Y is always 100.00. * X and Z depend on the observer and illuminant, here are a few values: * 2° observer 10° observer * Illuminant __Xn__ __Zn__ __Xn__ __Zn__ * A 109.83 35.55 111.16 35.19 * C 98.04 118.11 97.30 116.14 * D50 96.38 82.45 96.72 81.45 * D60 95.23 100.86 95.21 99.60 * D65 95.02 108.82 94.83 107.38 * D75 94.96 122.53 94.45 120.70 * F2 98.09 67.53 102.13 69.37 * TL4 101.40 65.90 103.82 66.90 * UL3000 107.99 33.91 111.12 35.21 * Source: http://www.hunterlab.com/appnotes/an07_96a.pdf *******************************************************************/ void ColorimetryPrefsPanel::onChoiceTristimPresetSelected(wxCommandEvent& e) { int preset = choice_presets_tristim->GetSelection(); switch (preset) { case 0: // 2°A spin_tristim_x->SetValue(109.83); spin_tristim_z->SetValue( 35.55); break; case 1: // 10°A spin_tristim_x->SetValue(111.16); spin_tristim_z->SetValue( 35.19); break; case 2: // 2°C spin_tristim_x->SetValue( 98.04); spin_tristim_z->SetValue(118.11); break; case 3: // 10°C spin_tristim_x->SetValue( 97.30); spin_tristim_z->SetValue(116.14); break; case 4: // 2°D50 spin_tristim_x->SetValue( 96.38); spin_tristim_z->SetValue( 82.45); break; case 5: // 10°D50 spin_tristim_x->SetValue( 96.72); spin_tristim_z->SetValue( 81.45); break; case 6: // 2°D60 spin_tristim_x->SetValue( 95.23); spin_tristim_z->SetValue(100.86); break; case 7: // 10°D60 spin_tristim_x->SetValue( 95.21); spin_tristim_z->SetValue( 99.60); break; case 8: // 2°D65 spin_tristim_x->SetValue( 95.02); spin_tristim_z->SetValue(108.82); break; case 9: // 10°D65 spin_tristim_x->SetValue( 94.83); spin_tristim_z->SetValue(107.38); break; case 10: // 2°D75 spin_tristim_x->SetValue( 94.96); spin_tristim_z->SetValue(122.53); break; case 11: // 10°D75 spin_tristim_x->SetValue( 94.45); spin_tristim_z->SetValue(120.70); break; case 12: // 2°F2 spin_tristim_x->SetValue( 98.09); spin_tristim_z->SetValue( 67.53); break; case 13: // 10°F2 spin_tristim_x->SetValue(102.13); spin_tristim_z->SetValue( 69.37); break; case 14: // 2°TL4 spin_tristim_x->SetValue(101.40); spin_tristim_z->SetValue( 65.90); break; case 15: // 10°TL4 spin_tristim_x->SetValue(103.82); spin_tristim_z->SetValue( 66.90); break; case 16: // 2°UL3000 spin_tristim_x->SetValue(107.99); spin_tristim_z->SetValue( 33.91); break; case 17: // 10°UL3000 spin_tristim_x->SetValue(111.12); spin_tristim_z->SetValue( 35.21); break; }; applyPreferences(); }