Tweak launcher to be a MainWindow
For unknown reasons this seems to alleviate the word-wrap / min-height bug on Windows. Committing so we can test and verify this is really the case before the next release.
This commit is contained in:
parent
fb1a29200a
commit
70e79a849e
4 changed files with 731 additions and 720 deletions
1400
src/GUI/Launcher.ui
1400
src/GUI/Launcher.ui
File diff suppressed because it is too large
Load diff
|
@ -687,9 +687,8 @@ bool runLauncherDialog()
|
|||
bool runInAppLauncherDialog()
|
||||
{
|
||||
QtLauncher dlg;
|
||||
dlg.setInAppMode();
|
||||
dlg.exec();
|
||||
if (dlg.result() != QDialog::Accepted) {
|
||||
bool accepted = dlg.execInApp();
|
||||
if (!accepted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -699,10 +698,9 @@ bool runInAppLauncherDialog()
|
|||
} // of namespace flightgear
|
||||
|
||||
QtLauncher::QtLauncher() :
|
||||
QDialog(),
|
||||
QMainWindow(),
|
||||
m_ui(NULL),
|
||||
m_subsystemIdleTimer(NULL),
|
||||
m_inAppMode(false),
|
||||
m_doRestoreMPServer(false)
|
||||
{
|
||||
m_ui.reset(new Ui::Launcher);
|
||||
|
@ -890,7 +888,7 @@ void QtLauncher::setSceneryPaths() // static method
|
|||
|
||||
}
|
||||
|
||||
void QtLauncher::setInAppMode()
|
||||
bool QtLauncher::execInApp()
|
||||
{
|
||||
m_inAppMode = true;
|
||||
m_ui->tabWidget->removeTab(3);
|
||||
|
@ -901,6 +899,15 @@ void QtLauncher::setInAppMode()
|
|||
|
||||
disconnect(m_ui->runButton, SIGNAL(clicked()), this, SLOT(onRun()));
|
||||
connect(m_ui->runButton, SIGNAL(clicked()), this, SLOT(onApply()));
|
||||
m_runInApp = true;
|
||||
|
||||
show();
|
||||
|
||||
while (m_runInApp) {
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
return m_accepted;
|
||||
}
|
||||
|
||||
void QtLauncher::restoreSettings()
|
||||
|
@ -1045,11 +1052,6 @@ void QtLauncher::closeEvent(QCloseEvent *event)
|
|||
qApp->exit(-1);
|
||||
}
|
||||
|
||||
void QtLauncher::reject()
|
||||
{
|
||||
qApp->exit(-1);
|
||||
}
|
||||
|
||||
void QtLauncher::onRun()
|
||||
{
|
||||
flightgear::Options* opt = flightgear::Options::sharedInstance();
|
||||
|
@ -1193,8 +1195,6 @@ void QtLauncher::onRun()
|
|||
|
||||
void QtLauncher::onApply()
|
||||
{
|
||||
accept();
|
||||
|
||||
// aircraft
|
||||
if (!m_selectedAircraft.isEmpty()) {
|
||||
std::string aircraftPropValue,
|
||||
|
@ -1230,6 +1230,8 @@ void QtLauncher::onApply()
|
|||
m_ui->location->setLocationProperties();
|
||||
|
||||
saveSettings();
|
||||
m_accepted = true;
|
||||
m_runInApp = false;
|
||||
}
|
||||
|
||||
void QtLauncher::updateLocationHistory()
|
||||
|
@ -1251,7 +1253,11 @@ void QtLauncher::updateLocationHistory()
|
|||
|
||||
void QtLauncher::onQuit()
|
||||
{
|
||||
qApp->exit(-1);
|
||||
if (m_inAppMode) {
|
||||
m_runInApp = false;
|
||||
} else {
|
||||
qApp->exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onToggleTerrasync(bool enabled)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef FG_QTLAUNCHER_PRIVATE_HXX
|
||||
#define FG_QTLAUNCHER_PRIVATE_HXX
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QScopedPointer>
|
||||
#include <QStringList>
|
||||
#include <QModelIndex>
|
||||
|
@ -43,21 +43,22 @@ class QCheckBox;
|
|||
class CatalogListModel;
|
||||
class RemoteXMLRequest;
|
||||
|
||||
class QtLauncher : public QDialog
|
||||
class QtLauncher : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtLauncher();
|
||||
virtual ~QtLauncher();
|
||||
|
||||
void setInAppMode();
|
||||
bool execInApp();
|
||||
|
||||
static void setSceneryPaths();
|
||||
|
||||
static void restartTheApp(QStringList fgArgs);
|
||||
|
||||
bool wasRejected();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void reject();
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private slots:
|
||||
// run is used when the launcher is invoked before the main app is
|
||||
|
@ -152,7 +153,9 @@ private:
|
|||
QUrl m_selectedAircraft;
|
||||
QList<QUrl> m_recentAircraft;
|
||||
QTimer* m_subsystemIdleTimer;
|
||||
bool m_inAppMode;
|
||||
bool m_inAppMode = false;
|
||||
bool m_runInApp = false;
|
||||
bool m_accepted = false;
|
||||
|
||||
int m_ratingFilters[4];
|
||||
|
||||
|
|
|
@ -995,7 +995,7 @@ do_open_launcher(const SGPropertyNode *)
|
|||
// start a full reset
|
||||
fgResetIdleState();
|
||||
}
|
||||
return ok;
|
||||
return true; // don't report failure
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue