void MainWindow::showWindow() { if (isMinimized()) { showNormal(); readWindowSettings(); } else if (isHidden()) { show(); } activateWindow(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DevHelper::readSettings() { DREAM3DSettings prefs; prefs.beginGroup("DevHelper"); prefs.beginGroup("PluginMaker"); // Have PluginMaker read its settings pluginMaker->m_PluginName->setText(prefs.value("Plugin Name", QString("")).toString()); pluginMaker->m_OutputDir->setText(prefs.value("Output Directory", QString("")).toString()); readWindowSettings(prefs); prefs.endGroup(); prefs.beginGroup("FilterMaker"); // Have FilterMaker read its settings filterMaker->pluginDir->setText(prefs.value("Plugin Directory", QString("")).toString()); filterMaker->filterName->setText(prefs.value("Filter Name", QString("")).toString()); prefs.beginGroup("FilterParameters"); int count = prefs.value("Count", QVariant(0)).toInt(); for (int i = 0; i < count; i++) { prefs.beginGroup(QString::number(i)); AddFilterParameter addFilterParameter; addFilterParameter.setVariableName(prefs.value("Variable Name", QString("")).toString()); addFilterParameter.setHumanName(prefs.value("Human Label", QString("")).toString()); addFilterParameter.setType(prefs.value("Type", QString("")).toString()); addFilterParameter.setCategory(prefs.value("Category", QString("")).toString()); addFilterParameter.setInitValue(prefs.value("Initial Value", QString("")).toString()); filterMaker->addFilterParameterToTable(&addFilterParameter); prefs.endGroup(); } prefs.endGroup(); readWindowSettings(prefs); prefs.endGroup(); }
// ----------------------------------------------------------------------------- // Read our settings from a file // ----------------------------------------------------------------------------- void SIMPLView_UI::readSettings() { QSharedPointer<SIMPLViewSettings> prefs = QSharedPointer<SIMPLViewSettings>(new SIMPLViewSettings()); // Have the pipeline builder read its settings from the prefs file readWindowSettings(prefs.data()); readVersionSettings(prefs.data()); // Read dock widget settings prefs->beginGroup("DockWidgetSettings"); prefs->beginGroup("Issues Dock Widget"); issuesDockWidget->readSettings(this, prefs.data()); prefs->endGroup(); prefs->endGroup(); QRecentFileList::instance()->readList(prefs.data()); }
GuiMainWindow::GuiMainWindow(QWidget *parent) : QMainWindow(parent), menuCookieTermWnd(NULL), toolBarTerminalTop(this), dragDropSite(), findToolBar(NULL), webPluginWnd(NULL), mru_count_last(0), tabNavigate(NULL), paneNavigate(NULL), tabArea(new GuiTabWidget(this)), settingsWindow(NULL), compactSettingsWindow(NULL), newTabToolButton() { setWindowTitle(APPNAME); tabArea->setTabsClosable(true); tabArea->setMovable(true); // this removes the frame border of QTabWidget tabArea->setDocumentMode(true); connect(tabArea, SIGNAL(tabCloseRequested(int)), SLOT(tabCloseRequested(int))); connect(tabArea, SIGNAL(currentChanged(int)), SLOT(currentChanged(int))); connect(tabArea->getGuiTabBar(), SIGNAL(sig_tabInserted()), SLOT(on_tabLayoutChanged())); connect(tabArea->getGuiTabBar(), SIGNAL(sig_tabRemoved()), SLOT(on_tabLayoutChanged())); connect(tabArea->getGuiTabBar(), SIGNAL(tabMoved(int,int)), SLOT(on_tabLayoutChanged())); initializeMenuSystem(); inittializeDragDropWidget(); toolBarTerminalTop.initializeToolbarTerminalTop(this); tabArea->setCornerWidget(&newTabToolButton, Qt::TopLeftCorner); this->setCentralWidget(tabArea); resize(800, 600); // initial size // read & restore the settings readWindowSettings(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { readWindowSettings(); setWindowTitle(tr("Sbrowser")); //createTrayIcon(); // Таймер запоминания состояния writeWindowSettingsTimer = new QTimer(this); connect(writeWindowSettingsTimer, SIGNAL(timeout()), this, SLOT(writeWindowSettings())); writeWindowSettingsTimer->start(30 * 1000); sbrowserWidget = new SbrowserWidget(this); setCentralWidget(sbrowserWidget); // Прочитаем и установим стили QFile qssFile(":/qss/qss/sbrowserWidget.qss"); qssFile.open(QFile::ReadOnly); styleSheet = QLatin1String(qssFile.readAll()); setStyleSheet(styleSheet); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QApplication::setApplicationVersion(VER); // Setup UI ui->setupUi(this); // Configure settings readWindowSettings(); // Setup session session = new Session(this); session->readFromSettings(); connect(session, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); connect(session, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex, int, int))); connect(session, SIGNAL(messageReceived(Server*,Channel*,QString,QStringList,Channel::MessageType)), this, SLOT(handleMessage(Server*,Channel*,QString,QStringList,Channel::MessageType))); connect(session, SIGNAL(serverDisconnected(Server*)), this, SLOT(showDisconnectedMessage(Server*))); // Setup tree view connect(ui->treeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(treeItemClicked(const QModelIndex&))); ui->treeView->setModel(session); ui->treeView->setFocusPolicy(Qt::NoFocus); ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->treeView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(generateContextMenu(const QPoint &))); // Setup sending text connect(ui->sendText, SIGNAL(returnPressed()), this, SLOT(sendMessage())); connect(ui->sendText, SIGNAL(channelCycle(bool)), this, SLOT(cycleChannel(bool))); ui->sendText->setFocus(); // Setup user list ui->userList->setFocusPolicy(Qt::NoFocus); // Setup the main text area document = new QTextDocument(ui->mainText); document->setDefaultStyleSheet(this->readFile(this->mainCssFileName)); ui->mainText->setDocument(document); connect(ui->mainText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl))); // Set focus on first server QModelIndex modelIndex = session->index(0, 0); this->selectItem(modelIndex); // Setup command parser commandParser = new CommandParser(this); // Setup network manager networkAccessManager = new QNetworkAccessManager(this); connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(imageDownloaded(QNetworkReply*))); updateCheckerNetworkAccessManager = new QNetworkAccessManager(this); connect(updateCheckerNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(versionFileDownloaded(QNetworkReply*))); // Setup web view for checking oembed webView = new QWebView(this); QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, false); QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, false); webView->hide(); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webLoadFinished(bool))); // Let's get some styles up in here QString controlStyles = "QListView, QTreeView, QLineEdit, QPlainTextEdit, QTextBrowser { background:#333;font-family:\"Lucida Console\",Monaco,monospace;font-size:11px;color:#fff; }"; ui->userList->setStyleSheet(controlStyles); ui->treeView->setStyleSheet(controlStyles); ui->mainText->setStyleSheet(controlStyles); ui->sendText->setStyleSheet(controlStyles + "QLineEdit { padding:5px; }, QPlainTextEdit { padding:2px; }"); ui->userList->setAttribute(Qt::WA_MacShowFocusRect, 0); ui->treeView->setAttribute(Qt::WA_MacShowFocusRect, 0); ui->sendText->setAttribute(Qt::WA_MacShowFocusRect, 0); // Setup menu items connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(openPreferences())); connect(ui->actionNewServer, SIGNAL(triggered()), this, SLOT(newServerWindow())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutInfo())); //Check For Updates checkForUpdates(); }