mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
Keep application in {} block to force deletion of the UI
This commit is contained in:
committed by
Mat Sutcliffe
parent
2cb10c1835
commit
b125d474c7
@@ -6,16 +6,20 @@
|
|||||||
* or distributed except according to the terms contained in the LICENSE file.
|
* or distributed except according to the terms contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "swiftguistd.h"
|
||||||
|
#include "swiftguistdapplication.h"
|
||||||
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
#include "blackmisc/audio/audioutils.h"
|
#include "blackmisc/audio/audioutils.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/crashhandler.h"
|
#include "blackmisc/crashhandler.h"
|
||||||
#include "blackmisc/appstarttime.h"
|
#include "blackmisc/appstarttime.h"
|
||||||
#include "swiftguistd.h"
|
|
||||||
#include "swiftguistdapplication.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
@@ -33,29 +37,28 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// initWindowsAudioDevices();
|
// initWindowsAudioDevices();
|
||||||
CCrashHandler::instance()->init();
|
CCrashHandler::instance()->init();
|
||||||
CSwiftGuiStdApplication a; // application with contexts
|
|
||||||
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
// at shutdown the whole application will be "deleted" outside the block
|
||||||
a.splashScreen(CIcons::swift256());
|
// that should already delete all widgets
|
||||||
a.setMinimumSizeInCharacters(60, 42); // experimental
|
int r = 0;
|
||||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
|
||||||
if (!a.hasSetupReader() || !a.start())
|
|
||||||
{
|
{
|
||||||
a.gracefulShutdown();
|
CSwiftGuiStdApplication a; // application with contexts
|
||||||
return EXIT_FAILURE;
|
a.setSignalStartupAutomatically(false); // application will signal startup on its own
|
||||||
|
a.splashScreen(CIcons::swift256());
|
||||||
|
a.setMinimumSizeInCharacters(60, 42); // experimental
|
||||||
|
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||||
|
if (!a.hasSetupReader() || !a.start())
|
||||||
|
{
|
||||||
|
a.gracefulShutdown();
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
//! [SwiftApplicationDemo]
|
||||||
|
|
||||||
|
// show window
|
||||||
|
CEnableForFramelessWindow::WindowMode windowMode = a.getWindowMode();
|
||||||
|
SwiftGuiStd w(windowMode);
|
||||||
|
r = a.exec();
|
||||||
}
|
}
|
||||||
//! [SwiftApplicationDemo]
|
|
||||||
|
|
||||||
// show window
|
|
||||||
CEnableForFramelessWindow::WindowMode windowMode = a.getWindowMode();
|
|
||||||
SwiftGuiStd w(windowMode);
|
|
||||||
w.show();
|
|
||||||
|
|
||||||
const int r = a.exec();
|
|
||||||
|
|
||||||
// log we are really closing
|
|
||||||
QTextStream ts(stdout);
|
|
||||||
ts << "swift is closing now ......\n";
|
|
||||||
ts.flush();
|
|
||||||
|
|
||||||
// bye
|
// bye
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user