mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #312, Navigator (aka navigation bars)
* different dyn. property names for main window, dock window and infoarea * dyn.properties for nested QWidgets * style sheet for navigator * utility function to delete layout * added standard OS icons, some formatting in CICons * actions in main window to be used in navigator * main window becomes normal window when minimized so it is correctly displayed in Win taskbar Remark: Frameless floating dockwidgets with rounded borders not yet working
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "icons.h"
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -290,6 +291,18 @@ namespace BlackMisc
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::empty()
|
||||
{
|
||||
static const QPixmap pm;
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::empty16()
|
||||
{
|
||||
static const QPixmap pm(16, 16);
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::arrowMediumNorth16()
|
||||
{
|
||||
static const QPixmap pm(":/diagona/icons/diagona/icons/arrow-090-medium.png");
|
||||
@@ -338,6 +351,71 @@ namespace BlackMisc
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appWeather16()
|
||||
{
|
||||
return weatherCloudy16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appSettings16()
|
||||
{
|
||||
return wrench16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appUsers16()
|
||||
{
|
||||
return users16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appFlightPlan16()
|
||||
{
|
||||
return tableSheet16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appCockpit16()
|
||||
{
|
||||
return radio16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appSimulator16()
|
||||
{
|
||||
return joystick16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appTextMessages16()
|
||||
{
|
||||
return text16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appAtc16()
|
||||
{
|
||||
return radar16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appAircrafts16()
|
||||
{
|
||||
return paperPlane16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appMappings16()
|
||||
{
|
||||
return tableRelationship16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appLog16()
|
||||
{
|
||||
return monitorError16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appAudio16()
|
||||
{
|
||||
return speakerNetwork16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::appVoiceRooms16()
|
||||
{
|
||||
return tableRelationship16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::roleC1()
|
||||
{
|
||||
static const QPixmap pm(":/vatsim/icons/vatsim/C1.png");
|
||||
@@ -483,7 +561,7 @@ namespace BlackMisc
|
||||
|
||||
const QPixmap &CIcons::capabilityVoiceBackground()
|
||||
{
|
||||
static const QPixmap pm(changeBackground(":/diagona/icons/diagona/icons/headphone.png", Qt::green));
|
||||
static const QPixmap pm(changeResourceBackgroundColor(":/diagona/icons/diagona/icons/headphone.png", Qt::green));
|
||||
return pm;
|
||||
}
|
||||
|
||||
@@ -495,16 +573,41 @@ namespace BlackMisc
|
||||
|
||||
const QPixmap &CIcons::capabilityVoiceReceiveOnlyBackground()
|
||||
{
|
||||
static const QPixmap pm(changeBackground(":/diagona/icons/diagona/icons/headphone.png", Qt::yellow));
|
||||
static const QPixmap pm(changeResourceBackgroundColor(":/diagona/icons/diagona/icons/headphone.png", Qt::yellow));
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::capabilityTextOnly()
|
||||
{
|
||||
return appTextMessages16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::capabilityUnknown()
|
||||
{
|
||||
return unknown16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::attitudeIndicator16()
|
||||
{
|
||||
static const QPixmap pm(":/own/icons/own/attitude_indicator_climbing_16.png");
|
||||
return pm;
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::metar()
|
||||
{
|
||||
return weatherCloudy16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::atis()
|
||||
{
|
||||
return text16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::geoPosition16()
|
||||
{
|
||||
return globe16();
|
||||
}
|
||||
|
||||
const QPixmap &CIcons::pixmapByIndex(CIcons::IconIndex index)
|
||||
{
|
||||
switch (index)
|
||||
@@ -632,15 +735,28 @@ namespace BlackMisc
|
||||
return rotated;
|
||||
}
|
||||
|
||||
QPixmap CIcons::changeBackground(const QString resource, Qt::GlobalColor backgroundColor)
|
||||
QImage CIcons::changeImageBackgroundColor(const QImage &imgSource, Qt::GlobalColor backgroundColor)
|
||||
{
|
||||
QImage resSource(resource);
|
||||
QImage destBackground(resSource.size(), QImage::Format_RGB32);
|
||||
destBackground.fill(backgroundColor);
|
||||
QPainter p(&destBackground);
|
||||
QImage destBackgroundImg(imgSource.size(), QImage::Format_RGB32);
|
||||
destBackgroundImg.fill(backgroundColor);
|
||||
QPainter p(&destBackgroundImg);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceAtop);
|
||||
p.drawImage(0, 0, resSource);
|
||||
return QPixmap::fromImage(destBackground);
|
||||
p.drawImage(0, 0, imgSource);
|
||||
return destBackgroundImg;
|
||||
}
|
||||
|
||||
QPixmap CIcons::changeResourceBackgroundColor(const QString &resource, Qt::GlobalColor backgroundColor)
|
||||
{
|
||||
QImage imgSource(resource);
|
||||
QImage destBackgroundImg(changeImageBackgroundColor(imgSource, backgroundColor));
|
||||
return QPixmap::fromImage(destBackgroundImg);
|
||||
}
|
||||
|
||||
QIcon CIcons::changeIconBackgroundColor(const QIcon &icon, Qt::GlobalColor backgroundColor, const QSize &targetsize)
|
||||
{
|
||||
QImage imgSource(icon.pixmap(targetsize).toImage());
|
||||
QImage destBackgroundImg(changeImageBackgroundColor(imgSource, backgroundColor));
|
||||
return QIcon(QPixmap::fromImage(destBackgroundImg));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -281,18 +281,10 @@ namespace BlackMisc
|
||||
static const QPixmap &unknown16();
|
||||
|
||||
//! Empty icon
|
||||
static const QPixmap &empty()
|
||||
{
|
||||
static const QPixmap pm;
|
||||
return pm;
|
||||
}
|
||||
static const QPixmap &empty();
|
||||
|
||||
//! Empty icon
|
||||
static const QPixmap &empty16()
|
||||
{
|
||||
static const QPixmap pm(16, 16);
|
||||
return pm;
|
||||
}
|
||||
static const QPixmap &empty16();
|
||||
|
||||
//! Arrow
|
||||
static const QPixmap &arrowMediumNorth16();
|
||||
@@ -319,82 +311,43 @@ namespace BlackMisc
|
||||
static const QPixmap &swiftNova48();
|
||||
|
||||
//! Application weather
|
||||
static const QPixmap &appWeather16()
|
||||
{
|
||||
return weatherCloudy16();
|
||||
}
|
||||
static const QPixmap &appWeather16();
|
||||
|
||||
//! Application settings
|
||||
static const QPixmap &appSettings16()
|
||||
{
|
||||
return wrench16();
|
||||
}
|
||||
static const QPixmap &appSettings16();
|
||||
|
||||
//! Application users
|
||||
static const QPixmap &appUsers16()
|
||||
{
|
||||
return users16();
|
||||
}
|
||||
static const QPixmap &appUsers16();
|
||||
|
||||
//! Application flight plan
|
||||
static const QPixmap &appFlightPlan16()
|
||||
{
|
||||
return tableSheet16();
|
||||
}
|
||||
static const QPixmap &appFlightPlan16();
|
||||
|
||||
//! Application cockpit
|
||||
static const QPixmap &appCockpit16()
|
||||
{
|
||||
return radio16();
|
||||
}
|
||||
static const QPixmap &appCockpit16();
|
||||
|
||||
//! Application simulator
|
||||
static const QPixmap &appSimulator16()
|
||||
{
|
||||
return joystick16();
|
||||
}
|
||||
static const QPixmap &appSimulator16();
|
||||
|
||||
//! Application text messages
|
||||
static const QPixmap &appTextMessages16()
|
||||
{
|
||||
return text16();
|
||||
}
|
||||
static const QPixmap &appTextMessages16();
|
||||
|
||||
//! Application ATC
|
||||
static const QPixmap &appAtc16()
|
||||
{
|
||||
return radar16();
|
||||
}
|
||||
static const QPixmap &appAtc16();
|
||||
|
||||
//! Application aircrafts
|
||||
static const QPixmap &appAircrafts16()
|
||||
{
|
||||
return paperPlane16();
|
||||
}
|
||||
static const QPixmap &appAircrafts16();
|
||||
|
||||
//! Application mappings
|
||||
static const QPixmap &appMappings16()
|
||||
{
|
||||
return tableRelationship16();
|
||||
}
|
||||
static const QPixmap &appMappings16();
|
||||
|
||||
//! Application log/status messages
|
||||
static const QPixmap &appLog16()
|
||||
{
|
||||
return monitorError16();
|
||||
}
|
||||
static const QPixmap &appLog16();
|
||||
|
||||
//! Application audio
|
||||
static const QPixmap &appAudio16()
|
||||
{
|
||||
return speakerNetwork16();
|
||||
}
|
||||
static const QPixmap &appAudio16();
|
||||
|
||||
//! Voice rooms
|
||||
static const QPixmap &appVoiceRooms16()
|
||||
{
|
||||
return tableRelationship16();
|
||||
}
|
||||
static const QPixmap &appVoiceRooms16();
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Network and aviation
|
||||
@@ -482,37 +435,22 @@ namespace BlackMisc
|
||||
static const QPixmap &capabilityVoiceReceiveOnlyBackground();
|
||||
|
||||
//! Text only
|
||||
static const QPixmap &capabilityTextOnly()
|
||||
{
|
||||
return appTextMessages16();
|
||||
}
|
||||
static const QPixmap &capabilityTextOnly();
|
||||
|
||||
//! Text only
|
||||
static const QPixmap &capabilityUnknown()
|
||||
{
|
||||
return unknown16();
|
||||
}
|
||||
static const QPixmap &capabilityUnknown();
|
||||
|
||||
//! Attitude indicator
|
||||
static const QPixmap &attitudeIndicator16();
|
||||
|
||||
//! METAR
|
||||
static const QPixmap &metar()
|
||||
{
|
||||
return weatherCloudy16();
|
||||
}
|
||||
static const QPixmap &metar();
|
||||
|
||||
//! ATIS
|
||||
static const QPixmap &atis()
|
||||
{
|
||||
return text16();
|
||||
}
|
||||
static const QPixmap &atis();
|
||||
|
||||
//! Geo position
|
||||
static const QPixmap &geoPosition16()
|
||||
{
|
||||
return globe16();
|
||||
}
|
||||
static const QPixmap &geoPosition16();
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// By index
|
||||
@@ -524,8 +462,19 @@ namespace BlackMisc
|
||||
//! Pixmap by given index rotated
|
||||
static QPixmap pixmapByIndex(IconIndex index, int rotateDegrees);
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Utility functions
|
||||
// -------------------------------------------------------------
|
||||
|
||||
//! Change color of resource
|
||||
static QPixmap changeBackground(const QString resource, Qt::GlobalColor backgroundColor);
|
||||
static QPixmap changeResourceBackgroundColor(const QString &resource, Qt::GlobalColor backgroundColor);
|
||||
|
||||
//! Change color of icon
|
||||
static QIcon changeIconBackgroundColor(const QIcon &icon, Qt::GlobalColor backgroundColor, const QSize &targetsize);
|
||||
|
||||
//! Change image background color
|
||||
static QImage changeImageBackgroundColor(const QImage &imgSource, Qt::GlobalColor backgroundColor);
|
||||
|
||||
};
|
||||
}
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user