diff --git a/samples/blackgui/infowindow.cpp b/samples/blackgui/infowindow.cpp index 04b8788c7..755fa0d80 100644 --- a/samples/blackgui/infowindow.cpp +++ b/samples/blackgui/infowindow.cpp @@ -16,10 +16,7 @@ CInfoWindow::CInfoWindow(QWidget *parent) : /* * Destructor */ -CInfoWindow::~CInfoWindow() -{ - delete ui; -} +CInfoWindow::~CInfoWindow() { } /* * Info message for some time diff --git a/samples/blackgui/infowindow.h b/samples/blackgui/infowindow.h index 5305e2ee0..57ce69b3a 100644 --- a/samples/blackgui/infowindow.h +++ b/samples/blackgui/infowindow.h @@ -7,10 +7,11 @@ #define SAMPLE_INFOWINDOW_H #include +#include namespace Ui { -class InfoWindow; + class InfoWindow; } class CInfoWindow : public QWizardPage @@ -37,7 +38,7 @@ public: void setInfoMessage(const QString &message, int displayTimeMs = 4000); private: - Ui::InfoWindow *ui; + QScopedPointer ui; }; #endif // guard diff --git a/samples/blackgui/introwindow.cpp b/samples/blackgui/introwindow.cpp index 4a57f6955..d678f2287 100644 --- a/samples/blackgui/introwindow.cpp +++ b/samples/blackgui/introwindow.cpp @@ -17,10 +17,7 @@ CIntroWindow::CIntroWindow(QWidget *parent) : /* * Destructor */ -CIntroWindow::~CIntroWindow() -{ - delete ui; -} +CIntroWindow::~CIntroWindow() { } /* * Window mode @@ -52,9 +49,12 @@ GuiModes::CoreMode CIntroWindow::getCoreMode() const void CIntroWindow::buttonClicked() const { QObject *sender = QObject::sender(); - if (sender == this->ui->pb_ModelDb) { + 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) { + } + 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 index baf904bfc..031b5df31 100644 --- a/samples/blackgui/introwindow.h +++ b/samples/blackgui/introwindow.h @@ -8,11 +8,11 @@ #include "guimodeenums.h" #include - +#include namespace Ui { -class CIntroWindow; + class CIntroWindow; } class CIntroWindow : public QDialog @@ -50,7 +50,7 @@ private slots: void buttonClicked() const; private: - Ui::CIntroWindow *ui; + QScopedPointer ui; }; #endif // guard diff --git a/samples/blackgui/mainwindow.cpp b/samples/blackgui/mainwindow.cpp index 81aa8cfd3..e12049ce3 100644 --- a/samples/blackgui/mainwindow.cpp +++ b/samples/blackgui/mainwindow.cpp @@ -27,10 +27,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) : m_dBusConnection("dummy"), m_coreRuntime(nullptr), m_atcListOnline(nullptr), m_atcListBooked(nullptr), m_trafficServerList(nullptr), m_aircraftsInRange(nullptr), - m_contextApplication(nullptr), - m_contextNetwork(nullptr), m_contextVoice(nullptr), - m_contextSettings(nullptr), - m_ownAircraft(), m_voiceRoomCom1(), m_voiceRoomCom2(), + m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextVoice(nullptr), m_contextSettings(nullptr), m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr), m_contextMenuAudio(nullptr) @@ -51,7 +48,6 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) : MainWindow::~MainWindow() { this->gracefulShutdown(); - delete ui; } /* diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h index aa5563cb9..79270e04f 100644 --- a/samples/blackgui/mainwindow.h +++ b/samples/blackgui/mainwindow.h @@ -97,7 +97,7 @@ protected: }; private: - Ui::MainWindow *ui; + QScopedPointer ui; CInfoWindow *m_infoWindow; bool m_init; GuiModes::WindowMode m_windowMode; @@ -106,7 +106,7 @@ private: bool m_contextNetworkAvailable; bool m_contextVoiceAvailable; QDBusConnection m_dBusConnection; - BlackCore::CCoreRuntime *m_coreRuntime; /*!< runtime, if working with local core */ + QScopedPointer m_coreRuntime; /*!< runtime, if working with local core */ BlackGui::CAtcListModel *m_atcListOnline; BlackGui::CAtcListModel *m_atcListBooked; BlackGui::CServerListModel *m_trafficServerList; diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index 51ae104c3..119695f50 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -96,7 +96,7 @@ void MainWindow::init(GuiModes::CoreMode coreMode) } else { - this->m_coreRuntime = new CCoreRuntime(false, this); + this->m_coreRuntime.reset(new CCoreRuntime(false, this)); this->m_contextNetwork = this->m_coreRuntime->getIContextNetwork(); this->m_contextVoice = this->m_coreRuntime->getIContextVoice(); this->m_contextSettings = this->m_coreRuntime->getIContextSettings();