From ccfdee64e083e02f1051fa12d11994d1f2372d06 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 13 Jan 2014 01:20:06 +0100 Subject: [PATCH] Initial startup screen, here user can decide to use DBus or local context, frameless window. In the future likely more options, e.g. for bootstrapping (setting the DBus server IP) --- samples/blackgui/guimodeenums.h | 30 ++++ samples/blackgui/introwindow.cpp | 60 +++++++ samples/blackgui/introwindow.h | 56 ++++++ samples/blackgui/introwindow.ui | 289 +++++++++++++++++++++++++++++++ 4 files changed, 435 insertions(+) create mode 100644 samples/blackgui/guimodeenums.h create mode 100644 samples/blackgui/introwindow.cpp create mode 100644 samples/blackgui/introwindow.h create mode 100644 samples/blackgui/introwindow.ui diff --git a/samples/blackgui/guimodeenums.h b/samples/blackgui/guimodeenums.h new file mode 100644 index 000000000..0ac568c6a --- /dev/null +++ b/samples/blackgui/guimodeenums.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2013 VATSIM Community / authors + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef SAMPLE_GUIMODEENUMS_H +#define SAMPLE_GUIMODEENUMS_H + +struct GuiModes { + +public: + /*! + * \brief Window mode + */ + enum WindowMode { + WindowFrameless, + WindowNormal + }; + + /*! + * \brief Core runs how and where? + */ + enum CoreMode { + CoreInGuiProcess, + CoreExternal, + CoreExternalVoiceLocal + }; +}; + +#endif // guard diff --git a/samples/blackgui/introwindow.cpp b/samples/blackgui/introwindow.cpp new file mode 100644 index 000000000..4a57f6955 --- /dev/null +++ b/samples/blackgui/introwindow.cpp @@ -0,0 +1,60 @@ +#include "introwindow.h" +#include "ui_introwindow.h" +#include +#include + +/* + * Constructor + */ +CIntroWindow::CIntroWindow(QWidget *parent) : + QDialog(parent, Qt::Tool), + ui(new Ui::CIntroWindow) +{ + ui->setupUi(this); + this->layout()->setSizeConstraint(QLayout::SetFixedSize); +} + +/* + * Destructor + */ +CIntroWindow::~CIntroWindow() +{ + delete ui; +} + +/* + * Window mode + */ +GuiModes::WindowMode CIntroWindow::getWindowMode() const +{ + if (this->ui->rb_WindowNormal->isChecked()) return GuiModes::WindowNormal; + if (this->ui->rb_WindowFrameless->isChecked()) return GuiModes::WindowFrameless; + qFatal("Illegal GUI status (window mode"); + return GuiModes::WindowNormal; // just for compiler warning +} + +/* + * Core mode + */ +GuiModes::CoreMode CIntroWindow::getCoreMode() const +{ + if (this->ui->rb_CoreExternal->isChecked())return GuiModes::CoreExternal; + if (this->ui->rb_CoreExternalVoiceLocal->isChecked()) return GuiModes::CoreExternalVoiceLocal; + if (this->ui->rb_CoreInGuiProcess->isChecked()) return GuiModes::CoreInGuiProcess; + qFatal("Illegal GUI status (core mode"); + return GuiModes::CoreExternal; // just for compiler warning +} + + +/* + * Button clicked + */ +void CIntroWindow::buttonClicked() const +{ + QObject *sender = QObject::sender(); + if (sender == this->ui->pb_ModelDb) { + QDesktopServices::openUrl(QUrl("http://vatrep.vatsim-germany.org/page/index.php", QUrl::TolerantMode)); + } else if (sender == this->ui->pb_WebSite) { + QDesktopServices::openUrl(QUrl("https://dev.vatsim-germany.org/", QUrl::TolerantMode)); + } +} diff --git a/samples/blackgui/introwindow.h b/samples/blackgui/introwindow.h new file mode 100644 index 000000000..baf904bfc --- /dev/null +++ b/samples/blackgui/introwindow.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2013 VATSIM Community / authors + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef SAMPLE_INTROWINDOW_H +#define SAMPLE_INTROWINDOW_H + +#include "guimodeenums.h" +#include + + +namespace Ui +{ +class CIntroWindow; +} + +class CIntroWindow : public QDialog +{ + Q_OBJECT + +public: + /*! + * \brief Constructor + * \param parent + */ + explicit CIntroWindow(QWidget *parent = nullptr); + + /*! + * Destructor + */ + ~CIntroWindow(); + + /*! + * \brief Selected window mode + * \return + */ + GuiModes::WindowMode getWindowMode() const; + + /*! + * \brief Get core mode + * \return + */ + GuiModes::CoreMode getCoreMode() const; + +private slots: + /*! + * \brief Button has been clicked + */ + void buttonClicked() const; + +private: + Ui::CIntroWindow *ui; +}; + +#endif // guard diff --git a/samples/blackgui/introwindow.ui b/samples/blackgui/introwindow.ui new file mode 100644 index 000000000..557f2bfcb --- /dev/null +++ b/samples/blackgui/introwindow.ui @@ -0,0 +1,289 @@ + + + CIntroWindow + + + + 0 + 0 + 239 + 260 + + + + BlackGUI intro screen + + + + :/blackgui/icons/aircraftdeparture.png:/blackgui/icons/aircraftdeparture.png + + + QWidget { + font-family: arial-rounded; + font: bold 10px; + color: yellow; /** font **/ + background-color: black; +} + +QPushButton { + background-color: rgba(255, 255, 0, 175); + color: black; + border-style: solid; + border-width:1px; + border-radius: 5px; + border-color: green; + margin: 3px; + padding: 3px; +} + +QRadioButton { + background-color: transparent; +} + +QGroupBox { + border: 2px solid yellow; + border-radius: 5px; + margin-top: 2ex; /* leave space at the top for the title */ +} + + + QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; /* position at the top center */ + padding: 0 0px; + margin: 0px; + background-color: black; + } + +#lbl_Icon { + max-height: 128; + max-width: 128; + +} + + + false + + + true + + + + + + 9 + + + 9 + + + 0 + + + 9 + + + 9 + + + + + Window + + + + + + Normal + + + true + + + + + + + Frameless + + + + + + + + + + Core + + + + + + Included in GUI +process + + + + + + + External (DBus) + + + true + + + + + + + External, +voice included + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 3 + + + 2 + + + 2 + + + 0 + + + 2 + + + + + Model DB + + + + + + + Web site + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + bb_OkCancel + accepted() + CIntroWindow + accept() + + + 257 + 230 + + + 157 + 274 + + + + + bb_OkCancel + rejected() + CIntroWindow + reject() + + + 310 + 230 + + + 286 + 274 + + + + + pb_ModelDb + clicked() + CIntroWindow + buttonClicked() + + + 217 + 34 + + + 319 + 37 + + + + + pb_WebSite + clicked() + CIntroWindow + buttonClicked() + + + 262 + 58 + + + 322 + 73 + + + + + + buttonClicked() + +