mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
Formatting, this->m_XX to m_XX
This commit is contained in:
committed by
Mathew Sutcliffe
parent
7cdfe8c914
commit
450028d2d2
@@ -38,33 +38,33 @@ namespace BlackGui
|
||||
{
|
||||
Q_ASSERT(correspondingWidget);
|
||||
Q_ASSERT(!m_framelessPropertyName.isEmpty());
|
||||
this->m_originalWindowMode = mode;
|
||||
m_originalWindowMode = mode;
|
||||
this->setWindowAttributes(mode);
|
||||
this->windowFlagsChanged();
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::setMode(CEnableForFramelessWindow::WindowMode mode)
|
||||
{
|
||||
if (mode == this->m_windowMode) { return; }
|
||||
this->m_windowMode = mode;
|
||||
if (mode == m_windowMode) { return; }
|
||||
m_windowMode = mode;
|
||||
|
||||
// set the main window or dock widget flags and attributes
|
||||
this->m_widget->setWindowFlags(modeToWindowFlags(mode));
|
||||
m_widget->setWindowFlags(modeToWindowFlags(mode));
|
||||
this->windowFlagsChanged();
|
||||
this->setWindowAttributes(mode);
|
||||
this->m_widget->show();
|
||||
m_widget->show();
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::setFrameless(bool frameless)
|
||||
{
|
||||
WindowMode nonFrameLessMode = this->m_originalWindowMode;
|
||||
WindowMode nonFrameLessMode = m_originalWindowMode;
|
||||
if (nonFrameLessMode == WindowFrameless) { nonFrameLessMode = WindowNormal; }
|
||||
setMode(frameless ? WindowFrameless : nonFrameLessMode);
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::alwaysOnTop(bool onTop)
|
||||
{
|
||||
Qt::WindowFlags flags = this->m_widget->windowFlags();
|
||||
Qt::WindowFlags flags = m_widget->windowFlags();
|
||||
if (onTop)
|
||||
{
|
||||
flags |= Qt::WindowStaysOnTopHint;
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
{
|
||||
flags &= ~Qt::WindowStaysOnTopHint;
|
||||
}
|
||||
this->m_widget->setWindowFlags(flags);
|
||||
m_widget->setWindowFlags(flags);
|
||||
this->windowFlagsChanged();
|
||||
}
|
||||
|
||||
@@ -106,17 +106,17 @@ namespace BlackGui
|
||||
|
||||
void CEnableForFramelessWindow::setWindowAttributes(CEnableForFramelessWindow::WindowMode mode)
|
||||
{
|
||||
Q_ASSERT_X(this->m_widget, "CEnableForFramelessWindow::setWindowAttributes", "Missing widget representing window");
|
||||
Q_ASSERT_X(!this->m_framelessPropertyName.isEmpty(), "CEnableForFramelessWindow::setWindowAttributes", "Missing property name");
|
||||
Q_ASSERT_X(m_widget, "CEnableForFramelessWindow::setWindowAttributes", "Missing widget representing window");
|
||||
Q_ASSERT_X(!m_framelessPropertyName.isEmpty(), "CEnableForFramelessWindow::setWindowAttributes", "Missing property name");
|
||||
|
||||
bool frameless = (mode == WindowFrameless);
|
||||
// http://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5
|
||||
this->m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
|
||||
m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
|
||||
|
||||
// https://bugreports.qt.io/browse/QTBUG-52206
|
||||
if (CGuiUtility::isTopLevelWidget(this->m_widget))
|
||||
if (CGuiUtility::isTopLevelWidget(m_widget))
|
||||
{
|
||||
this->m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless);
|
||||
m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless);
|
||||
}
|
||||
|
||||
// Qt::WA_PaintOnScreen leads to a warning
|
||||
@@ -127,17 +127,17 @@ namespace BlackGui
|
||||
|
||||
void CEnableForFramelessWindow::setDynamicProperties(bool frameless)
|
||||
{
|
||||
Q_ASSERT_X(this->m_widget, "CEnableForFramelessWindow::setDynamicProperties", "Missing widget representing window");
|
||||
Q_ASSERT_X(!this->m_framelessPropertyName.isEmpty(), "CEnableForFramelessWindow::setDynamicProperties", "Missing property name");
|
||||
Q_ASSERT_X(m_widget, "CEnableForFramelessWindow::setDynamicProperties", "Missing widget representing window");
|
||||
Q_ASSERT_X(!m_framelessPropertyName.isEmpty(), "CEnableForFramelessWindow::setDynamicProperties", "Missing property name");
|
||||
|
||||
// property selector will check on string, so I directly provide a string
|
||||
const QString f(BlackMisc::boolToTrueFalse(frameless));
|
||||
this->m_widget->setProperty(this->m_framelessPropertyName.constData(), f);
|
||||
for (QObject *w : this->m_widget->children())
|
||||
m_widget->setProperty(m_framelessPropertyName.constData(), f);
|
||||
for (QObject *w : m_widget->children())
|
||||
{
|
||||
if (w && w->isWidgetType())
|
||||
{
|
||||
w->setProperty(this->m_framelessPropertyName.constData(), f);
|
||||
w->setProperty(m_framelessPropertyName.constData(), f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,21 +145,21 @@ namespace BlackGui
|
||||
void CEnableForFramelessWindow::showMinimizedModeChecked()
|
||||
{
|
||||
if (m_windowMode == CEnableForFramelessWindow::WindowTool) { this->toolToNormalWindow(); }
|
||||
this->m_widget->showMinimized();
|
||||
m_widget->showMinimized();
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::showNormalModeChecked()
|
||||
{
|
||||
if (m_windowMode == CEnableForFramelessWindow::WindowTool) { this->normalToToolWindow(); }
|
||||
this->m_widget->showMinimized();
|
||||
m_widget->showMinimized();
|
||||
}
|
||||
|
||||
bool CEnableForFramelessWindow::handleMousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_ASSERT(this->m_widget);
|
||||
if (this->m_windowMode == WindowFrameless && event->button() == Qt::LeftButton)
|
||||
Q_ASSERT(m_widget);
|
||||
if (m_windowMode == WindowFrameless && event->button() == Qt::LeftButton)
|
||||
{
|
||||
this->m_framelessDragPosition = event->globalPos() - this->m_widget->frameGeometry().topLeft();
|
||||
m_framelessDragPosition = event->globalPos() - m_widget->frameGeometry().topLeft();
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
@@ -168,10 +168,10 @@ namespace BlackGui
|
||||
|
||||
bool CEnableForFramelessWindow::handleMouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_ASSERT(this->m_widget);
|
||||
if (this->m_windowMode == WindowFrameless && event->buttons() & Qt::LeftButton)
|
||||
Q_ASSERT(m_widget);
|
||||
if (m_windowMode == WindowFrameless && event->buttons() & Qt::LeftButton)
|
||||
{
|
||||
this->m_widget->move(event->globalPos() - this->m_framelessDragPosition);
|
||||
m_widget->move(event->globalPos() - m_framelessDragPosition);
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
@@ -211,37 +211,37 @@ namespace BlackGui
|
||||
void CEnableForFramelessWindow::addFramelessSizeGripToStatusBar(QStatusBar *statusBar)
|
||||
{
|
||||
if (!statusBar) { return; }
|
||||
if (!this->m_framelessSizeGrip)
|
||||
if (!m_framelessSizeGrip)
|
||||
{
|
||||
this->m_framelessSizeGrip = new QSizeGrip(this->m_widget);
|
||||
this->m_framelessSizeGrip->setObjectName("sg_FramelessSizeGrip");
|
||||
statusBar->addPermanentWidget(this->m_framelessSizeGrip);
|
||||
m_framelessSizeGrip = new QSizeGrip(m_widget);
|
||||
m_framelessSizeGrip->setObjectName("sg_FramelessSizeGrip");
|
||||
statusBar->addPermanentWidget(m_framelessSizeGrip);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_framelessSizeGrip->show();
|
||||
m_framelessSizeGrip->show();
|
||||
}
|
||||
statusBar->repaint();
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::hideFramelessSizeGripInStatusBar()
|
||||
{
|
||||
if (!this->m_framelessSizeGrip) { return; }
|
||||
this->m_framelessSizeGrip->hide();
|
||||
if (!m_framelessSizeGrip) { return; }
|
||||
m_framelessSizeGrip->hide();
|
||||
}
|
||||
|
||||
QHBoxLayout *CEnableForFramelessWindow::addFramelessCloseButton(QMenuBar *menuBar)
|
||||
{
|
||||
Q_ASSERT(isFrameless());
|
||||
Q_ASSERT(menuBar);
|
||||
Q_ASSERT(this->m_widget);
|
||||
Q_ASSERT(m_widget);
|
||||
|
||||
if (!m_framelessCloseButton)
|
||||
{
|
||||
m_framelessCloseButton = new QPushButton(this->m_widget);
|
||||
m_framelessCloseButton = new QPushButton(m_widget);
|
||||
m_framelessCloseButton->setObjectName("pb_FramelessCloseButton");
|
||||
m_framelessCloseButton->setIcon(CIcons::close16());
|
||||
QObject::connect(m_framelessCloseButton, &QPushButton::clicked, this->m_widget, &QWidget::close);
|
||||
QObject::connect(m_framelessCloseButton, &QPushButton::clicked, m_widget, &QWidget::close);
|
||||
}
|
||||
|
||||
QHBoxLayout *menuBarLayout = new QHBoxLayout;
|
||||
@@ -253,21 +253,21 @@ namespace BlackGui
|
||||
|
||||
void CEnableForFramelessWindow::toolToNormalWindow()
|
||||
{
|
||||
this->m_widget->setWindowFlags((this->m_widget->windowFlags() & (~Qt::Tool)) | Qt::Window);
|
||||
m_widget->setWindowFlags((m_widget->windowFlags() & (~Qt::Tool)) | Qt::Window);
|
||||
this->windowFlagsChanged();
|
||||
this->m_originalWindowMode = WindowNormal;
|
||||
m_originalWindowMode = WindowNormal;
|
||||
}
|
||||
|
||||
void CEnableForFramelessWindow::normalToToolWindow()
|
||||
{
|
||||
this->m_widget->setWindowFlags(this->m_widget->windowFlags() | Qt::Tool);
|
||||
m_widget->setWindowFlags(m_widget->windowFlags() | Qt::Tool);
|
||||
this->windowFlagsChanged();
|
||||
this->m_originalWindowMode = WindowTool;
|
||||
m_originalWindowMode = WindowTool;
|
||||
}
|
||||
|
||||
bool CEnableForFramelessWindow::isToolWindow() const
|
||||
{
|
||||
return (this->m_widget->windowFlags() & Qt::Tool) == Qt::Tool;
|
||||
return (m_widget->windowFlags() & Qt::Tool) == Qt::Tool;
|
||||
}
|
||||
|
||||
Qt::WindowFlags CEnableForFramelessWindow::modeToWindowFlags(CEnableForFramelessWindow::WindowMode mode)
|
||||
|
||||
@@ -30,7 +30,6 @@ class QWidget;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
//! Main window which can be frameless
|
||||
//! \details QMainWindows cannot be promoted. Hence a derived class does not work properly here.
|
||||
//! Furthermore frameless functionality is also required for CDockWidgets as well.
|
||||
@@ -60,7 +59,7 @@ namespace BlackGui
|
||||
virtual void setFrameless(bool frameless);
|
||||
|
||||
//! Frameless?
|
||||
bool isFrameless() const { return this->m_windowMode == WindowFrameless; }
|
||||
bool isFrameless() const { return m_windowMode == WindowFrameless; }
|
||||
|
||||
//! Is main application, explicitly set
|
||||
bool isMainApplicationWindow() const { return m_mainApplicationWindow; }
|
||||
@@ -82,7 +81,7 @@ namespace BlackGui
|
||||
QPushButton *m_framelessCloseButton = nullptr; //!< close button
|
||||
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
|
||||
WindowMode m_originalWindowMode = WindowNormal; //!< mode when initialized
|
||||
bool m_mainApplicationWindow = false; //!< is the main application window (only 1)
|
||||
bool m_mainApplicationWindow = false; //!< is this the main application window (only 1)?
|
||||
QWidget *m_widget = nullptr; //!< corresponding widget or dock widget
|
||||
QSizeGrip *m_framelessSizeGrip = nullptr; //!< size grip object
|
||||
QByteArray m_framelessPropertyName; //!< property name for frameless widgets
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BlackGui
|
||||
this->setWindowIcon(icon);
|
||||
this->settingsChanged();
|
||||
sGui = this;
|
||||
connect(&this->m_styleSheetUtility, &CStyleSheetUtility::styleSheetsChanged, this, &CGuiApplication::styleSheetsChanged);
|
||||
connect(&m_styleSheetUtility, &CStyleSheetUtility::styleSheetsChanged, this, &CGuiApplication::styleSheetsChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,22 +106,22 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::addWindowModeOption()
|
||||
{
|
||||
this->m_cmdWindowMode = QCommandLineOption(QStringList() << "w" << "window",
|
||||
QCoreApplication::translate("main", "Windows: (n)ormal, (f)rameless, (t)ool."),
|
||||
"windowtype");
|
||||
this->addParserOption(this->m_cmdWindowMode);
|
||||
m_cmdWindowMode = QCommandLineOption(QStringList() << "w" << "window",
|
||||
QCoreApplication::translate("main", "Windows: (n)ormal, (f)rameless, (t)ool."),
|
||||
"windowtype");
|
||||
this->addParserOption(m_cmdWindowMode);
|
||||
}
|
||||
|
||||
void CGuiApplication::addWindowStateOption()
|
||||
{
|
||||
this->m_cmdWindowStateMinimized = QCommandLineOption({{"m", "minimized"}, QCoreApplication::translate("main", "Start minimized in system tray.")});
|
||||
this->addParserOption(this->m_cmdWindowStateMinimized);
|
||||
m_cmdWindowStateMinimized = QCommandLineOption({{"m", "minimized"}, QCoreApplication::translate("main", "Start minimized in system tray.")});
|
||||
this->addParserOption(m_cmdWindowStateMinimized);
|
||||
}
|
||||
|
||||
Qt::WindowState CGuiApplication::getWindowState() const
|
||||
{
|
||||
if (this->m_cmdWindowStateMinimized.valueName() == "empty") { return Qt::WindowNoState; }
|
||||
if (this->m_parser.isSet(this->m_cmdWindowStateMinimized)) { return Qt::WindowMinimized; }
|
||||
if (m_cmdWindowStateMinimized.valueName() == "empty") { return Qt::WindowNoState; }
|
||||
if (m_parser.isSet(m_cmdWindowStateMinimized)) { return Qt::WindowMinimized; }
|
||||
return Qt::WindowNoState;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace BlackGui
|
||||
{
|
||||
if (this->isParserOptionSet(m_cmdWindowMode))
|
||||
{
|
||||
const QString v(this->getParserValue(this->m_cmdWindowMode));
|
||||
const QString v(this->getParserValue(m_cmdWindowMode));
|
||||
return CEnableForFramelessWindow::stringToWindowMode(v);
|
||||
}
|
||||
else
|
||||
@@ -140,10 +140,10 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::splashScreen(const QString &resource)
|
||||
{
|
||||
if (this->m_splashScreen)
|
||||
if (m_splashScreen)
|
||||
{
|
||||
// delete old one
|
||||
this->m_splashScreen.reset();
|
||||
m_splashScreen.reset();
|
||||
}
|
||||
if (!resource.isEmpty())
|
||||
{
|
||||
@@ -154,13 +154,13 @@ namespace BlackGui
|
||||
|
||||
void CGuiApplication::splashScreen(const QPixmap &pixmap)
|
||||
{
|
||||
if (this->m_splashScreen)
|
||||
if (m_splashScreen)
|
||||
{
|
||||
// delete old one
|
||||
this->m_splashScreen.reset();
|
||||
m_splashScreen.reset();
|
||||
}
|
||||
this->m_splashScreen.reset(new QSplashScreen(pixmap.scaled(256, 256)));
|
||||
this->m_splashScreen->show();
|
||||
m_splashScreen.reset(new QSplashScreen(pixmap.scaled(256, 256)));
|
||||
m_splashScreen->show();
|
||||
this->processEventsToRefreshGui();
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ namespace BlackGui
|
||||
void CGuiApplication::initMainApplicationWindow(QWidget *mainWindow)
|
||||
{
|
||||
if (!mainWindow) { return; }
|
||||
if (this->m_uiSetupCompleted) { return; }
|
||||
this->m_uiSetupCompleted = true;
|
||||
if (m_uiSetupCompleted) { return; }
|
||||
m_uiSetupCompleted = true;
|
||||
const QString name(this->getApplicationNameVersionBetaDev());
|
||||
mainWindow->setObjectName(QCoreApplication::applicationName());
|
||||
mainWindow->setWindowTitle(name);
|
||||
@@ -213,10 +213,10 @@ namespace BlackGui
|
||||
void CGuiApplication::onStartUpCompleted()
|
||||
{
|
||||
CApplication::onStartUpCompleted();
|
||||
if (this->m_splashScreen)
|
||||
if (m_splashScreen)
|
||||
{
|
||||
this->m_splashScreen->close();
|
||||
this->m_splashScreen.reset();
|
||||
m_splashScreen->close();
|
||||
m_splashScreen.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace BlackGui
|
||||
|
||||
bool CGuiApplication::cmdLineErrorMessage(const QString &errorMessage, bool retry) const
|
||||
{
|
||||
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
|
||||
const QString helpText(beautifyHelpMessage(m_parser.helpText()));
|
||||
constexpr int MaxLength = 60;
|
||||
|
||||
QString htmlMsg;
|
||||
@@ -295,7 +295,7 @@ namespace BlackGui
|
||||
if (!msgs.hasErrorMessages()) { return false; }
|
||||
static const CPropertyIndexList propertiesSingle({ CStatusMessage::IndexMessage });
|
||||
static const CPropertyIndexList propertiesMulti({ CStatusMessage::IndexSeverityAsString, CStatusMessage::IndexMessage });
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(m_parser.helpText()));
|
||||
const QString msgsHtml = msgs.toHtml(msgs.size() > 1 ? propertiesMulti : propertiesSingle);
|
||||
const int r = QMessageBox::critical(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
@@ -576,7 +576,7 @@ namespace BlackGui
|
||||
|
||||
const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const
|
||||
{
|
||||
return this->m_styleSheetUtility;
|
||||
return m_styleSheetUtility;
|
||||
}
|
||||
|
||||
QString CGuiApplication::getWidgetStyle() const
|
||||
@@ -648,17 +648,17 @@ namespace BlackGui
|
||||
{
|
||||
const bool needsDialog = this->hasUnsavedSettings();
|
||||
if (!needsDialog) { return QDialog::Accepted; }
|
||||
if (!this->m_closeDialog)
|
||||
if (!m_closeDialog)
|
||||
{
|
||||
this->m_closeDialog = new CApplicationCloseDialog(mainWindow);
|
||||
m_closeDialog = new CApplicationCloseDialog(mainWindow);
|
||||
if (mainWindow && !mainWindow->windowTitle().isEmpty())
|
||||
{
|
||||
this->setSettingsAutoSave(false); // will be handled by dialog
|
||||
this->m_closeDialog->setWindowTitle(mainWindow->windowTitle());
|
||||
this->m_closeDialog->setModal(true);
|
||||
m_closeDialog->setWindowTitle(mainWindow->windowTitle());
|
||||
m_closeDialog->setModal(true);
|
||||
}
|
||||
}
|
||||
const QDialog::DialogCode c = static_cast<QDialog::DialogCode>(this->m_closeDialog->exec());
|
||||
const QDialog::DialogCode c = static_cast<QDialog::DialogCode>(m_closeDialog->exec());
|
||||
if (c == QDialog::Rejected)
|
||||
{
|
||||
if (closeEvent) { closeEvent->ignore(); }
|
||||
@@ -670,7 +670,7 @@ namespace BlackGui
|
||||
{
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(m_parser.helpText()));
|
||||
QMessageBox::information(nullptr, QGuiApplication::applicationDisplayName(),
|
||||
"<html><head/><body>" + helpText + "</body></html>");
|
||||
}
|
||||
@@ -718,7 +718,7 @@ namespace BlackGui
|
||||
if (!m_updateSetting.get()) { return; }
|
||||
QTimer::singleShot(delayedMs, this, [ = ]
|
||||
{
|
||||
if (this->m_installDialog) { return; }
|
||||
if (m_installDialog) { return; }
|
||||
this->checkNewVersion(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
|
||||
QApplication qa(argc, argv); // needed
|
||||
Q_UNUSED(qa);
|
||||
CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Laucher, CIcons::swiftLauncher1024());
|
||||
a.addVatlibOptions(); // so it can be passed to started applications
|
||||
a.addVatlibOptions(); // so it can be passed (hand over) to started applications
|
||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.") });
|
||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
|
||||
|
||||
Reference in New Issue
Block a user