Changed Window pointer ui tp QScopedPointer #95

Removed some default constructors from Member initializer list
Made member m_coreRuntime QScopedPointer
This commit is contained in:
Klaus Basan
2014-01-15 19:33:28 +01:00
parent 4c711dad82
commit 9f103a35cc
7 changed files with 17 additions and 23 deletions

View File

@@ -16,10 +16,7 @@ CInfoWindow::CInfoWindow(QWidget *parent) :
/* /*
* Destructor * Destructor
*/ */
CInfoWindow::~CInfoWindow() CInfoWindow::~CInfoWindow() { }
{
delete ui;
}
/* /*
* Info message for some time * Info message for some time

View File

@@ -7,10 +7,11 @@
#define SAMPLE_INFOWINDOW_H #define SAMPLE_INFOWINDOW_H
#include <QWizardPage> #include <QWizardPage>
#include <QScopedPointer>
namespace Ui namespace Ui
{ {
class InfoWindow; class InfoWindow;
} }
class CInfoWindow : public QWizardPage class CInfoWindow : public QWizardPage
@@ -37,7 +38,7 @@ public:
void setInfoMessage(const QString &message, int displayTimeMs = 4000); void setInfoMessage(const QString &message, int displayTimeMs = 4000);
private: private:
Ui::InfoWindow *ui; QScopedPointer<Ui::InfoWindow> ui;
}; };
#endif // guard #endif // guard

View File

@@ -17,10 +17,7 @@ CIntroWindow::CIntroWindow(QWidget *parent) :
/* /*
* Destructor * Destructor
*/ */
CIntroWindow::~CIntroWindow() CIntroWindow::~CIntroWindow() { }
{
delete ui;
}
/* /*
* Window mode * Window mode
@@ -52,9 +49,12 @@ GuiModes::CoreMode CIntroWindow::getCoreMode() const
void CIntroWindow::buttonClicked() const void CIntroWindow::buttonClicked() const
{ {
QObject *sender = QObject::sender(); 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)); 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)); QDesktopServices::openUrl(QUrl("https://dev.vatsim-germany.org/", QUrl::TolerantMode));
} }
} }

View File

@@ -8,11 +8,11 @@
#include "guimodeenums.h" #include "guimodeenums.h"
#include <QDialog> #include <QDialog>
#include <QScopedPointer>
namespace Ui namespace Ui
{ {
class CIntroWindow; class CIntroWindow;
} }
class CIntroWindow : public QDialog class CIntroWindow : public QDialog
@@ -50,7 +50,7 @@ private slots:
void buttonClicked() const; void buttonClicked() const;
private: private:
Ui::CIntroWindow *ui; QScopedPointer<Ui::CIntroWindow> ui;
}; };
#endif // guard #endif // guard

View File

@@ -27,10 +27,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
m_dBusConnection("dummy"), m_coreRuntime(nullptr), m_dBusConnection("dummy"), m_coreRuntime(nullptr),
m_atcListOnline(nullptr), m_atcListBooked(nullptr), m_atcListOnline(nullptr), m_atcListBooked(nullptr),
m_trafficServerList(nullptr), m_aircraftsInRange(nullptr), m_trafficServerList(nullptr), m_aircraftsInRange(nullptr),
m_contextApplication(nullptr), m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextVoice(nullptr), m_contextSettings(nullptr),
m_contextNetwork(nullptr), m_contextVoice(nullptr),
m_contextSettings(nullptr),
m_ownAircraft(), m_voiceRoomCom1(), m_voiceRoomCom2(),
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr),
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr), m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
m_contextMenuAudio(nullptr) m_contextMenuAudio(nullptr)
@@ -51,7 +48,6 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
this->gracefulShutdown(); this->gracefulShutdown();
delete ui;
} }
/* /*

View File

@@ -97,7 +97,7 @@ protected:
}; };
private: private:
Ui::MainWindow *ui; QScopedPointer<Ui::MainWindow> ui;
CInfoWindow *m_infoWindow; CInfoWindow *m_infoWindow;
bool m_init; bool m_init;
GuiModes::WindowMode m_windowMode; GuiModes::WindowMode m_windowMode;
@@ -106,7 +106,7 @@ private:
bool m_contextNetworkAvailable; bool m_contextNetworkAvailable;
bool m_contextVoiceAvailable; bool m_contextVoiceAvailable;
QDBusConnection m_dBusConnection; QDBusConnection m_dBusConnection;
BlackCore::CCoreRuntime *m_coreRuntime; /*!< runtime, if working with local core */ QScopedPointer<BlackCore::CCoreRuntime> m_coreRuntime; /*!< runtime, if working with local core */
BlackGui::CAtcListModel *m_atcListOnline; BlackGui::CAtcListModel *m_atcListOnline;
BlackGui::CAtcListModel *m_atcListBooked; BlackGui::CAtcListModel *m_atcListBooked;
BlackGui::CServerListModel *m_trafficServerList; BlackGui::CServerListModel *m_trafficServerList;

View File

@@ -96,7 +96,7 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
} }
else 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_contextNetwork = this->m_coreRuntime->getIContextNetwork();
this->m_contextVoice = this->m_coreRuntime->getIContextVoice(); this->m_contextVoice = this->m_coreRuntime->getIContextVoice();
this->m_contextSettings = this->m_coreRuntime->getIContextSettings(); this->m_contextSettings = this->m_coreRuntime->getIContextSettings();