mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 17:30:12 +08:00
New main for GUI, using the new intro window.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
|
#include "introwindow.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "guimodeenums.h"
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
#include <QtGlobal>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@@ -13,6 +16,7 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// register
|
// register
|
||||||
|
Q_INIT_RESOURCE(blackgui);
|
||||||
BlackMisc::initResources();
|
BlackMisc::initResources();
|
||||||
BlackMisc::registerMetadata();
|
BlackMisc::registerMetadata();
|
||||||
// BlackMisc::displayAllUserMetatypesTypes();
|
// BlackMisc::displayAllUserMetatypesTypes();
|
||||||
@@ -26,29 +30,27 @@ int main(int argc, char *argv[])
|
|||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
// window
|
// modes
|
||||||
MainWindow w;
|
GuiModes::WindowMode windowMode;
|
||||||
bool withDBus = false;
|
GuiModes::CoreMode coreMode;
|
||||||
|
|
||||||
// Dialog to decide external or internal core
|
// Dialog to decide external or internal core
|
||||||
QMessageBox msgBox;
|
CIntroWindow intro;
|
||||||
msgBox.setText("How to start the GUI");
|
if (intro.exec() == QDialog::Rejected)
|
||||||
msgBox.setIcon(QMessageBox::Question);
|
{
|
||||||
QPushButton *buttonNoDbus = msgBox.addButton("With core included", QMessageBox::AcceptRole);
|
return 0;
|
||||||
QPushButton *buttonDBus = msgBox.addButton("External core via DBus", QMessageBox::AcceptRole);
|
}
|
||||||
QPushButton *buttonClose = msgBox.addButton("Close", QMessageBox::RejectRole);
|
else
|
||||||
msgBox.setDefaultButton(buttonNoDbus);
|
{
|
||||||
msgBox.exec();
|
coreMode = intro.getCoreMode();
|
||||||
if (msgBox.clickedButton() == buttonDBus)
|
windowMode = intro.getWindowMode();
|
||||||
withDBus = true;
|
}
|
||||||
else if (msgBox.clickedButton() == buttonNoDbus)
|
intro.close();
|
||||||
withDBus = false;
|
|
||||||
else if (msgBox.clickedButton() == buttonClose)
|
|
||||||
exit(4);
|
|
||||||
msgBox.close();
|
|
||||||
|
|
||||||
// show window
|
// show window
|
||||||
|
MainWindow w(windowMode);
|
||||||
w.show();
|
w.show();
|
||||||
w.init(withDBus); // object is complete by now
|
w.init(coreMode); // object is complete by now
|
||||||
return a.exec();
|
int r = a.exec();
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user