| 86 | qreal TOPPASBase::z_value_ = 42.0; |
| 87 | |
| 88 | TOPPASBase::TOPPASBase(QWidget* parent) : |
| 89 | QMainWindow(parent), |
| 90 | DefaultParamHandler("TOPPASBase"), |
| 91 | clipboard_scene_(nullptr) |
| 92 | { |
| 93 | |
| 94 | setWindowTitle("TOPPAS"); |
| 95 | setWindowIcon(QIcon(":/TOPPAS.png")); |
| 96 | |
| 97 | //prevents errors caused by too small width,height values |
| 98 | setMinimumSize(400, 400); |
| 99 | |
| 100 | // center main window |
| 101 | setGeometry( |
| 102 | (int)(0.1 * QApplication::desktop()->width()), |
| 103 | (int)(0.1 * QApplication::desktop()->height()), |
| 104 | (int)(0.8 * QApplication::desktop()->width()), |
| 105 | (int)(0.8 * QApplication::desktop()->height()) |
| 106 | ); |
| 107 | |
| 108 | // create dummy widget (to be able to have a layout), Tab bar and workspace |
| 109 | QWidget* dummy = new QWidget(this); |
| 110 | setCentralWidget(dummy); |
| 111 | QVBoxLayout* box_layout = new QVBoxLayout(dummy); |
| 112 | tab_bar_ = new EnhancedTabBar(dummy); |
| 113 | tab_bar_->setWhatsThis("Tab bar<BR><BR>Close tabs through the context menu or by double-clicking them."); |
| 114 | tab_bar_->addTab("dummy", 1336); |
| 115 | tab_bar_->setMinimumSize(tab_bar_->sizeHint()); |
| 116 | tab_bar_->removeId(1336); |
| 117 | //connect slots and signals for selecting spectra |
| 118 | connect(tab_bar_, &EnhancedTabBar::currentIdChanged, this, &TOPPASBase::focusByTab); |
| 119 | connect(tab_bar_, &EnhancedTabBar::closeRequested, this, &TOPPASBase::closeByTab); |
| 120 | |
| 121 | box_layout->addWidget(tab_bar_); |
| 122 | ws_ = new EnhancedWorkspace(dummy); |
| 123 | connect(ws_, &EnhancedWorkspace::subWindowActivated, this, &TOPPASBase::updateTabBar); |
| 124 | connect(ws_, &EnhancedWorkspace::subWindowActivated, this, &TOPPASBase::updateMenu); |
| 125 | |
| 126 | box_layout->addWidget(ws_); |
| 127 | |
| 128 | //################## MENUS ################# |
| 129 | // File menu |
| 130 | QMenu* file = new QMenu("&File", this); |
| 131 | menuBar()->addMenu(file); |
| 132 | file->addAction("&New", this, SLOT(newPipeline()), Qt::CTRL + Qt::Key_N); |
| 133 | file->addAction("&Open", this, SLOT(openFilesByDialog()), Qt::CTRL + Qt::Key_O); |
| 134 | file->addAction("Open &example file", this, SLOT(openExampleDialog()), Qt::CTRL + Qt::Key_E); |
| 135 | file->addAction("&Include", this, SLOT(includePipeline()), Qt::CTRL + Qt::Key_I); |
| 136 | //file->addAction("Online &Repository", this, SLOT(openOnlinePipelineRepository()), Qt::CTRL + Qt::Key_R); |
| 137 | file->addAction("&Save", this, SLOT(savePipeline()), Qt::CTRL + Qt::Key_S); |
| 138 | file->addAction("Save &As", this, SLOT(saveCurrentPipelineAs()), Qt::CTRL + Qt::SHIFT + Qt::Key_S); |
| 139 | file->addAction("E&xport as image", this, SLOT(exportAsImage())); |
| 140 | file->addAction("Refresh ¶meters", this, SLOT(refreshParameters()), Qt::CTRL + Qt::SHIFT + Qt::Key_P); |
| 141 | file->addAction("&Close pipeline", this, SLOT(closeFile()), Qt::CTRL + Qt::Key_W); |
| 142 | |
| 143 | file->addSeparator(); |
| 144 | // Recent files |
| 145 | file->addMenu(recent_files_menu_.getMenu()); // updates automatically via RecentFilesMenu class, since this is just a pointer |
nothing calls this directly
no test coverage detected