void tiBackupEdit::on_btnEditScriptAfterBackup_clicked() { QMainWindow *winScriptEditor = new QMainWindow(this, Qt::Dialog); winScriptEditor->setWindowModality(Qt::WindowModal); winScriptEditor->setAttribute(Qt::WA_DeleteOnClose, true); QString path = ui->leScriptPathAfterBackup->text(); tiConfMain main_settings; if(path.isEmpty()) { QDateTime currentDate = QDateTime::currentDateTime(); path = QString("%1/%2_afterbackup.sh").arg(main_settings.getValue("paths/scripts").toString(), currentDate.toString("yyyyMMddhhmmss")); //ui->leScriptPathAfterBackup->setText(path); } //tiPreferences *f = new tiPreferences(winScriptEditor); scriptEditor *e = new scriptEditor(winScriptEditor); e->loadScript(path); QObject::connect(e, SIGNAL(scriptSaved(QString)), this, SLOT(onScriptAfterChanged(QString))); winScriptEditor->setCentralWidget(e); winScriptEditor->setMinimumSize(QSize(e->width(),e->height())); //winScriptEditor->setMaximumSize(QSize(e->width(),e->height())); winScriptEditor->setWindowTitle(windowTitle() + QObject::trUtf8(" - Script Editor")); winScriptEditor->show(); qDebug() << "tiBackupAdd::on_btnEditScriptAfterBackup_clicked() -> test test"; }
/** * Construct an SpectrumView to display data from the specified data source. * The specified SpectrumDataSource must be constructed elsewhere and passed * into this SpectrumView constructor. Most other components of the SpectrumView * are managed by this class. That is the graphs, image display and other * parts of the SpectrumView are constructed here and are deleted when the * SpectrumView destructor is called. * * @param dataSource The source of the data that will be displayed. * @param peakMin The min peak value * @param peakMax The max peak value * @param backMin The min background value * @param backMax The max background value * @param tofMin The min time of flight value * @param tofMax The max time of flight value */ RefImageView::RefImageView( SpectrumView::SpectrumDataSource_sptr dataSource, int peakMin, int peakMax, int backMin, int backMax, int tofMin, int tofMax) : m_ui(new Ui::RefImageViewer()) { QMainWindow* window = this; m_ui->setupUi( window ); window->resize( 1050, 800 ); window->show(); window->setAttribute(Qt::WA_DeleteOnClose); // We just need to close the // window to trigger the // destructor and clean up window->setWindowTitle(QString::fromUtf8("Reflector Detector Viewer")); m_sliderHandler = new RefSliderHandler( m_ui ); m_rangeHandler = new RefRangeHandler( m_ui ); // Create the handler for comminicating peak/background/tof values to/from the ui // This ends up being owned by the RefImagePlotItem instance RefLimitsHandler* limits_handler = new RefLimitsHandler(m_ui); m_hGraph = new SpectrumView::GraphDisplay( m_ui->h_graphPlot, NULL, false ); m_vGraph = new SpectrumView::GraphDisplay( m_ui->v_graphPlot, NULL, true ); m_imageDisplay = new RefImageDisplay( m_ui->imagePlot, m_sliderHandler, m_rangeHandler, limits_handler, m_hGraph, m_vGraph, m_ui->image_table); RefIVConnections * iv_connections = new RefIVConnections( m_ui, this, m_imageDisplay, m_hGraph, m_vGraph ); // Set validators on the QLineEdits to restrict them to integers m_ui->lineEdit_peakLeft->setValidator(new QIntValidator(this)); m_ui->lineEdit_peakRight->setValidator(new QIntValidator(this)); m_ui->lineEdit_backLeft->setValidator(new QIntValidator(this)); m_ui->lineEdit_backRight->setValidator(new QIntValidator(this)); m_ui->lineEdit_TOFmin->setValidator(new QIntValidator(this)); m_ui->lineEdit_TOFmax->setValidator(new QIntValidator(this)); //populate widgets with peak, back and tof values limits_handler->setPeakLeft(peakMin); limits_handler->setPeakRight(peakMax); limits_handler->setBackLeft(backMin); limits_handler->setBackRight(backMax); limits_handler->setTOFmin(tofMin); limits_handler->setTOFmax(tofMax); m_ivConnections = iv_connections; m_imageDisplay->updateImage(); iv_connections->peakBackTofRangeUpdate(); m_imageDisplay->setDataSource( dataSource ); }
/****************************************************************************** * Is called when the user presses the "Open Inspector" button. ******************************************************************************/ void DislocationNetworkEditor::onOpenInspector() { DislocationNetwork* dislocationsObj = static_object_cast<DislocationNetwork>(editObject()); if(!dislocationsObj) return; QMainWindow* inspectorWindow = new QMainWindow(container()->window(), (Qt::WindowFlags)(Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint)); inspectorWindow->setWindowTitle(tr("Dislocation Inspector")); PropertiesPanel* propertiesPanel = new PropertiesPanel(inspectorWindow); propertiesPanel->hide(); QWidget* mainPanel = new QWidget(inspectorWindow); QVBoxLayout* mainPanelLayout = new QVBoxLayout(mainPanel); mainPanelLayout->setStretch(0,1); mainPanelLayout->setContentsMargins(0,0,0,0); inspectorWindow->setCentralWidget(mainPanel); ObjectNode* node = dynamic_object_cast<ObjectNode>(dataset()->selection()->front()); DislocationInspector* inspector = new DislocationInspector(node); connect(inspector, &QObject::destroyed, inspectorWindow, &QMainWindow::close); inspector->setParent(propertiesPanel); inspector->initialize(propertiesPanel, mainWindow(), RolloutInsertionParameters().insertInto(mainPanel)); inspector->setEditObject(dislocationsObj); inspectorWindow->setAttribute(Qt::WA_DeleteOnClose); inspectorWindow->resize(1000, 350); inspectorWindow->show(); }
int main(int argc, char *argv[]) { #ifndef Q_OS_MAC Q_INIT_RESOURCE(SonicPi); #endif QApplication app(argc, argv); qRegisterMetaType<SonicPiLog::MultiMessage>("SonicPiLog::MultiMessage"); QString systemLocale = QLocale::system().name(); QTranslator qtTranslator; qtTranslator.load("qt_" + systemLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); QTranslator translator; bool i18n = translator.load("sonic-pi_" + systemLocale, ":/lang/") || systemLocale.startsWith("en") || systemLocale == "C"; app.installTranslator(&translator); app.setApplicationName(QObject::tr("Sonic Pi")); app.setStyle("gtk"); #ifdef Q_OS_MAC app.setAttribute( Qt::AA_UseHighDpiPixmaps ); QMainWindow* splashWindow = new QMainWindow(0, Qt::FramelessWindowHint); QLabel* imageLabel = new QLabel(); splashWindow->setAttribute( Qt::WA_TranslucentBackground); QPixmap image(":/images/[email protected]"); imageLabel->setPixmap(image); splashWindow->setCentralWidget(imageLabel); splashWindow->setMinimumHeight(image.height()/2); splashWindow->setMaximumHeight(image.height()/2); splashWindow->setMinimumWidth(image.width()/2); splashWindow->setMaximumWidth(image.width()/2); splashWindow->raise(); splashWindow->show(); MainWindow mainWin(app, i18n, splashWindow); return app.exec(); #else QPixmap pixmap(":/images/splash.png"); QSplashScreen *splash = new QSplashScreen(pixmap); splash->setMask(pixmap.mask()); splash->show(); splash->repaint(); MainWindow mainWin(app, i18n, splash); return app.exec(); #endif }
void Tray::on_ShowLog_triggered() { QMainWindow *mw = new QMainWindow(); mw->setAttribute(Qt::WA_DeleteOnClose); QTextBrowser *tb = new QTextBrowser(); mw->setCentralWidget(tb); mw->setWindowTitle(QString::fromLatin1("Murmur -- %1").arg(MUMBLE_RELEASE)); connect(le, SIGNAL(newLogEntry(const QString &)), tb, SLOT(append(const QString &))); foreach(const QString &m, qlLog) tb->append(m); mw->show(); }
int main(int argc, char *argv[]) { // Q_INIT_RESOURCE(application); QApplication app(argc, argv); app.setApplicationName("Sonic Pi"); app.setStyle("gtk"); #ifdef Q_OS_MAC app.setAttribute( Qt::AA_UseHighDpiPixmaps ); #endif QMainWindow* splashWindow = new QMainWindow(0, Qt::FramelessWindowHint); QLabel* imageLabel = new QLabel(); splashWindow->setAttribute( Qt::WA_TranslucentBackground); #ifdef Q_OS_MAC QPixmap image(":/images/[email protected]"); imageLabel->setPixmap(image); splashWindow->setCentralWidget(imageLabel); splashWindow->setMinimumHeight(image.height()/2); splashWindow->setMaximumHeight(image.height()/2); splashWindow->setMinimumWidth(image.width()/2); splashWindow->setMaximumWidth(image.width()/2); sleep(3); #else QPixmap image(":/images/splash.png"); imageLabel->setPixmap(image); splashWindow->setCentralWidget(imageLabel); splashWindow->setMinimumHeight(image.height()); splashWindow->setMaximumHeight(image.height()); splashWindow->setMinimumWidth(image.width()); splashWindow->setMaximumWidth(image.width()); QIcon icon(":images/app.icns"); mainWin.setWindowIcon(icon); #endif splashWindow->raise(); splashWindow->show(); MainWindow mainWin(app, splashWindow); return app.exec(); }