QGCWelcomeMainWindow.cc 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#include "QGCWelcomeMainWindow.h"
#include "ui_QGCWelcomeMainWindow.h"
#include "MainWindow.h"
#include "QGCViewModeSelection.h"

QGCWelcomeMainWindow::QGCWelcomeMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QGCWelcomeMainWindow),
    storeSettings(false)
{
    ui->setupUi(this);

    QString windowname = qApp->applicationName() + " " + qApp->applicationVersion();
    setWindowTitle(windowname);

    viewModeSelection = new QGCViewModeSelection(this);

    connect(viewModeSelection, SIGNAL(customViewModeSelected(MainWindow::CUSTOM_MODE)), this, SIGNAL(customViewModeSelected(MainWindow::CUSTOM_MODE)));
    connect(viewModeSelection, SIGNAL(settingsStorageRequested(bool)), this, SIGNAL(settingsStorageRequested(bool)));
    connect(viewModeSelection, SIGNAL(settingsStorageRequested(bool)), this, SLOT(setStoreSettings(bool)));

    setCentralWidget(viewModeSelection);

    // Load the new stylesheet.
    QFile styleSheet(":files/styles/style-dark.css");

    // Attempt to open the stylesheet.
    if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        // Signal to the user that the app will pause to apply a new stylesheet
        qApp->setOverrideCursor(Qt::WaitCursor);

        qApp->setStyleSheet(styleSheet.readAll());

        // Finally restore the cursor before returning.
        qApp->restoreOverrideCursor();
    }

    resize(780, 400);
    show();

}

QGCWelcomeMainWindow::~QGCWelcomeMainWindow()
{
    delete ui;
    delete viewModeSelection;
}