diff --git a/src/Splitter.cpp b/src/Splitter.cpp index 32c67425d428c837df902dcb315078b3f8d3921a..6267e59195d8ad6886438b390c35cc0b24a97f77 100644 --- a/src/Splitter.cpp +++ b/src/Splitter.cpp @@ -15,15 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <QApplication> -#include <QDesktopWidget> #include <QSettings> -#include <QShortcut> -#include "Config.h" #include "Logging.h" #include "Splitter.h" -#include "Utils.h" constexpr auto MaxWidth = (1 << 24) - 1; @@ -180,4 +175,3 @@ splitter::calculateSidebarSizes(const QFont &f) return sz; } - diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index 2f267a23d7703b2f12fac65c09bfd910923ec609..3674ee0d8ab905ab29624a9fec986bca0c0655f4 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -18,17 +18,14 @@ #pragma once #include <deque> -#include <iterator> -#include <map> #include <optional> -#include <QApplication> +#include <QCoreApplication> #include <QHBoxLayout> #include <QPaintEvent> #include <QTextEdit> #include <QWidget> -#include "Utils.h" #include "dialogs/PreviewUploadOverlay.h" #include "emoji/PickButton.h" #include "popups/ReplyPopup.h" diff --git a/src/Utils.cpp b/src/Utils.cpp index 55eebbc97ad86e2bf7c42a84b7d32c6ba84ee222..91ecfcd783711ca3467d35fc2f07916fd8de5af0 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -651,4 +651,3 @@ utils::restoreCombobox(QComboBox *combo, const QString &value) } } } - diff --git a/src/dialogs/PreviewUploadOverlay.cpp b/src/dialogs/PreviewUploadOverlay.cpp index 31d0121406645a992c9a96f24333927f751d31c6..42558d679bf00d559c662e1368efd6a4f383def5 100644 --- a/src/dialogs/PreviewUploadOverlay.cpp +++ b/src/dialogs/PreviewUploadOverlay.cpp @@ -15,7 +15,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <QApplication> #include <QBuffer> #include <QFile> #include <QFileInfo> diff --git a/src/popups/UserMentions.cpp b/src/popups/UserMentions.cpp index 763eeffc2bde4a8a8972d8bb05d27a4162638054..b0223f7fb79cf19d6770df0581d835896320017b 100644 --- a/src/popups/UserMentions.cpp +++ b/src/popups/UserMentions.cpp @@ -1,7 +1,10 @@ +#include <QPaintEvent> #include <QPainter> +#include <QScrollArea> #include <QStyleOption> #include <QTabWidget> #include <QTimer> +#include <QVBoxLayout> #include "Cache.h" #include "ChatPage.h" diff --git a/src/popups/UserMentions.h b/src/popups/UserMentions.h index 42bdcd60796450bab2f9059b31a4896a70e59d6b..b7c4e51d4ffb0db34e51155c30850da296f37a6b 100644 --- a/src/popups/UserMentions.h +++ b/src/popups/UserMentions.h @@ -3,13 +3,13 @@ #include <mtx/responses.hpp> #include <QMap> -#include <QPaintEvent> -#include <QScrollArea> #include <QString> -#include <QTabWidget> -#include <QVBoxLayout> #include <QWidget> +class QPaintEvent; +class QTabWidget; +class QScrollArea; +class QVBoxLayout; namespace popups { diff --git a/src/ui/DropShadow.cpp b/src/ui/DropShadow.cpp index 93baa02d36474637009357e018b5870363c89589..d437975ccbc63caa0f3cf8f3d8d1f54f67263fe2 100644 --- a/src/ui/DropShadow.cpp +++ b/src/ui/DropShadow.cpp @@ -3,108 +3,106 @@ #include <QLinearGradient> #include <QPainter> +void +DropShadow::draw(QPainter &painter, + qint16 margin, + qreal radius, + QColor start, + QColor end, + qreal startPosition, + qreal endPosition0, + qreal endPosition1, + qreal width, + qreal height) +{ + painter.setPen(Qt::NoPen); - void DropShadow::draw(QPainter &painter, - qint16 margin, - qreal radius, - QColor start, - QColor end, - qreal startPosition, - qreal endPosition0, - qreal endPosition1, - qreal width, - qreal height) - { - painter.setPen(Qt::NoPen); + QLinearGradient gradient; + gradient.setColorAt(startPosition, start); + gradient.setColorAt(endPosition0, end); - QLinearGradient gradient; - gradient.setColorAt(startPosition, start); - gradient.setColorAt(endPosition0, end); + // Right + QPointF right0(width - margin, height / 2); + QPointF right1(width, height / 2); + gradient.setStart(right0); + gradient.setFinalStop(right1); + painter.setBrush(QBrush(gradient)); + // Deprecated in 5.13: painter.drawRoundRect( + // QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - + // margin)), 0.0, 0.0); + painter.drawRoundedRect( + QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)), + 0.0, + 0.0); - // Right - QPointF right0(width - margin, height / 2); - QPointF right1(width, height / 2); - gradient.setStart(right0); - gradient.setFinalStop(right1); - painter.setBrush(QBrush(gradient)); - // Deprecated in 5.13: painter.drawRoundRect( - // QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - - // margin)), 0.0, 0.0); - painter.drawRoundedRect( - QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)), - 0.0, - 0.0); + // Left + QPointF left0(margin, height / 2); + QPointF left1(0, height / 2); + gradient.setStart(left0); + gradient.setFinalStop(left1); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect( + QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0); - // Left - QPointF left0(margin, height / 2); - QPointF left1(0, height / 2); - gradient.setStart(left0); - gradient.setFinalStop(left1); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect( - QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0); + // Top + QPointF top0(width / 2, margin); + QPointF top1(width / 2, 0); + gradient.setStart(top0); + gradient.setFinalStop(top1); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect( + QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0); - // Top - QPointF top0(width / 2, margin); - QPointF top1(width / 2, 0); - gradient.setStart(top0); - gradient.setFinalStop(top1); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect( - QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0); + // Bottom + QPointF bottom0(width / 2, height - margin); + QPointF bottom1(width / 2, height); + gradient.setStart(bottom0); + gradient.setFinalStop(bottom1); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect( + QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)), 0.0, 0.0); - // Bottom - QPointF bottom0(width / 2, height - margin); - QPointF bottom1(width / 2, height); - gradient.setStart(bottom0); - gradient.setFinalStop(bottom1); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect( - QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)), - 0.0, - 0.0); + // BottomRight + QPointF bottomright0(width - margin, height - margin); + QPointF bottomright1(width, height); + gradient.setStart(bottomright0); + gradient.setFinalStop(bottomright1); + gradient.setColorAt(endPosition1, end); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect(QRectF(bottomright0, bottomright1), 0.0, 0.0); - // BottomRight - QPointF bottomright0(width - margin, height - margin); - QPointF bottomright1(width, height); - gradient.setStart(bottomright0); - gradient.setFinalStop(bottomright1); - gradient.setColorAt(endPosition1, end); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect(QRectF(bottomright0, bottomright1), 0.0, 0.0); + // BottomLeft + QPointF bottomleft0(margin, height - margin); + QPointF bottomleft1(0, height); + gradient.setStart(bottomleft0); + gradient.setFinalStop(bottomleft1); + gradient.setColorAt(endPosition1, end); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0); - // BottomLeft - QPointF bottomleft0(margin, height - margin); - QPointF bottomleft1(0, height); - gradient.setStart(bottomleft0); - gradient.setFinalStop(bottomleft1); - gradient.setColorAt(endPosition1, end); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0); + // TopLeft + QPointF topleft0(margin, margin); + QPointF topleft1(0, 0); + gradient.setStart(topleft0); + gradient.setFinalStop(topleft1); + gradient.setColorAt(endPosition1, end); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect(QRectF(topleft0, topleft1), 0.0, 0.0); - // TopLeft - QPointF topleft0(margin, margin); - QPointF topleft1(0, 0); - gradient.setStart(topleft0); - gradient.setFinalStop(topleft1); - gradient.setColorAt(endPosition1, end); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect(QRectF(topleft0, topleft1), 0.0, 0.0); + // TopRight + QPointF topright0(width - margin, margin); + QPointF topright1(width, 0); + gradient.setStart(topright0); + gradient.setFinalStop(topright1); + gradient.setColorAt(endPosition1, end); + painter.setBrush(QBrush(gradient)); + painter.drawRoundedRect(QRectF(topright0, topright1), 0.0, 0.0); - // TopRight - QPointF topright0(width - margin, margin); - QPointF topright1(width, 0); - gradient.setStart(topright0); - gradient.setFinalStop(topright1); - gradient.setColorAt(endPosition1, end); - painter.setBrush(QBrush(gradient)); - painter.drawRoundedRect(QRectF(topright0, topright1), 0.0, 0.0); - - // Widget - painter.setBrush(QBrush("#FFFFFF")); - painter.setRenderHint(QPainter::Antialiasing); - painter.drawRoundedRect( - QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), - radius, - radius); - } + // Widget + painter.setBrush(QBrush("#FFFFFF")); + painter.setRenderHint(QPainter::Antialiasing); + painter.drawRoundedRect( + QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), + radius, + radius); +} diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index c45820858cbdf1e5e403bbf8392468ed7ee6cdf1..0ae2516d7892e60667e84ce051904eea706642b7 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -1,6 +1,6 @@ #include "TextField.h" -#include <QApplication> +#include <QCoreApplication> #include <QEventTransition> #include <QFontDatabase> #include <QPaintEvent> diff --git a/src/ui/ToggleButton.cpp b/src/ui/ToggleButton.cpp index 755f528ffa8c7e0a55b868ca53d5d9625468e0ca..f94114891ffbd70de22dde22a97eba562c792787 100644 --- a/src/ui/ToggleButton.cpp +++ b/src/ui/ToggleButton.cpp @@ -1,5 +1,5 @@ -#include <QApplication> #include <QColor> +#include <QCoreApplication> #include <QEvent> #include <QPainter>