| 144 | } |
| 145 | |
| 146 | MainWindow::MainWindow(QWidget *parent) |
| 147 | : QMainWindow(parent) |
| 148 | , ui(new Ui::MainWindow) |
| 149 | , m_stateManager(this) |
| 150 | , m_feedbackProvider(nullptr) |
| 151 | { |
| 152 | const auto styleOverride = gammarayStyleOverride(); |
| 153 | if (styleOverride) { |
| 154 | applyStyle(styleOverride); |
| 155 | } |
| 156 | |
| 157 | if (!Endpoint::instance()->isRemoteClient()) { |
| 158 | // we don't want application styles to propagate to the GammaRay window, |
| 159 | // so set the platform default one if needed |
| 160 | |
| 161 | // check if the style is not already overwritten |
| 162 | if (!styleOverride) { |
| 163 | if (auto defaultStyle = gammarayDefaultStyle()) { |
| 164 | applyStyle(defaultStyle); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | UIResources::setTheme(UiIntegration::hasDarkUI() ? UIResources::Light : UIResources::Dark); |
| 170 | |
| 171 | ui->setupUi(this); |
| 172 | |
| 173 | connect(ui->actionRetractProbe, &QAction::triggered, this, &MainWindow::detachProbe); |
| 174 | |
| 175 | connect(QApplication::instance(), &QCoreApplication::aboutToQuit, this, [this] { |
| 176 | m_detaching = true; |
| 177 | close(); |
| 178 | }); |
| 179 | connect(ui->actionQuit, &QAction::triggered, this, &MainWindow::quitHost); |
| 180 | ui->actionQuit->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); |
| 181 | |
| 182 | ui->actionHelp->setShortcut(QKeySequence::HelpContents); |
| 183 | ui->actionHelp->setEnabled(HelpController::isAvailable()); |
| 184 | |
| 185 | connect(ui->actionHelp, &QAction::triggered, this, &MainWindow::help); |
| 186 | connect(ui->actionPlugins, &QAction::triggered, |
| 187 | this, &MainWindow::aboutPlugins); |
| 188 | connect(ui->actionMessageStatistics, &QAction::triggered, this, &MainWindow::showMessageStatistics); |
| 189 | connect(ui->actionAboutQt, &QAction::triggered, |
| 190 | qobject_cast<QApplication *>(QApplication::instance()), &QApplication::aboutQt); |
| 191 | connect(ui->actionAboutGammaRay, &QAction::triggered, this, &MainWindow::about); |
| 192 | connect(ui->actionAboutKDAB, &QAction::triggered, this, &MainWindow::aboutKDAB); |
| 193 | |
| 194 | setWindowIcon(QIcon(QStringLiteral(":/gammaray/GammaRay-128x128.png"))); |
| 195 | |
| 196 | // ClientConnectionManager take care of creating and requesting server tools |
| 197 | // but in-process ui need to do it itself. |
| 198 | ClientToolManager *toolManager = ClientToolManager::instance(); |
| 199 | if (!toolManager) { |
| 200 | toolManager = new ClientToolManager(this); |
| 201 | toolManager->requestAvailableTools(); |
| 202 | } |
| 203 |
nothing calls this directly
no test coverage detected