From fd4fb01a238d25996d67bda13bccd3d754500ec4 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 30 Jul 2024 10:11:15 +0200 Subject: [PATCH] Android: Merge splashscreenwidget related file pairs Change-Id: I8b21fff7954aa279cbf852ab07f837187ac9ce77 Reviewed-by: Alessandro Portale --- src/plugins/android/CMakeLists.txt | 1 - src/plugins/android/android.qbs | 2 - .../android/splashscreencontainerwidget.cpp | 281 +++++++++++++++++- .../android/splashscreencontainerwidget.h | 6 +- src/plugins/android/splashscreenwidget.cpp | 247 --------------- src/plugins/android/splashscreenwidget.h | 75 ----- 6 files changed, 276 insertions(+), 336 deletions(-) delete mode 100644 src/plugins/android/splashscreenwidget.cpp delete mode 100644 src/plugins/android/splashscreenwidget.h diff --git a/src/plugins/android/CMakeLists.txt b/src/plugins/android/CMakeLists.txt index bd662a216d0..6b29a8a85dd 100644 --- a/src/plugins/android/CMakeLists.txt +++ b/src/plugins/android/CMakeLists.txt @@ -45,7 +45,6 @@ add_qtc_plugin(Android javalanguageserver.cpp javalanguageserver.h javaparser.cpp javaparser.h splashscreencontainerwidget.cpp splashscreencontainerwidget.h - splashscreenwidget.cpp splashscreenwidget.h sdkmanageroutputparser.cpp sdkmanageroutputparser.h ) diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs index 328209816b2..353bc5350be 100644 --- a/src/plugins/android/android.qbs +++ b/src/plugins/android/android.qbs @@ -95,8 +95,6 @@ QtcPlugin { "javaparser.h", "splashscreencontainerwidget.cpp", "splashscreencontainerwidget.h", - "splashscreenwidget.cpp", - "splashscreenwidget.h", "sdkmanageroutputparser.cpp", "sdkmanageroutputparser.h" ] diff --git a/src/plugins/android/splashscreencontainerwidget.cpp b/src/plugins/android/splashscreencontainerwidget.cpp index 2d7eac1bc83..351fcd1a448 100644 --- a/src/plugins/android/splashscreencontainerwidget.cpp +++ b/src/plugins/android/splashscreencontainerwidget.cpp @@ -1,9 +1,9 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "androidtr.h" #include "splashscreencontainerwidget.h" -#include "splashscreenwidget.h" + +#include "androidtr.h" #include #include @@ -14,11 +14,13 @@ #include #include #include -#include #include #include #include #include +#include +#include +#include #include #include #include @@ -27,8 +29,7 @@ using namespace Utils; -namespace Android { -namespace Internal { +namespace Android::Internal { const char extraExtraExtraHighDpiImagePath[] = "/res/drawable-xxxhdpi/"; const char extraExtraHighDpiImagePath[] = "/res/drawable-xxhdpi/"; @@ -66,6 +67,271 @@ static FilePath manifestDir(TextEditor::TextEditorWidget *textEditorWidget) return textEditorWidget->textDocument()->filePath().absolutePath(); } +static Q_LOGGING_CATEGORY(androidManifestEditorLog, "qtc.android.splashScreenWidget", QtWarningMsg); + +class SplashScreenWidget : public QWidget +{ + Q_OBJECT + + class SplashScreenButton : public QToolButton + { + public: + explicit SplashScreenButton(SplashScreenWidget *parent) + : QToolButton(parent), + m_parentWidget(parent) + {} + + private: + void paintEvent(QPaintEvent *event) override + { + Q_UNUSED(event); + QPainter painter(this); + painter.setPen(QPen(Qt::gray, 1)); + painter.setBrush(QBrush(m_parentWidget->m_backgroundColor)); + painter.drawRect(0, 0, width()-1, height()-1); + if (!m_parentWidget->m_image.isNull()) + painter.drawImage(m_parentWidget->m_imagePosition, m_parentWidget->m_image); + } + + SplashScreenWidget *m_parentWidget; + }; + +public: + explicit SplashScreenWidget(QWidget *parent) : QWidget(parent) {} + SplashScreenWidget(QWidget *parent, + const QSize &size, + const QSize &screenSize, + const QString &title, + const QString &tooltip, + const QString &imagePath, + int scalingRatio, int maxScalingRatio, + TextEditor::TextEditorWidget *textEditorWidget = nullptr); + + bool hasImage() const; + void clearImage(); + void setBackgroundColor(const QColor &backgroundColor); + void showImageFullScreen(bool fullScreen); + void setImageFromPath(const FilePath &imagePath, bool resize = true); + void setImageFileName(const QString &imageFileName); + void loadImage(); + +signals: + void imageChanged(); + +private: + void selectImage(); + void removeImage(); + void setScaleWarningLabelVisible(bool visible); + +private: + TextEditor::TextEditorWidget *m_textEditorWidget = nullptr; + QLabel *m_scaleWarningLabel = nullptr; + SplashScreenButton *m_splashScreenButton = nullptr; + int m_scalingRatio, m_maxScalingRatio; + QColor m_backgroundColor = Qt::white; + QImage m_image; + QPoint m_imagePosition; + QString m_imagePath; + QString m_imageFileName; + QString m_imageSelectionText; + QSize m_screenSize; + bool m_showImageFullScreen = false; +}; + +SplashScreenWidget::SplashScreenWidget( + QWidget *parent, + const QSize &size, const QSize &screenSize, + const QString &title, const QString &tooltip, + const QString &imagePath, + int scalingRatio, int maxScalingRatio, + TextEditor::TextEditorWidget *textEditorWidget) + : QWidget(parent), + m_textEditorWidget(textEditorWidget), + m_scalingRatio(scalingRatio), + m_maxScalingRatio(maxScalingRatio), + m_imagePath(imagePath), + m_screenSize(screenSize) +{ + auto splashLayout = new QVBoxLayout(this); + auto splashTitle = new QLabel(title, this); + auto splashButtonLayout = new QGridLayout(); + m_splashScreenButton = new SplashScreenButton(this); + m_splashScreenButton->setMinimumSize(size); + m_splashScreenButton->setMaximumSize(size); + m_splashScreenButton->setToolTip(tooltip); + QSize clearAndWarningSize(16, 16); + QToolButton *clearButton = nullptr; + if (textEditorWidget) { + clearButton = new QToolButton(this); + clearButton->setMinimumSize(clearAndWarningSize); + clearButton->setMaximumSize(clearAndWarningSize); + clearButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon()); + } + if (textEditorWidget) { + m_scaleWarningLabel = new QLabel(this); + m_scaleWarningLabel->setMinimumSize(clearAndWarningSize); + m_scaleWarningLabel->setMaximumSize(clearAndWarningSize); + m_scaleWarningLabel->setPixmap(Utils::Icons::WARNING.icon().pixmap(clearAndWarningSize)); + m_scaleWarningLabel->setToolTip(Tr::tr("Icon scaled up.")); + m_scaleWarningLabel->setVisible(false); + } + auto label = new QLabel(Tr::tr("Click to select..."), parent); + splashLayout->addWidget(splashTitle); + splashLayout->setAlignment(splashTitle, Qt::AlignHCenter); + splashButtonLayout->setColumnMinimumWidth(0, 16); + splashButtonLayout->addWidget(m_splashScreenButton, 0, 1, 1, 3); + splashButtonLayout->setAlignment(m_splashScreenButton, Qt::AlignVCenter); + if (textEditorWidget) { + splashButtonLayout->addWidget(clearButton, 0, 4, 1, 1); + splashButtonLayout->setAlignment(clearButton, Qt::AlignTop); + } + if (textEditorWidget) { + splashButtonLayout->addWidget(m_scaleWarningLabel, 0, 0, 1, 1); + splashButtonLayout->setAlignment(m_scaleWarningLabel, Qt::AlignTop); + } + splashLayout->addLayout(splashButtonLayout); + splashLayout->setAlignment(splashButtonLayout, Qt::AlignHCenter); + splashLayout->addWidget(label); + splashLayout->setAlignment(label, Qt::AlignHCenter); + this->setLayout(splashLayout); + connect(m_splashScreenButton, &QAbstractButton::clicked, + this, &SplashScreenWidget::selectImage); + if (clearButton) + connect(clearButton, &QAbstractButton::clicked, + this, &SplashScreenWidget::removeImage); + m_imageSelectionText = tooltip; +} + +void SplashScreenWidget::setBackgroundColor(const QColor &backgroundColor) +{ + m_backgroundColor = backgroundColor; + m_splashScreenButton->update(); + emit imageChanged(); +} + +void SplashScreenWidget::showImageFullScreen(bool fullScreen) +{ + m_showImageFullScreen = fullScreen; + loadImage(); +} + +void SplashScreenWidget::setImageFromPath(const FilePath &imagePath, bool resize) +{ + if (!m_textEditorWidget) + return; + const FilePath baseDir = manifestDir(m_textEditorWidget); + const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; + if (targetPath.isEmpty()) { + qCDebug(androidManifestEditorLog) << "Image target path is empty, cannot set image."; + return; + } + QImage image = QImage(imagePath.toString()); + if (image.isNull()) { + qCDebug(androidManifestEditorLog) << "Image '" << imagePath << "' not found or invalid format."; + return; + } + if (!targetPath.absolutePath().ensureWritableDir()) { + qCDebug(androidManifestEditorLog) << "Cannot create image target path."; + return; + } + if (resize == true && m_scalingRatio < m_maxScalingRatio) { + const QSize size = QSize((float(image.width()) / float(m_maxScalingRatio)) * float(m_scalingRatio), + (float(image.height()) / float(m_maxScalingRatio)) * float(m_scalingRatio)); + image = image.scaled(size); + } + QFile file(targetPath.toString()); + if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + image.save(&file, "PNG"); + file.close(); + loadImage(); + emit imageChanged(); + } + else { + qCDebug(androidManifestEditorLog).noquote() + << "Cannot save image." << targetPath.toUserOutput(); + } +} + +void SplashScreenWidget::selectImage() +{ + const FilePath file = FileUtils::getOpenFilePath(this, m_imageSelectionText, + FileUtils::homePath(), + QStringLiteral("%1 (*.png *.jpg *.jpeg)") + .arg(Tr::tr("Images"))); + if (file.isEmpty()) + return; + setImageFromPath(file, false); + emit imageChanged(); +} + +void SplashScreenWidget::removeImage() +{ + const FilePath baseDir = manifestDir(m_textEditorWidget); + const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; + if (targetPath.isEmpty()) { + qCDebug(androidManifestEditorLog) << "Image target path empty, cannot remove image."; + return; + } + targetPath.removeFile(); + m_image = QImage(); + m_splashScreenButton->update(); + setScaleWarningLabelVisible(false); +} + +void SplashScreenWidget::clearImage() +{ + removeImage(); + emit imageChanged(); +} + +void SplashScreenWidget::loadImage() +{ + if (m_imageFileName.isEmpty()) { + qCDebug(androidManifestEditorLog) << "Image name not set, cannot load image."; + return; + } + const FilePath baseDir = manifestDir(m_textEditorWidget); + const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; + if (targetPath.isEmpty()) { + qCDebug(androidManifestEditorLog) << "Image target path empty, cannot load image."; + return; + } + QImage image = QImage(targetPath.toString()); + if (image.isNull()) { + qCDebug(androidManifestEditorLog).noquote() + << "Cannot load image." << targetPath.toUserOutput(); + return; + } + if (m_showImageFullScreen) { + m_image = image.scaled(m_splashScreenButton->size()); + m_imagePosition = QPoint(0,0); + } + else { + QSize scaledSize = QSize((m_splashScreenButton->width() * image.width()) / m_screenSize.width(), + (m_splashScreenButton->height() * image.height()) / m_screenSize.height()); + m_image = image.scaled(scaledSize, Qt::KeepAspectRatio); + m_imagePosition = QPoint((m_splashScreenButton->width() - m_image.width()) / 2, + (m_splashScreenButton->height() - m_image.height()) / 2); + } + m_splashScreenButton->update(); +} + +bool SplashScreenWidget::hasImage() const +{ + return !m_image.isNull(); +} + +void SplashScreenWidget::setScaleWarningLabelVisible(bool visible) +{ + if (m_scaleWarningLabel) + m_scaleWarningLabel->setVisible(visible); +} + +void SplashScreenWidget::setImageFileName(const QString &imageFileName) +{ + m_imageFileName = imageFileName; +} + static SplashScreenWidget *addWidgetToPage(QWidget *page, const QSize &size, const QSize &screenSize, const QString &title, const QString &tooltip, @@ -618,5 +884,6 @@ QString SplashScreenContainerWidget::landscapeImageName() const return splashscreenLandscapeName; } -} // namespace Internal -} // namespace Android +} // namespace Android::Internal + +#include "splashscreencontainerwidget.moc" diff --git a/src/plugins/android/splashscreencontainerwidget.h b/src/plugins/android/splashscreencontainerwidget.h index ef8f2f5b0a1..4c700a7c475 100644 --- a/src/plugins/android/splashscreencontainerwidget.h +++ b/src/plugins/android/splashscreencontainerwidget.h @@ -15,8 +15,7 @@ QT_END_NAMESPACE namespace TextEditor { class TextEditorWidget; } -namespace Android { -namespace Internal { +namespace Android::Internal { class SplashScreenWidget; @@ -62,5 +61,4 @@ private: QToolButton *m_convertSplashscreen = nullptr; }; -} // namespace Internal -} // namespace Android +} // namespace Android::Internal diff --git a/src/plugins/android/splashscreenwidget.cpp b/src/plugins/android/splashscreenwidget.cpp deleted file mode 100644 index 0015ab4fda7..00000000000 --- a/src/plugins/android/splashscreenwidget.cpp +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "androidtr.h" -#include "splashscreenwidget.h" - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace Utils; - -namespace Android::Internal { - -static Q_LOGGING_CATEGORY(androidManifestEditorLog, "qtc.android.splashScreenWidget", QtWarningMsg) - -FilePath manifestDir(TextEditor::TextEditorWidget *textEditorWidget) -{ - // Get the manifest file's directory from its filepath. - return textEditorWidget->textDocument()->filePath().absolutePath(); -} - -SplashScreenWidget::SplashScreenWidget(QWidget *parent) : QWidget(parent) -{ -} - -SplashScreenWidget::SplashScreenWidget( - QWidget *parent, - const QSize &size, const QSize &screenSize, - const QString &title, const QString &tooltip, - const QString &imagePath, - int scalingRatio, int maxScalingRatio, - TextEditor::TextEditorWidget *textEditorWidget) - : QWidget(parent), - m_textEditorWidget(textEditorWidget), - m_scalingRatio(scalingRatio), - m_maxScalingRatio(maxScalingRatio), - m_imagePath(imagePath), - m_screenSize(screenSize) -{ - auto splashLayout = new QVBoxLayout(this); - auto splashTitle = new QLabel(title, this); - auto splashButtonLayout = new QGridLayout(); - m_splashScreenButton = new SplashScreenButton(this); - m_splashScreenButton->setMinimumSize(size); - m_splashScreenButton->setMaximumSize(size); - m_splashScreenButton->setToolTip(tooltip); - QSize clearAndWarningSize(16, 16); - QToolButton *clearButton = nullptr; - if (textEditorWidget) { - clearButton = new QToolButton(this); - clearButton->setMinimumSize(clearAndWarningSize); - clearButton->setMaximumSize(clearAndWarningSize); - clearButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon()); - } - if (textEditorWidget) { - m_scaleWarningLabel = new QLabel(this); - m_scaleWarningLabel->setMinimumSize(clearAndWarningSize); - m_scaleWarningLabel->setMaximumSize(clearAndWarningSize); - m_scaleWarningLabel->setPixmap(Utils::Icons::WARNING.icon().pixmap(clearAndWarningSize)); - m_scaleWarningLabel->setToolTip(Tr::tr("Icon scaled up.")); - m_scaleWarningLabel->setVisible(false); - } - auto label = new QLabel(Tr::tr("Click to select..."), parent); - splashLayout->addWidget(splashTitle); - splashLayout->setAlignment(splashTitle, Qt::AlignHCenter); - splashButtonLayout->setColumnMinimumWidth(0, 16); - splashButtonLayout->addWidget(m_splashScreenButton, 0, 1, 1, 3); - splashButtonLayout->setAlignment(m_splashScreenButton, Qt::AlignVCenter); - if (textEditorWidget) { - splashButtonLayout->addWidget(clearButton, 0, 4, 1, 1); - splashButtonLayout->setAlignment(clearButton, Qt::AlignTop); - } - if (textEditorWidget) { - splashButtonLayout->addWidget(m_scaleWarningLabel, 0, 0, 1, 1); - splashButtonLayout->setAlignment(m_scaleWarningLabel, Qt::AlignTop); - } - splashLayout->addLayout(splashButtonLayout); - splashLayout->setAlignment(splashButtonLayout, Qt::AlignHCenter); - splashLayout->addWidget(label); - splashLayout->setAlignment(label, Qt::AlignHCenter); - this->setLayout(splashLayout); - connect(m_splashScreenButton, &QAbstractButton::clicked, - this, &SplashScreenWidget::selectImage); - if (clearButton) - connect(clearButton, &QAbstractButton::clicked, - this, &SplashScreenWidget::removeImage); - m_imageSelectionText = tooltip; -} - -SplashScreenWidget::SplashScreenButton::SplashScreenButton(SplashScreenWidget *parent) - : QToolButton(parent), - m_parentWidget(parent) -{ -} - -void SplashScreenWidget::SplashScreenButton::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - QPainter painter(this); - painter.setPen(QPen(Qt::gray, 1)); - painter.setBrush(QBrush(m_parentWidget->m_backgroundColor)); - painter.drawRect(0, 0, width()-1, height()-1); - if (!m_parentWidget->m_image.isNull()) - painter.drawImage(m_parentWidget->m_imagePosition, m_parentWidget->m_image); -} - -void SplashScreenWidget::setBackgroundColor(const QColor &backgroundColor) -{ - m_backgroundColor = backgroundColor; - m_splashScreenButton->update(); - emit imageChanged(); -} - -void SplashScreenWidget::showImageFullScreen(bool fullScreen) -{ - m_showImageFullScreen = fullScreen; - loadImage(); -} - -void SplashScreenWidget::setImageFromPath(const FilePath &imagePath, bool resize) -{ - if (!m_textEditorWidget) - return; - const FilePath baseDir = manifestDir(m_textEditorWidget); - const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; - if (targetPath.isEmpty()) { - qCDebug(androidManifestEditorLog) << "Image target path is empty, cannot set image."; - return; - } - QImage image = QImage(imagePath.toString()); - if (image.isNull()) { - qCDebug(androidManifestEditorLog) << "Image '" << imagePath << "' not found or invalid format."; - return; - } - if (!targetPath.absolutePath().ensureWritableDir()) { - qCDebug(androidManifestEditorLog) << "Cannot create image target path."; - return; - } - if (resize == true && m_scalingRatio < m_maxScalingRatio) { - const QSize size = QSize((float(image.width()) / float(m_maxScalingRatio)) * float(m_scalingRatio), - (float(image.height()) / float(m_maxScalingRatio)) * float(m_scalingRatio)); - image = image.scaled(size); - } - QFile file(targetPath.toString()); - if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - image.save(&file, "PNG"); - file.close(); - loadImage(); - emit imageChanged(); - } - else { - qCDebug(androidManifestEditorLog).noquote() - << "Cannot save image." << targetPath.toUserOutput(); - } -} - -void SplashScreenWidget::selectImage() -{ - const FilePath file = FileUtils::getOpenFilePath(this, m_imageSelectionText, - FileUtils::homePath(), - QStringLiteral("%1 (*.png *.jpg *.jpeg)") - .arg(Tr::tr("Images"))); - if (file.isEmpty()) - return; - setImageFromPath(file, false); - emit imageChanged(); -} - -void SplashScreenWidget::removeImage() -{ - const FilePath baseDir = manifestDir(m_textEditorWidget); - const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; - if (targetPath.isEmpty()) { - qCDebug(androidManifestEditorLog) << "Image target path empty, cannot remove image."; - return; - } - targetPath.removeFile(); - m_image = QImage(); - m_splashScreenButton->update(); - setScaleWarningLabelVisible(false); -} - -void SplashScreenWidget::clearImage() -{ - removeImage(); - emit imageChanged(); -} - -void SplashScreenWidget::loadImage() -{ - if (m_imageFileName.isEmpty()) { - qCDebug(androidManifestEditorLog) << "Image name not set, cannot load image."; - return; - } - const FilePath baseDir = manifestDir(m_textEditorWidget); - const FilePath targetPath = baseDir / m_imagePath / m_imageFileName; - if (targetPath.isEmpty()) { - qCDebug(androidManifestEditorLog) << "Image target path empty, cannot load image."; - return; - } - QImage image = QImage(targetPath.toString()); - if (image.isNull()) { - qCDebug(androidManifestEditorLog).noquote() - << "Cannot load image." << targetPath.toUserOutput(); - return; - } - if (m_showImageFullScreen) { - m_image = image.scaled(m_splashScreenButton->size()); - m_imagePosition = QPoint(0,0); - } - else { - QSize scaledSize = QSize((m_splashScreenButton->width() * image.width()) / m_screenSize.width(), - (m_splashScreenButton->height() * image.height()) / m_screenSize.height()); - m_image = image.scaled(scaledSize, Qt::KeepAspectRatio); - m_imagePosition = QPoint((m_splashScreenButton->width() - m_image.width()) / 2, - (m_splashScreenButton->height() - m_image.height()) / 2); - } - m_splashScreenButton->update(); -} - -bool SplashScreenWidget::hasImage() const -{ - return !m_image.isNull(); -} - -void SplashScreenWidget::setScaleWarningLabelVisible(bool visible) -{ - if (m_scaleWarningLabel) - m_scaleWarningLabel->setVisible(visible); -} - -void SplashScreenWidget::setImageFileName(const QString &imageFileName) -{ - m_imageFileName = imageFileName; -} - -} // Android::Internal diff --git a/src/plugins/android/splashscreenwidget.h b/src/plugins/android/splashscreenwidget.h deleted file mode 100644 index 8a11c0f5864..00000000000 --- a/src/plugins/android/splashscreenwidget.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -#include - -namespace TextEditor { class TextEditorWidget; } - -QT_BEGIN_NAMESPACE -class QLabel; -class QColor; -class QImage; -QT_END_NAMESPACE - -namespace Android::Internal { - -class SplashScreenWidget : public QWidget -{ - Q_OBJECT - - class SplashScreenButton : public QToolButton - { - public: - explicit SplashScreenButton(SplashScreenWidget *parent); - private: - void paintEvent(QPaintEvent *event) override; - SplashScreenWidget *m_parentWidget; - }; - -public: - explicit SplashScreenWidget(QWidget *parent); - SplashScreenWidget(QWidget *parent, - const QSize &size, - const QSize &screenSize, - const QString &title, - const QString &tooltip, - const QString &imagePath, - int scalingRatio, int maxScalingRatio, - TextEditor::TextEditorWidget *textEditorWidget = nullptr); - - bool hasImage() const; - void clearImage(); - void setBackgroundColor(const QColor &backgroundColor); - void showImageFullScreen(bool fullScreen); - void setImageFromPath(const Utils::FilePath &imagePath, bool resize = true); - void setImageFileName(const QString &imageFileName); - void loadImage(); - -signals: - void imageChanged(); - -private: - void selectImage(); - void removeImage(); - void setScaleWarningLabelVisible(bool visible); - -private: - TextEditor::TextEditorWidget *m_textEditorWidget = nullptr; - QLabel *m_scaleWarningLabel = nullptr; - SplashScreenButton *m_splashScreenButton = nullptr; - int m_scalingRatio, m_maxScalingRatio; - QColor m_backgroundColor = Qt::white; - QImage m_image; - QPoint m_imagePosition; - QString m_imagePath; - QString m_imageFileName; - QString m_imageSelectionText; - QSize m_screenSize; - bool m_showImageFullScreen = false; -}; - -} // Android::Internal