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 "ui_introwindow.h"
#include <QDesktopServices>

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* 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.
*/
//! \file
#ifndef SAMPLE_INTROWINDOW_H
#define SAMPLE_INTROWINDOW_H
@@ -10,11 +16,7 @@
#include <QDialog>
#include <QScopedPointer>
namespace Ui
{
class CIntroWindow;
}
namespace Ui { class CIntroWindow; }
class CIntroWindow : public QDialog
{
Q_OBJECT

View File

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

View File

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

View File

@@ -24,13 +24,16 @@ namespace BlackGui
namespace Components
{
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);
// fix style
this->tabBar()->setExpanding(false);
// connect
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan);
connect(this->ui->pb_Load, &QPushButton::pressed, this, &CFlightPlanComponent::loadFlightPlanFromNetwork);
connect(this->ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::resetFlightPlan);

View File

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

View File

@@ -22,7 +22,9 @@ namespace BlackGui
namespace Components
{
//! Info bar displaying status (Network, Simulator, DBus)
class CInfoBarStatusComponent : public QFrame, public CRuntimeBasedComponent
class CInfoBarStatusComponent :
public QFrame,
public CRuntimeBasedComponent
{
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
{
@@ -73,6 +73,6 @@ namespace BlackGui
//! Style sheet changed
void onStyleSheetsChanged();
};
}
}
} // namespace
} // namespace
#endif // guard

View File

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

View File

@@ -25,7 +25,8 @@ namespace BlackGui
namespace Components
{
CMainInfoAreaComponent::CMainInfoAreaComponent(QWidget *parent) :
CInfoArea(parent), ui(new Ui::CMainInfoAreaComponent)
CInfoArea(parent),
ui(new Ui::CMainInfoAreaComponent)
{
ui->setupUi(this);
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
* the component widely independent from a central data provideer
* \sa BlackCore::CRuntime

View File

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

View File

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

View File

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

View File

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

View File

@@ -176,20 +176,6 @@ namespace BlackGui
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)
{
QPoint globalPos = this->mapToGlobal(pos);

View File

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

View File

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

View File

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

View File

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