void UiStyle::loadStyleSheet() { qDeleteAll(_metricsCache); _metricsCache.clear(); _formatCache.clear(); _formats.clear(); UiStyleSettings s; QString styleSheet; styleSheet += loadStyleSheet("file:///" + Quassel::findDataFilePath("stylesheets/default.qss")); styleSheet += loadStyleSheet("file:///" + Quassel::configDirPath() + "settings.qss"); if (s.value("UseCustomStyleSheet", false).toBool()) styleSheet += loadStyleSheet("file:///" + s.value("CustomStyleSheetPath").toString(), true); styleSheet += loadStyleSheet("file:///" + Quassel::optionValue("qss"), true); if (!styleSheet.isEmpty()) { QssParser parser; parser.processStyleSheet(styleSheet); QApplication::setPalette(parser.palette()); _uiStylePalette = parser.uiStylePalette(); _formats = parser.formats(); _listItemFormats = parser.listItemFormats(); styleSheet = styleSheet.trimmed(); if (!styleSheet.isEmpty()) qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application } emit changed(); }
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), _positionShift(QPoint(0,0)), _toolBar(new QToolBar(this)), _iconLable(new QLabel(this)) { setObjectName("MainWindow"); setWindowFlags(Qt::FramelessWindowHint); setContextMenuPolicy(Qt::NoContextMenu); setMouseTracking(true); QMainWindow::addToolBar(Qt::TopToolBarArea, _toolBar); _toolBar->setObjectName("MenuToolBar"); _toolBar->setMovable(false); _toolBar->setContextMenuPolicy(Qt::NoContextMenu); QWidget *spacerWidget = new QWidget(_toolBar); spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); _toolBar->addWidget(_iconLable); _spacerAction = _toolBar->addWidget(spacerWidget); _toolBar->installEventFilter(this); spacerWidget->installEventFilter(this); //TODO: Зафигачить механизм загрузки всего стиля от css до иконок основных кнопочек (крестик закрытия) QAction *closeAction = _toolBar->addAction(QIcon(":/icons/cross_grey.png"), QString::null); // setIcon(QIcon(":/icons/cross_grey.png")); loadStyleSheet(":/css/dark_theme.css"); resize(700, 500); connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); }
void TagEditor::openStyleSheet(){ QString fileName = QFileDialog::getOpenFileName(this, tr("Open style sheet file"), lastStyleSheetFolder, tr("*.qss")); if( fileName.isEmpty() ){ checkStyleAction( "Custom...", false ); return; } QFileInfo f(fileName); guiSettings->setValue("lastStyleSheetFolder",f.absolutePath()); guiSettings->sync(); bool ok = loadStyleSheet( fileName ); if(!ok){ QMessageBox::critical(this, "", "Could not open "+fileName, QMessageBox::Ok, QMessageBox::Ok); checkStyleAction( "Custom...", false ); return; } uncheckStyleActions(); checkStyleAction( "Custom...", true ); style = fileName; //lastStyleSheetFolder = f.absolutePath(); }
/** start everything */ int main(int argc, char *argv[]) { MyApplication app(argc, argv); Context ctx(app); // create task sheduler ctx.tasks = new Tasks(ctx.getMainWindow()); // check skin installation Skin::checkPresent(ctx, *ctx.getMainWindow()); // load stylesheet from skin loadStyleSheet(); // initialize the rack ctx.getTasks()->addTaskForeground( new InitTask(ctx) ); // done ctx.seq->setBeatsPerMinute(90); ctx.getRack()->setRefreshing(true); return app.exec(); }
void HTMLView::set( const QString& data ) { begin(); setUserStyleSheet( loadStyleSheet() ); write( data ); end(); }
void RackWindow::openStyleSheet() { QString fileName(QFileDialog::getOpenFileName(this, tr("Open Style Sheet"), QDir::homePath(), tr("Qt Style Sheet Files (*.qss)"))); if (!fileName.isEmpty()) { m_styleSheetName = fileName; loadStyleSheet(); } }
/*! * \fn int main(int argc, char *argv[]) * \brief Main function. * * \param argc . * \param argv . * \return 0 if normal. */ int main(int argc, char *argv[]) { QApplication app(argc, argv); mainwindow window; loadStyleSheet(); window.show(); return app.exec(); }
void StyleSheetEditor::onActionExecute(bool bChecked) { QObject* send = sender(); QAction* action = dynamic_cast<QAction*>(send); if (NULL != action) { action->setChecked(bChecked); QString strStyle = action->text(); loadStyleSheet(strStyle); } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setOrganizationName("WiiKing2"); a.setApplicationName("WiiKing2 Editor"); loadStyleSheet(); MainWindow w; w.show(); return a.exec(); }
void FrostEdit::updateSettings() { loadStyleSheet(Settings::get("Appearance/Stylesheet", "").toString()); mSyntaxStyle.load(Settings::get("Appearance/Colorscheme").toString()); mSettingsMenu->appearanceTab()->setSyntaxStyle(&mSyntaxStyle); mFont.setFamily(Settings::get("TextEditor/Font", "Lucida Console").toString()); mFont.setPointSize(Settings::get("TextEditor/FontSize", 10).toInt()); setWindowState(windowState() | Settings::get("Editor/MaximizedWindow").toBool() ? Qt::WindowMaximized : Qt::WindowNoState); setGeometry(Settings::get("Editor/WindowGeometry").toRect()); mSettingsMenu->appearanceTab()->setTextEditFont(mFont); Settings::instance().sync(); }
int main(int argc, char *argv[]) { BEGIN_RELOCATED_CODE(0x10000000); initdebug(); QApplication a(argc, argv); loadStyleSheet(); ViewController* vc = new ViewController(); return a.exec(); END_RELOCATED_CODE(); // return to the original code section }
int main(int argc, char *argv[]) { QApplication app { argc, argv }; app.setOrganizationName("stream"); loadStyleSheet(app); TrayTimer timer { app }; app.setQuitOnLastWindowClosed(false); return app.exec(); }
bool Rshare::setSheet(QString sheet) { /* If no stylesheet was specified, use the previously-saved setting */ if (sheet.isEmpty()) { sheet = Settings->getSheetName(); } /* Apply the specified GUI stylesheet */ _stylesheet = sheet; /* load the StyleSheet*/ loadStyleSheet(_stylesheet); return true; }
StyleSheetEditor::StyleSheetEditor(QWidget *parent) : QDialog(parent) { ui.setupUi(this); QRegExp regExp(".(.*)\\+?Style"); QString defaultStyle = QApplication::style()->metaObject()->className(); if (regExp.exactMatch(defaultStyle)) defaultStyle = regExp.cap(1); ui.styleCombo->addItems(QStyleFactory::keys()); ui.styleCombo->setCurrentIndex(ui.styleCombo->findText(defaultStyle, Qt::MatchContains)); ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText("Coffee")); loadStyleSheet("Coffee"); }
UiStyle::UiStyle(QObject *parent) : QObject(parent), _channelJoinedIcon(SmallIcon("irc-channel-active")), _channelPartedIcon(SmallIcon("irc-channel-inactive")), _userOfflineIcon(SmallIcon("im-user-offline")), _userOnlineIcon(SmallIcon("im-user")), _userAwayIcon(SmallIcon("im-user-away")), _categoryOpIcon(SmallIcon("irc-operator")), _categoryVoiceIcon(SmallIcon("irc-voice")), _opIconLimit(UserCategoryItem::categoryFromModes("o")), _voiceIconLimit(UserCategoryItem::categoryFromModes("v")) { // register FormatList if that hasn't happened yet // FIXME I don't think this actually avoids double registration... then again... does it hurt? if (QVariant::nameToType("UiStyle::FormatList") == QVariant::Invalid) { qRegisterMetaType<FormatList>("UiStyle::FormatList"); qRegisterMetaTypeStreamOperators<FormatList>("UiStyle::FormatList"); Q_ASSERT(QVariant::nameToType("UiStyle::FormatList") != QVariant::Invalid); } _uiStylePalette = QVector<QBrush>(NumRoles, QBrush()); // Now initialize the mapping between FormatCodes and FormatTypes... _formatCodes["%O"] = Base; _formatCodes["%B"] = Bold; _formatCodes["%S"] = Italic; _formatCodes["%U"] = Underline; _formatCodes["%R"] = Reverse; _formatCodes["%DN"] = Nick; _formatCodes["%DH"] = Hostmask; _formatCodes["%DC"] = ChannelName; _formatCodes["%DM"] = ModeFlags; _formatCodes["%DU"] = Url; setTimestampFormatString("[hh:mm:ss]"); // BufferView / NickView settings UiStyleSettings s; _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons", true).toBool(); s.notify("ShowItemViewIcons", this, SLOT(showItemViewIconsChanged(QVariant))); _allowMircColors = s.value("AllowMircColors", true).toBool(); s.notify("AllowMircColors", this, SLOT(allowMircColorsChanged(QVariant))); loadStyleSheet(); }
void StyleEngene::setStyle(QString internalName) { if(_styleMap.contains(internalName)) { _currentStyle = _styleMap[internalName]; m_iconCache.clear(); } else { qCritical() << "No style found"; return; } initIcons(); loadStyleSheet(StaticHelpers::CombinePathes(_currentStyle.rootPath, "style.qss")); emit styleChanged(); }
/** Constructor */ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) : QMainWindow(parent, flags) { /* Invoke the Qt Designer generated QObject setup routine */ ui.setupUi(this); setWindowTitle(tr("RetroShare")); Settings->loadWidgetInformation(this); // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); loadStyleSheet("Default"); /* Create the config pages and actions */ QActionGroup *grp = new QActionGroup(this); StatisticDialog *statisticDialog = NULL; ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages), createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); PhotoDialog *photoDialog = NULL; ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp)); GamesDialog *gamesDialog = NULL; ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp)); CalDialog *calDialog = NULL; ui.stackPages->add(calDialog = new CalDialog(ui.stackPages), createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp)); /* Create the toolbar */ ui.toolBar->addActions(grp->actions()); ui.toolBar->addSeparator(); connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_currentIssueId(0) { ui->setupUi(this); // set default settings QCoreApplication::setOrganizationName("Adyax"); QCoreApplication::setOrganizationDomain("adyax.com"); QCoreApplication::setApplicationName("qRedmine"); createWidgets(); createActions(); // createTrayIcon(); createShortcuts(); // FIXME: comment do to qt5 tray icon bug //#ifdef Q_OS_LINUX // QProcess process; // QStringList listIdentifierOfAllowedDistros; // listIdentifierOfAllowedDistros << "ksmserver" << "openbox"; // process.start("pidof", listIdentifierOfAllowedDistros); // if (!process.waitForFinished() || !process.readAllStandardOutput().isEmpty()) { // m_trayIcon->show(); // } //#else // m_trayIcon->show(); //#endif // check that we have all crucial parameters configured readSettings(); verifySettings(); loadStyleSheet(); m_redmine->fetchActivities(); m_progress_dialog->show(); fetchIssues(); m_redmine->fetchTimeEntries(); }
Application::Application(int &argc, char **argv, AppCliOptions *cli_opts) : Super(argc, argv) , m_cliOptions(cli_opts) { auto *style = qf::qmlwidgets::Style::instance(); style->setIconPath(":/qf/qmlwidgets/images/flat"); loadStyleSheet(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString http_proxy = env.value(QStringLiteral("http_proxy")); if(!http_proxy.isEmpty()) { if(http_proxy.startsWith(QLatin1String("http://"))) http_proxy = http_proxy.mid(7); QString host = http_proxy.section(':', 0, 0); int port = http_proxy.section(':', 1).toInt(); if(!host.isEmpty() && port > 0) { qfInfo() << QString("Setting app http proxy to: %1:%2").arg(host).arg(port); QNetworkProxy proxy; proxy.setType(QNetworkProxy::HttpProxy); proxy.setHostName(host); proxy.setPort(port); //proxy.setUser("username"); //proxy.setPassword("password"); QNetworkProxy::setApplicationProxy(proxy); } } #ifdef Q_OS_UNIX QString plugin_path = QCoreApplication::applicationDirPath() + "/../lib/qml/" + QCoreApplication::applicationName().toLower(); #else QString plugin_path = QCoreApplication::applicationDirPath() + "/qml/" + QCoreApplication::applicationName().toLower(); #ifdef Q_OS_WIN qfInfo() << "Adding DLL search path:" << plugin_path; SetDllDirectory(reinterpret_cast<LPCWSTR>(plugin_path.utf16())); #endif #endif qf::qmlwidgets::reports::ReportProcessor::qmlEngineImportPaths().append(plugin_path); }
void FrostEdit::applySettings() { loadStyleSheet(Settings::get("Appearance/StyleSheet", "").toString()); //mSyntaxStyle.load(Settings::get("Appearance/Colorscheme").toString()); //mSettingsMenu->setSyntaxStyle(&mSyntaxStyle); mFont.setFamily(Settings::get("TextEditor/Font", "Lucida Console").toString()); mFont.setPointSize(Settings::get("TextEditor/FontSize", 10).toInt()); for(TabWidgetFrame* tabf: mTabWidgetFrames) { TabWidget* wid =tabf->tabWidget(); for(int i = 0; i < wid->count(); i++) { TextEdit* e = toTextEdit(wid->widget(i)); e->setFont(mFont); mSyntaxStyle.applyToTextEdit(e); } } for(auto i: mOpenDocuments.keys()) { Document* doc = mOpenDocuments[i]; TextEditor::Internal::Highlighter* hilt = doc->getHighlighter(); if(hilt != nullptr) { qDebug() << "Found a highlighter!"; mSyntaxStyle.applyToHighlighter(hilt); hilt->rehighlight(); } } for(int i = 0; i < mApplicationOutput->count(); i++) { Console* c = toConsole(mApplicationOutput->widget(i)); mSyntaxStyle.applyToConsole(c); } mSyntaxStyle.applyToConsole(mCompileOutput); mSyntaxStyle.applyToIssueList(mIssueList); }
void TagEditor::setGUIStyle( const QString &s ){ qDebug()<<"style: "<<s; QStringList styles = QStyleFactory::keys(); qDebug()<<styles;qDebug()<<"contains: "<<styles.contains( s ); if( styles.contains( s ) ){ //build in style QList<QAction *> actions = menuStyle->actions(); qDebug()<<actions.size(); for(int i=0;i<actions.size();i++){ qDebug()<<actions[i]->text(); if( actions[i]->text()==s ){ QApplication::setStyle( QStyleFactory::create ( s ) ); uncheckStyleActions(); style = s; actions[i]->setChecked(true); return; } } } //if function has not returned yet, assume qss file qDebug()<<"Custom style!"; bool ok = loadStyleSheet( s ); if(!ok){ QMessageBox::critical(this, "", "Could not open style "+s, QMessageBox::Ok, QMessageBox::Ok); //uncheck currently clicked action checkStyleAction( "Custom...", false ); }else{ uncheckStyleActions(); checkStyleAction( "Custom...", true ); style = s; } }
void UiStyle::reload() { loadStyleSheet(); }
void TextRoom::readSettings() { QFile file( settings->fileName() ); if ( !file.exists() ) { toggleFullScreen(); writeSettings(); return; } if ( settings->value("WindowState/ShowFullScreen", true).toBool() ) { if ( !isFullScreen() ) showFullScreen(); } else { showNormal(); QPoint pos = settings->value("WindowState/TopLeftPosition", QPoint(100, 100)).toPoint(); QSize size = settings->value("WindowState/WindowSize", QSize(300, 200)).toSize(); resize(size); move(pos); } QString foregroundColor = settings->value("Colors/FontColor", "#808080" ).toString(); QString back = settings->value("Colors/Background", "#000000" ).toString(); QString status_c = settings->value("Colors/StatusColor", "#202020" ).toString(); // oxygen does weird stuff with the background QApplication::setStyle("plastique"); QFont font; font.fromString( settings->value("StatusFont").toString()); defaultFont.fromString( settings->value("DefaultFont").toString() ); statsLabel->setFont( font ); deadlineLabel->setFont ( font ) ; curDir = settings->value("RecentFiles/LastDir", curDir).toString(); lastSearch = settings->value("TextSearch/LastPhrase", lastSearch).toString(); QDateTime today = QDateTime::currentDateTime(); QString todaytext = today.toString("yyyyMMdd"); // Read all the settings-> isAutoSave = settings->value("AutoSave", false).toBool(); isFlowMode = settings->value("FlowMode", false).toBool(); isSound = settings->value("Sound", true).toBool(); isPageCount = settings->value("PageCount", false).toBool(); isCharacterCount = settings->value("CharacterCount", false).toBool(); deadlinetext = settings->value("Deadline", todaytext).toString(); deadline = QDate::fromString(deadlinetext, "yyyyMMdd"); wordcount = settings->value("WordCount", 0).toInt(); editorWidth = settings->value("EditorWidth", 800).toInt(); editorTopSpace = settings->value("EditorTopSpace", 0).toInt(); editorBottomSpace = settings->value("EditorBottomSpace", 0).toInt(); alarm = settings->value("TimedWriting", 0).toInt(); pageCountFormula = settings->value("PageCountFormula", 250).toInt(); dateFormat = settings->value("DateFormat", "d MMMM yyyy dddd").toString(); timeFormatBool = settings->value("24-Hour", true ).toBool(); defaultDir = settings->value("DefaultDirectory", QDir::homePath()).toString(); backgroundImage = settings->value("BackgroundImage", "").toString(); isPlainText = settings->value("PlainText", false).toBool(); language = settings->value("LanguageName", "en_US").toString(); indentValue = settings->value("Indent", 50).toInt(); paragraphSpacing = settings->value("ParagraphSpacing", 20).toInt(); tabStopWidth = settings->value("TabStopWidth", 80).toInt(); cursorWidth = settings->value("CursorWidth", 3).toInt(); textEdit->setLayoutDirection(Qt::LayoutDirectionAuto); textEdit->setTabStopWidth(tabStopWidth); textEdit->setCursorWidth(cursorWidth); loadStyleSheet(foregroundColor, back, status_c); textEdit->setMaximumWidth(editorWidth); textEdit->document()->blockSignals(true); bool modified = textEdit->document()->isModified(); if ( isPlainText ) { QString text( textEdit->document()->toPlainText() ); textEdit->document()->clear(); textEdit->insertPlainText(text); textEdit->setAcceptRichText( false ); } else { textEdit->setAcceptRichText( true ); } indentLines(indentValue); setWindowModified(modified); textEdit->document()->setModified(modified); textEdit->document()->blockSignals(false); if ( timeFormatBool ) { timeFormat = "h:mm"; } else { timeFormat = "h:mm AP"; } horizontalSlider->setVisible( settings->value("ScrollBar", true).toBool() ); isScrollBarVisible = horizontalSlider->isVisible(); vPositionChanged(); topSpacer->changeSize(20, editorTopSpace, QSizePolicy::Maximum, QSizePolicy::Maximum); bottomSpacer->changeSize(20, editorBottomSpace, QSizePolicy::Maximum, QSizePolicy::Maximum); timeOut = alarm * 60000; if (alarm != 0) { QTimer::singleShot(timeOut, this, SLOT(alarmTime())); } if ( (optOpenLastFile = settings->value("RecentFiles/OpenLastFile", true).toBool()) ) { curFile = settings->value("RecentFiles/LastFile", curFile).toString(); if ( (isSaveCursor = settings->value("RecentFiles/SavePosition", true).toBool() )) cPosition = settings->value("RecentFiles/AtPosition", cPosition).toInt(); } wordCountChanged = true; getFileStatus(); sCursor(); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(resources); qInstallMessageHandler(messageOutput); QApplication app(argc, argv); app.setStyleSheet(loadStyleSheet(":/qss/main.qss")); // Вызываем поддержку перевода QTranslator * qt_translator = new QTranslator(); QString file_translate = QApplication::applicationDirPath() + "/ru.qm"; if ( !qt_translator->load(file_translate)) { delete qt_translator; } else qApp->installTranslator( qt_translator ); //initialize file of settings if(!Setting::init()) { QMessageBox::information(0, "Error", "Can not create file of setting: uploader.ini"); qDebug() << "Can not create file of setting: uploader.ini"; exit(0); } else qDebug() << "Create uploader.ini"; qDebug() << "Project started"; try { MainWindowView* viewMain = MainWindowView::instance(); //MainWindowView viewMain; if(!viewMain->initControls()) throw(QString("Don't create MainWindowView!")); AddFilesPanelView viewAddPanel(viewMain); if(!viewAddPanel.initControls()) throw(QString("Don't create AddFilePanel!")); UploadProgressView viewUploadPanel(viewMain); if(!viewUploadPanel.initControls()) throw(QString("Don't create UploadProgressView!")); AddFilesPresenter presenterAdd(&viewAddPanel); UploadProgressPresenter presenterUpload(&viewUploadPanel); viewMain->setPanel(&viewAddPanel, &viewUploadPanel); MainWindowPresenter presenterMain(viewMain); presenterMain.addPresenter(&presenterAdd, &presenterUpload); viewMain->show(); return app.exec(); } catch(QString ex_str) { QMessageBox::information(0, "Error!", ex_str); qDebug() << "Error: " << ex_str; exit(0); } catch(...) { QMessageBox::information(0, "Error!", "Unknown error!"); qDebug() << "Unknown error!"; exit(0); } return 0;//app.exec(); }
void StyleSheetEditor::init() { m_qSS_Actions.clear(); loadStyle(); loadStyleSheet(); }
RackWindow::RackWindow() : m_coreImpl(new CoreImpl(this)), m_mainSplitter(new RSplitter(Qt::Horizontal)), m_mapperLoadNewPlugin(new QSignalMapper(this)), m_mapperClosePlugin(new QSignalMapper(this)), m_mapperClosePluginHost(new QSignalMapper(this)) { setContextMenuPolicy(Qt::NoContextMenu); m_styleSheetName = ":/stylesheets/default.qss"; loadStyleSheet(); m_mainSplitter->setObjectName("rackMainSplitter"); setCentralWidget(m_mainSplitter); //test webkit crash: // QPluginLoader pluginLoader("/home/rf/Dokumente/rack-radio-automation-construction-kit/build-release/app/plugins/libwebbrowserplugin.so"); // QObject *plugin = pluginLoader.instance(); // if (plugin) // { // IWidgetPlugin *widgetPlugin = qobject_cast<IWidgetPlugin *>(plugin); // if (widgetPlugin) // { // QWidget *newWidget = widgetPlugin->createRWidget(m_coreImpl, this); // setCentralWidget(newWidget); // } // } //end; createToolBars(); createPluginHost(0); RPreviewWidget *previewWidget = new RPreviewWidget(this); QObject::connect(m_coreImpl, SIGNAL(previewStateChanged(bool)), previewWidget, SLOT(fade(bool))); QObject::connect(m_mapperLoadNewPlugin, SIGNAL(mapped(QWidget*)), this, SLOT(loadPlugin(QWidget*))); QObject::connect(m_mapperClosePlugin, SIGNAL(mapped(QObject*)), this, SLOT(deletePluginSwitchAction(QObject*))); QObject::connect(m_mapperClosePluginHost, SIGNAL(mapped(QWidget*)), this, SLOT(closePluginHost(QWidget*))); QObject::connect(this, SIGNAL(enterSettingsMode()), m_mainSplitter, SIGNAL(enterSettingsMode())); QObject::connect(this, SIGNAL(leaveSettingsMode()), m_mainSplitter, SIGNAL(leaveSettingsMode())); emit leaveSettingsMode(); }
void StyleSheetEditor::on_styleSheetCombo_activated(const QString &sheetName) { loadStyleSheet(sheetName); }
foreach (QString sheet, list) { loadStyleSheet(sheet); }
void RackWindow::createToolBars() { //main toolbar actions: QAction *fullscreenAct = new QAction(tr("Fullscreen"), this); fullscreenAct->setCheckable(true); QAction *enterSettingsAct = new QAction(tr("Change Widget Layout"), this); QAction *quitAct = new QAction(tr("Quit"), this); //main toolbar menus: QMenu *mainMenu = new QMenu(this); mainMenu->setObjectName("rackMainMenu"); QAction *titleAct = new QAction(tr("R.A.C.K."),this); titleAct->setDisabled(true); mainMenu->addAction(titleAct); mainMenu->setDefaultAction(titleAct); mainMenu->addAction(fullscreenAct); mainMenu->addAction(enterSettingsAct); mainMenu->addAction(quitAct); //main toolbar buttons: RPushButton *settingsButton = new RPushButton(tr("Menu")); settingsButton->setObjectName("rackSettingsButton"); settingsButton->setMenu(mainMenu); RBlinkButton *deleteButton = new RBlinkButton(tr("Delete")); deleteButton->setObjectName("rackDeleteButton"); RBlinkButton *previewButton = new RBlinkButton(tr("Preview")); previewButton->setObjectName("rackPreviewButton"); //main toolbar: QToolBar *mainToolBar = new QToolBar; mainToolBar->setObjectName("rackMainToolBar"); mainToolBar->setMovable(false); mainToolBar->addWidget(settingsButton); mainToolBar->addWidget(deleteButton); mainToolBar->addWidget(previewButton); //delete state: QObject::connect(deleteButton, SIGNAL(clicked()), m_coreImpl, SLOT(toggleDeleteState())); QObject::connect(m_coreImpl, SIGNAL(deleteStateChanged(bool)), deleteButton, SLOT(setBlinking(bool))); //preview state: QObject::connect(previewButton, SIGNAL(clicked()), m_coreImpl, SLOT(togglePreviewState())); QObject::connect(m_coreImpl, SIGNAL(previewStateChanged(bool)), previewButton, SLOT(setBlinking(bool))); //normal state: QObject::connect(this, SIGNAL(enterSettingsMode()), m_coreImpl, SLOT(setNormalState())); //main toolbar signals & slots: QObject::connect(fullscreenAct, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen())); QObject::connect(enterSettingsAct, SIGNAL(triggered()), SIGNAL(enterSettingsMode())); QObject::connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); QObject::connect(this, SIGNAL(enterSettingsMode()), mainToolBar, SLOT(hide())); QObject::connect(this, SIGNAL(leaveSettingsMode()), mainToolBar, SLOT(show())); /////////////////////////save tests QAction *saveAct = new QAction(tr("Save"), this); mainMenu->addAction(saveAct); QObject::connect(saveAct, SIGNAL(triggered()), this, SLOT(savePluginHosts())); //////////////////////////// /////////////////////////style sheet load QAction *styleAct = new QAction(tr("Load Style Sheet"), this); mainMenu->addAction(styleAct); QObject::connect(styleAct, SIGNAL(triggered()), this, SLOT(openStyleSheet())); //////////////////////////// /////////////////////////style sheet reload QAction *restyleAct = new QAction(tr("Reload Style Sheet"), this); mainMenu->addAction(restyleAct); QObject::connect(restyleAct, SIGNAL(triggered()), this, SLOT(loadStyleSheet())); //////////////////////////// //settings toolbar buttons: RPushButton *settingsOKButton = new RPushButton(tr("OK")); settingsOKButton->setObjectName("rackSettingsOKButton"); RPushButton *settingsCancelButton = new RPushButton(tr("Cancel")); settingsCancelButton->setObjectName("rackSettingsCancelButton"); //settings toolbar: QToolBar *settingsToolBar = new QToolBar; settingsToolBar->setObjectName("rackSettingsToolBar"); settingsToolBar->setMovable(false); settingsToolBar->addWidget(settingsOKButton); settingsToolBar->addWidget(settingsCancelButton); //settings toolbar signals & slots: QObject::connect(settingsOKButton, SIGNAL(clicked()), SIGNAL(leaveSettingsMode())); QObject::connect(this, SIGNAL(enterSettingsMode()), settingsToolBar, SLOT(show())); QObject::connect(this, SIGNAL(leaveSettingsMode()), settingsToolBar, SLOT(hide())); //add toolbars to mainwindow: addToolBar(Qt::BottomToolBarArea, mainToolBar); addToolBar(Qt::BottomToolBarArea, settingsToolBar); }
MainWindow::MainWindow(Configuration *config, QWidget *parent) : QDialog(parent) { this->config = config; QLabel *machineLabel = new QLabel("Machine:", this); machine = new ComboBox(this); machine->setFocusPolicy(Qt::NoFocus); machine->addItems(config->getMachTypeList()); machine->setCurrentIndex(config->getMachType()); #ifndef __arm__ quitButton = new QPushButton(tr("&Quit"), this); quitButton->setDisabled(true); connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); #endif resetButton = new QPushButton("&Reset", this); QStringList iplist = config->getHostAddress().split("."); QLabel *ipAddrLabel = new QLabel("IP Address:", this); ipAddr0 = new SpinBox(this); ipAddr0->setRange(127, 254); ipAddr0->setValue(iplist[0].toInt()); ipAddr1 = new SpinBox(this); ipAddr1->setRange(0, 254); ipAddr1->setValue(iplist[1].toInt()); ipAddr2 = new SpinBox(this); ipAddr2->setRange(0, 254); ipAddr2->setValue(iplist[2].toInt()); ipAddr3 = new SpinBox(this); ipAddr3->setRange(220, 250); ipAddr3->setValue(iplist[3].toInt()); QHBoxLayout *ipAddrLayout = new QHBoxLayout; ipAddrLayout->setSpacing(0); ipAddrLayout->addWidget(ipAddr0); ipAddrLayout->addWidget(ipAddr1); ipAddrLayout->addWidget(ipAddr2); ipAddrLayout->addWidget(ipAddr3); #if 0 QStringList maclist = config->getMacEther().split(":"); QLabel *macAddrLabel = new QLabel("MAC Address:"); macAddr0 = new SpinBox(this); macAddr0->setRange(0, 99); macAddr0->setValue(maclist[0].toInt()); macAddr1 = new SpinBox(this); macAddr1->setRange(0, 99); macAddr1->setValue(maclist[1].toInt()); macAddr2 = new SpinBox(this); macAddr2->setRange(0, 99); macAddr2->setValue(maclist[2].toInt()); macAddr3 = new SpinBox(this); macAddr3->setRange(0, 99); macAddr3->setValue(maclist[3].toInt()); macAddr4 = new SpinBox(this); macAddr4->setRange(0, 99); macAddr4->setValue(maclist[4].toInt()); macAddr5 = new SpinBox(this); macAddr5->setRange(0, 99); macAddr5->setValue(maclist[5].toInt()); QHBoxLayout *macAddrLayout = new QHBoxLayout(); macAddrLayout->setSpacing(0); macAddrLayout->addWidget(macAddr0); macAddrLayout->addWidget(macAddr1); macAddrLayout->addWidget(macAddr2); macAddrLayout->addWidget(macAddr3); macAddrLayout->addWidget(macAddr4); macAddrLayout->addWidget(macAddr5); #endif applyButton = new QPushButton("&Apply", this); connect(applyButton, SIGNAL(clicked()), this, SLOT(apply())); tableWidget = new QTableWidget(0, 7, this); tableWidget->setFocusPolicy(Qt::NoFocus); tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); tableWidget->setAlternatingRowColors(true); tableWidget->setHorizontalHeaderLabels( QStringList() << tr("Device") << tr("Baudrate") << tr("Total Received") << tr("Total Sent") << tr("Receiving") << tr("Sending") << tr("Status")); deviceDescription = new QTableWidget(0, 2, this); deviceDescription->setFocusPolicy(Qt::NoFocus); deviceDescription->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch); deviceDescription->setAlternatingRowColors(true); deviceDescription->setHorizontalHeaderLabels( QStringList() << tr("Device") << tr("Description")); deviceDescription->setColumnWidth(0, 200); #ifdef __arm__ if (config->getMachType() == MACH_VITAS) { addProxy(&consolePort, "/dev/ttySAC0", BAUD115200, 0, "Console"); addProxy(&module0Port, "/dev/ttySAC1", BAUD115200, 1, "Standard parameters of the module"); addProxy(&printerPort, "/dev/ttySAC2", BAUD38400, 2, "Printer"); addProxy(&module1Port, "/dev/ttySAC3", BAUD19200, 3, "CO2 module"); addProxy(&systemPort, "/dev/ttySYS", BAUD4800, 4, "System board"); } else if (config->getMachType() == MACH_G60_COMMON) { addProxy(&consolePort, "/dev/ttySAC0", BAUD115200, 0, "Console"); addProxy(&module0Port, "/dev/ttySAC1", BAUD500000, 1, "Built-in plug-in cage"); addProxy(&printerPort, "/dev/ttySAC2", BAUD38400, 2, "Printer"); addProxy(&module1Port, "/dev/ttySAC3", BAUD500000, 3, "External plug-in cage"); addProxy(&systemPort, "/dev/ttyS0", BAUD4800, 4, "System board"); addProxy(&tsPort, "/dev/ttyS1", BAUD9600, 5, "Touchscreen"); } else if (config->getMachType() == MACH_G60_SFDA) { addProxy(&consolePort, "/dev/ttySAC0", BAUD115200, 0, "Console"); addProxy(&systemPort, "/dev/ttySAC1", BAUD4800, 1, "System board"); addProxy(&printerPort, "/dev/ttySAC2", BAUD38400, 2, "Printer"); addProxy(&tsPort, "/dev/ttySAC3", BAUD9600, 3, "Touchscreen"); addProxy(&module0Port, "/dev/ttySS0", BAUD500000, 4, "Built-in plug-in cage"); addProxy(&module1Port, "/dev/ttySS1", BAUD500000, 5, "Built-in plug-in cage"); tableWidget->hideRow(5); deviceDescription->hideRow(5); addProxy(&module2Port, "/dev/ttySS2", BAUD500000, 6, "External plug-in cage"); addProxy(&module3Port, "/dev/ttySS3", BAUD500000, 7, "External plug-in cage"); } #else addProxy(&consolePort, "/dev/ttySAC0", BAUD115200, 0, "Console"); addProxy(&systemPort, "/dev/ttySAC1", BAUD4800, 1, "System board"); addProxy(&printerPort, "/dev/ttySAC2", BAUD38400, 2, "Printer"); addProxy(&tsPort, "/dev/ttySAC3", BAUD9600, 3, "Touchscreen"); addProxy(&module0Port, "/dev/ttySS0", BAUD500000, 4, "Built-in plug-in cage"); addProxy(&module1Port, "/dev/ttySS1", BAUD500000, 5, "Built-in plug-in cage"); tableWidget->hideRow(5); deviceDescription->hideRow(5); addProxy(&module2Port, "/dev/ttySS2", BAUD500000, 6, "External plug-in cage"); addProxy(&module3Port, "/dev/ttySS3", BAUD500000, 7, "External plug-in cage"); #endif statusBar = new QStatusBar(this); statusBar->showMessage("Proxy server is starting ..."); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(machineLabel, 0, 0); mainLayout->addWidget(machine, 0, 1); #ifndef __arm__ mainLayout->addWidget(quitButton, 0, 7); #endif mainLayout->addWidget(ipAddrLabel, 1, 0); mainLayout->addLayout(ipAddrLayout, 1, 1, 1, 2); #if 0 mainLayout->addWidget(macAddrLabel, 2, 0); mainLayout->addLayout(macAddrLayout, 2, 1, 1, 2); mainLayout->addWidget(applyButton, 2, 3); mainLayout->addWidget(resetButton, 2, 7); #else mainLayout->addWidget(applyButton, 1, 3); mainLayout->addWidget(resetButton, 1, 7); #endif mainLayout->addWidget(tableWidget, 3, 0, 1, 8); mainLayout->addWidget(deviceDescription, 4, 0, 1, 8); mainLayout->addWidget(statusBar, 5, 0, 1, 8); setLayout(mainLayout); loadStyleSheet("default"); // loadStyleSheet("suresign"); }