refs #335, formatting, member initialization, new icons, remove redundant methods

This commit is contained in:
Klaus Basan
2014-10-07 00:24:04 +02:00
committed by Roland Winklmeier
parent c965fbb785
commit b0f01a3ec6
20 changed files with 83 additions and 57 deletions

View File

@@ -1,3 +1,12 @@
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "introwindow.h" #include "introwindow.h"
#include "ui_introwindow.h" #include "ui_introwindow.h"
#include <QDesktopServices> #include <QDesktopServices>

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / authors /* Copyright (C) 2013
* This Source Code Form is subject to the terms of the Mozilla Public * swift project Community / Contributors
* License, v. 2.0. If a copy of the MPL was not distributed with this *
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef SAMPLE_INTROWINDOW_H #ifndef SAMPLE_INTROWINDOW_H
#define SAMPLE_INTROWINDOW_H #define SAMPLE_INTROWINDOW_H
@@ -10,11 +16,7 @@
#include <QDialog> #include <QDialog>
#include <QScopedPointer> #include <QScopedPointer>
namespace Ui namespace Ui { class CIntroWindow; }
{
class CIntroWindow;
}
class CIntroWindow : public QDialog class CIntroWindow : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@@ -26,8 +26,10 @@ namespace BlackGui
namespace Components namespace Components
{ {
//! User componenet (users, clients) //! Cockpit component
class CCockpitV1Component : public QWidget, public CRuntimeBasedComponent class CCockpitV1Component :
public QWidget,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -21,8 +21,8 @@ namespace BlackGui
namespace Components namespace Components
{ {
//! Component is residing in an dockable widget. This helper class provides access to //! Helper class: Component is residing in an dockable widget.
//! to its info area and dockable widget. //! This class provides access to its info area and dockable widget.
class CDockWidgetInfoAreaComponent class CDockWidgetInfoAreaComponent
{ {
public: public:
@@ -53,6 +53,7 @@ namespace BlackGui
private: private:
BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
}; };
} }
} // namespace } // namespace

View File

@@ -24,13 +24,16 @@ namespace BlackGui
namespace Components namespace Components
{ {
CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) : CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) :
QTabWidget(parent), CRuntimeBasedComponent(nullptr, false), ui(new Ui::CFlightPlanComponent) QTabWidget(parent),
CRuntimeBasedComponent(nullptr, false),
ui(new Ui::CFlightPlanComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
// fix style // fix style
this->tabBar()->setExpanding(false); this->tabBar()->setExpanding(false);
// connect
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan); connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan);
connect(this->ui->pb_Load, &QPushButton::pressed, this, &CFlightPlanComponent::loadFlightPlanFromNetwork); connect(this->ui->pb_Load, &QPushButton::pressed, this, &CFlightPlanComponent::loadFlightPlanFromNetwork);
connect(this->ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::resetFlightPlan); connect(this->ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::resetFlightPlan);

View File

@@ -25,7 +25,9 @@ namespace BlackGui
{ {
//! Flight plan widget //! Flight plan widget
class CFlightPlanComponent : public QTabWidget, public CRuntimeBasedComponent class CFlightPlanComponent :
public QTabWidget,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -22,7 +22,9 @@ namespace BlackGui
namespace Components namespace Components
{ {
//! Info bar displaying status (Network, Simulator, DBus) //! Info bar displaying status (Network, Simulator, DBus)
class CInfoBarStatusComponent : public QFrame, public CRuntimeBasedComponent class CInfoBarStatusComponent :
public QFrame,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -27,7 +27,7 @@ namespace BlackGui
{ {
/*! /*!
* Multi purpose info window (pop up window) * Multi purpose info window (like pop up window)
*/ */
class CInfoWindowComponent : public QWizardPage class CInfoWindowComponent : public QWizardPage
{ {
@@ -73,6 +73,6 @@ namespace BlackGui
//! Style sheet changed //! Style sheet changed
void onStyleSheetsChanged(); void onStyleSheetsChanged();
}; };
} } // namespace
} } // namespace
#endif // guard #endif // guard

View File

@@ -24,7 +24,9 @@ namespace BlackGui
{ {
//! GUI displaying log and status messages //! GUI displaying log and status messages
class CLogComponent : public QFrame, public CRuntimeBasedComponent class CLogComponent :
public QFrame,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -25,7 +25,8 @@ namespace BlackGui
namespace Components namespace Components
{ {
CMainInfoAreaComponent::CMainInfoAreaComponent(QWidget *parent) : CMainInfoAreaComponent::CMainInfoAreaComponent(QWidget *parent) :
CInfoArea(parent), ui(new Ui::CMainInfoAreaComponent) CInfoArea(parent),
ui(new Ui::CMainInfoAreaComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
initInfoArea(); initInfoArea();

View File

@@ -34,7 +34,7 @@ namespace BlackGui
{ {
/*! /*!
* \brief Component, which provides reference to runtime object * \brief Component, which provides references to runtime objects
* \details Access to runtime allows to encapsualate many aspects of data access and makes * \details Access to runtime allows to encapsualate many aspects of data access and makes
* the component widely independent from a central data provideer * the component widely independent from a central data provideer
* \sa BlackCore::CRuntime * \sa BlackCore::CRuntime

View File

@@ -27,7 +27,9 @@ namespace BlackGui
{ {
//! Settings component //! Settings component
class CSettingsComponent : public QTabWidget, public CRuntimeBasedComponent class CSettingsComponent :
public QTabWidget,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -13,7 +13,6 @@
#define BLACKGUI_TEXTMESSAGECOMPONENT_H #define BLACKGUI_TEXTMESSAGECOMPONENT_H
#include "blackgui/components/runtimebasedcomponent.h" #include "blackgui/components/runtimebasedcomponent.h"
#include "blackgui/components/timerbasedcomponent.h"
#include "blackmisc/nwtextmessage.h" #include "blackmisc/nwtextmessage.h"
#include "blackmisc/avaircraft.h" #include "blackmisc/avaircraft.h"
#include "blackmisc/nwtextmessagelist.h" #include "blackmisc/nwtextmessagelist.h"
@@ -29,7 +28,9 @@ namespace BlackGui
namespace Components namespace Components
{ {
//! Text message widget //! Text message widget
class CTextMessageComponent : public QTabWidget, public CRuntimeBasedComponent class CTextMessageComponent :
public QTabWidget,
public CRuntimeBasedComponent
{ {
Q_OBJECT Q_OBJECT

View File

@@ -14,7 +14,7 @@ namespace BlackGui
namespace Components namespace Components
{ {
CTimerBasedComponent::CTimerBasedComponent(const char *slot, QObject *parent) : CTimerBasedComponent::CTimerBasedComponent(const char *slot, QObject *parent) :
QObject(parent), m_timer(nullptr) QObject(parent)
{ {
Q_ASSERT(parent); Q_ASSERT(parent);
this->m_timer = new QTimer(this); this->m_timer = new QTimer(this);

View File

@@ -19,7 +19,7 @@ namespace BlackGui
{ {
namespace Components namespace Components
{ {
//! Timer based componenet //! Helper class: Timer based componenet
class CTimerBasedComponent: public QObject class CTimerBasedComponent: public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -52,8 +52,8 @@ namespace BlackGui
void fireTimer(); void fireTimer();
private: private:
QTimer *m_timer; QTimer *m_timer = nullptr;
QTimer *m_timerSingleShot; QTimer *m_timerSingleShot = nullptr;
}; };
} }
} }

View File

@@ -176,20 +176,6 @@ namespace BlackGui
this->setTitleBarWidget(this->m_emptyTitleBar); this->setTitleBarWidget(this->m_emptyTitleBar);
} }
QList<QWidget *> CDockWidget::findEmbeddedRuntimeComponents() const
{
QList<QWidget *> widgets = this->findChildren<QWidget *>();
QList<QWidget *> widgetsWithRuntimeComponent;
foreach(QWidget * w, widgets)
{
if (dynamic_cast<Components::CRuntimeBasedComponent *>(w))
{
widgetsWithRuntimeComponent.append(w);
}
}
return widgetsWithRuntimeComponent;
}
void CDockWidget::ps_showContextMenu(const QPoint &pos) void CDockWidget::ps_showContextMenu(const QPoint &pos)
{ {
QPoint globalPos = this->mapToGlobal(pos); QPoint globalPos = this->mapToGlobal(pos);

View File

@@ -98,13 +98,13 @@ namespace BlackGui
//! Override close event //! Override close event
virtual void closeEvent(QCloseEvent *event) override; virtual void closeEvent(QCloseEvent *event) override;
//! Paint event //! \copydoc QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event) override; virtual void paintEvent(QPaintEvent *event) override;
//! Hide event //! \copydoc QWidget::hideEvent
void hideEvent(QHideEvent *event) override; void hideEvent(QHideEvent *event) override;
//! Show event //! \copydoc QWidget::showEvent
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
//! Contribute to menu //! Contribute to menu
@@ -138,13 +138,8 @@ namespace BlackGui
bool m_wasAlreadyFloating = false; bool m_wasAlreadyFloating = false;
bool m_selected = false; //!< selected when tabbed bool m_selected = false; //!< selected when tabbed
//! Empty widget with no size //! Empty widget with no size
void initTitleBarWidgets(); void initTitleBarWidgets();
//! Find all embedded runtime components
QList<QWidget *> findEmbeddedRuntimeComponents() const;
}; };
} // namespace } // namespace

View File

@@ -60,7 +60,7 @@ namespace BlackGui
void floatAllWidgets(); void floatAllWidgets();
//! Toggle dock / floating of the whole info area //! Toggle dock / floating of the whole info area
void toggleFloating(); virtual void toggleFloating();
//! Toggle floating of index //! Toggle floating of index
void toggleFloating(int areaIndex); void toggleFloating(int areaIndex);
@@ -75,6 +75,9 @@ namespace BlackGui
//! Override close event //! Override close event
virtual void closeEvent(QCloseEvent *event) override; virtual void closeEvent(QCloseEvent *event) override;
//! \copydoc QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event) override;
//! Preferred size when floating //! Preferred size when floating
virtual QSize getPreferredSizeWhenFloating(int areaIndex) const = 0; virtual QSize getPreferredSizeWhenFloating(int areaIndex) const = 0;
@@ -88,7 +91,7 @@ namespace BlackGui
Ui::CInfoArea *ui = nullptr; Ui::CInfoArea *ui = nullptr;
QList<CDockWidgetInfoArea *> m_dockableWidgets ; QList<CDockWidgetInfoArea *> m_dockableWidgets ;
QTabBar *m_tabBar = nullptr; QTabBar *m_tabBar = nullptr;
bool m_showTabTexts = true; bool m_showTabTexts = true; //!< texts for tabs
bool m_infoAreaFloating = false; //!< whole info area floating bool m_infoAreaFloating = false; //!< whole info area floating
bool m_showTabBar = true; //!< auto ajdust the floating widgets bool m_showTabBar = true; //!< auto ajdust the floating widgets
bool m_lockTabBar = false; //!< locked means no double clicks possible bool m_lockTabBar = false; //!< locked means no double clicks possible
@@ -129,6 +132,12 @@ namespace BlackGui
//! Margins for the dockable widgets //! Margins for the dockable widgets
void setMarginsWhenDocked(int left, int top, int right, int bottom); void setMarginsWhenDocked(int left, int top, int right, int bottom);
//! Nested info areas
QList<CInfoArea *> getChildInfoAreas() { return this->findChildren<CInfoArea *>(); }
//! Direct dock widget areas, not the nested dock widget areas
QList<CDockWidgetInfoArea *> getOwnDockWidgetAreas();
private slots: private slots:
//! Tab bar has been double clicked //! Tab bar has been double clicked
void ps_tabBarDoubleClicked(int tabBarIndex); void ps_tabBarDoubleClicked(int tabBarIndex);
@@ -163,7 +172,8 @@ namespace BlackGui
//! Dock / floating of the whole info area //! Dock / floating of the whole info area
void ps_setInfoAreaFloating(bool floating); void ps_setInfoAreaFloating(bool floating);
}; };
} } // namespace
#endif // guard #endif // guard

View File

@@ -100,6 +100,7 @@ namespace BlackMisc
CIcon(CIcons::StandardIconPaperPlane16, "plane"), CIcon(CIcons::StandardIconPaperPlane16, "plane"),
CIcon(CIcons::StandardIconPlugin16, "plugin"), CIcon(CIcons::StandardIconPlugin16, "plugin"),
CIcon(CIcons::StandardIconRadar16, "radar"), CIcon(CIcons::StandardIconRadar16, "radar"),
CIcon(CIcons::StandardIconRadio16, "radio"),
CIcon(CIcons::StandardIconRefresh16, "refresh"), CIcon(CIcons::StandardIconRefresh16, "refresh"),
CIcon(CIcons::StandardIconResize16, "resize"), CIcon(CIcons::StandardIconResize16, "resize"),
CIcon(CIcons::StandardIconResizeHorizontal16, "resize (horizontal)"), CIcon(CIcons::StandardIconResizeHorizontal16, "resize (horizontal)"),

View File

@@ -93,6 +93,7 @@ namespace BlackMisc
StandardIconPaperPlane16, StandardIconPaperPlane16,
StandardIconPlugin16, StandardIconPlugin16,
StandardIconRadar16, StandardIconRadar16,
StandardIconRadio16,
StandardIconRefresh16, StandardIconRefresh16,
StandardIconResize16, StandardIconResize16,
StandardIconResizeHorizontal16, StandardIconResizeHorizontal16,
@@ -543,6 +544,12 @@ namespace BlackMisc
return tableSheet16(); return tableSheet16();
} }
//! Application cockpit
static const QPixmap &appCockpit16()
{
return radio16();
}
//! Application simulator //! Application simulator
static const QPixmap &appSimulator16() static const QPixmap &appSimulator16()
{ {