summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Logging.cpp17
-rw-r--r--src/UserSettingsPage.cpp38
-rw-r--r--src/dialogs/UserProfile.cpp19
-rw-r--r--src/timeline/TimelineViewManager.cpp33
4 files changed, 59 insertions, 48 deletions
diff --git a/src/Logging.cpp b/src/Logging.cpp

index 5d64a630..b63c2e5a 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp
@@ -25,11 +25,18 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri const char *file = context.file ? context.file : ""; const char *function = context.function ? context.function : ""; - // Surpress binding wrning for now, as we can't set restore mode to keep compat with qt 5.10 - if (msg.endsWith( - "QML Binding: Not restoring previous value because restoreMode has not been set.This " - "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " - "6.0 the default is Binding.RestoreBindingOrValue.")) + if ( + // Surpress binding wrning for now, as we can't set restore mode to keep compat with + // qt 5.10 + msg.endsWith( + "QML Binding: Not restoring previous value because restoreMode has not been set.This " + "behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= " + "6.0 the default is Binding.RestoreBindingOrValue.") || + // The default style has the point size set. If you use pixel size anywhere, you get + // that warning, which is useless, since sometimes you need the pixel size to match the + // text to the size of the outer element for example. This is done in the avatar and + // without that you get one warning for every Avatar displayed, which is stupid! + msg.endsWith("Both point size and pixel size set. Using pixel size.")) return; switch (type) { diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 6cd9a95c..3afff83b 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp
@@ -103,12 +103,46 @@ UserSettings::applyTheme() { QFile stylefile; - if (theme() == "light") { + static QPalette original; + if (this->theme() == "light") { stylefile.setFileName(":/styles/styles/nheko.qss"); - } else if (theme() == "dark") { + QPalette lightActive( + /*windowText*/ QColor("#333"), + /*button*/ QColor("#333"), + /*light*/ QColor(0xef, 0xef, 0xef), + /*dark*/ QColor(220, 220, 220), + /*mid*/ QColor(0, 0xff, 0), // not used anywhere, this is for debugging + /*text*/ QColor("#333"), + /*bright_text*/ QColor("#333"), + /*base*/ QColor("white"), + /*window*/ QColor("white")); + lightActive.setColor(QPalette::Highlight, QColor("#38a3d8")); + lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color()); + lightActive.setColor(QPalette::ToolTipText, lightActive.text().color()); + lightActive.setColor(QPalette::Link, QColor("#0077b5")); + lightActive.setColor(QPalette::ButtonText, QColor("gray")); + QApplication::setPalette(lightActive); + } else if (this->theme() == "dark") { stylefile.setFileName(":/styles/styles/nheko-dark.qss"); + QPalette darkActive( + /*windowText*/ QColor("#caccd1"), + /*button*/ QColor(0xff, 0xff, 0xff), + /*light*/ QColor("#caccd1"), + /*dark*/ QColor("#2d3139"), + /*mid*/ QColor(0, 0xff, 0), // not used anywhere, this is for debugging + /*text*/ QColor("#caccd1"), + /*bright_text*/ QColor(0xff, 0xff, 0xff), + /*base*/ QColor("#2d3139"), + /*window*/ QColor("#202228")); + darkActive.setColor(QPalette::Highlight, QColor("#38a3d8")); + darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color()); + darkActive.setColor(QPalette::ToolTipText, darkActive.text().color()); + darkActive.setColor(QPalette::Link, QColor("#38a3d8")); + darkActive.setColor(QPalette::ButtonText, QColor(77, 77, 77)); + QApplication::setPalette(darkActive); } else { stylefile.setFileName(":/styles/styles/system.qss"); + QApplication::setPalette(original); } stylefile.open(QFile::ReadOnly); diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp
index f1dd77df..3415b127 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp
@@ -142,8 +142,6 @@ UserProfile::UserProfile(QWidget *parent) devices_->setSelectionMode(QAbstractItemView::NoSelection); devices_->setAttribute(Qt::WA_MacShowFocusRect, 0); devices_->setSpacing(DEVICE_SPACING); - devices_->setMinimumHeight(devices_->sizeHint().height() * 1.2); - devices_->hide(); QFont descriptionLabelFont; descriptionLabelFont.setWeight(65); @@ -151,6 +149,7 @@ UserProfile::UserProfile(QWidget *parent) devicesLabel_ = new QLabel(tr("Devices").toUpper(), this); devicesLabel_->setFont(descriptionLabelFont); devicesLabel_->hide(); + devicesLabel_->setFixedSize(devicesLabel_->sizeHint()); auto okBtn = new QPushButton("OK", this); @@ -160,29 +159,24 @@ UserProfile::UserProfile(QWidget *parent) closeLayout->addWidget(okBtn); auto vlayout = new QVBoxLayout{this}; - vlayout->addWidget(avatar_); + vlayout->addWidget(avatar_, 0, Qt::AlignCenter | Qt::AlignTop); vlayout->addLayout(textLayout); vlayout->addLayout(btnLayout); - vlayout->addWidget(devicesLabel_, Qt::AlignLeft); - vlayout->addWidget(devices_); + vlayout->addWidget(devicesLabel_, 0, Qt::AlignLeft); + vlayout->addWidget(devices_, 1); vlayout->addLayout(closeLayout); - vlayout->addStretch(1); - - vlayout->setAlignment(avatar_, Qt::AlignCenter | Qt::AlignTop); - vlayout->setAlignment(userIdLabel_, Qt::AlignCenter | Qt::AlignTop); QFont largeFont; largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5); setMinimumWidth( std::max(devices_->sizeHint().width() + 4 * WIDGET_MARGIN, conf::window::minModalWidth)); - setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); vlayout->setSpacing(WIDGET_SPACING); vlayout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN); - static auto ignored = qRegisterMetaType<std::vector<DeviceInfo>>(); - (void)ignored; + qRegisterMetaType<std::vector<DeviceInfo>>(); auto closeShortcut = new QShortcut(QKeySequence(QKeySequence::Cancel), this); connect(closeShortcut, &QShortcut::activated, this, &UserProfile::close); @@ -307,4 +301,5 @@ UserProfile::updateDeviceList(const QString &user_id, const std::vector<DeviceIn devicesLabel_->show(); devices_->show(); + adjustSize(); } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index eead46a2..794c13aa 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp
@@ -22,36 +22,11 @@ TimelineViewManager::updateColorPalette() userColors.clear(); if (settings->theme() == "light") { - QPalette lightActive(/*windowText*/ QColor("#333"), - /*button*/ QColor("#333"), - /*light*/ QColor(), - /*dark*/ QColor(220, 220, 220), - /*mid*/ QColor(), - /*text*/ QColor("#333"), - /*bright_text*/ QColor(), - /*base*/ QColor(220, 220, 220), - /*window*/ QColor("white")); - lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color()); - lightActive.setColor(QPalette::ToolTipText, lightActive.text().color()); - lightActive.setColor(QPalette::Link, QColor("#0077b5")); - view->rootContext()->setContextProperty("currentActivePalette", lightActive); - view->rootContext()->setContextProperty("currentInactivePalette", lightActive); + view->rootContext()->setContextProperty("currentActivePalette", QPalette()); + view->rootContext()->setContextProperty("currentInactivePalette", QPalette()); } else if (settings->theme() == "dark") { - QPalette darkActive(/*windowText*/ QColor("#caccd1"), - /*button*/ QColor("#caccd1"), - /*light*/ QColor(), - /*dark*/ QColor("#2d3139"), - /*mid*/ QColor(), - /*text*/ QColor("#caccd1"), - /*bright_text*/ QColor(), - /*base*/ QColor("#2d3139"), - /*window*/ QColor("#202228")); - darkActive.setColor(QPalette::Highlight, QColor("#e7e7e9")); - darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color()); - darkActive.setColor(QPalette::ToolTipText, darkActive.text().color()); - darkActive.setColor(QPalette::Link, QColor("#38a3d8")); - view->rootContext()->setContextProperty("currentActivePalette", darkActive); - view->rootContext()->setContextProperty("currentInactivePalette", darkActive); + view->rootContext()->setContextProperty("currentActivePalette", QPalette()); + view->rootContext()->setContextProperty("currentInactivePalette", QPalette()); } else { view->rootContext()->setContextProperty("currentActivePalette", QPalette()); view->rootContext()->setContextProperty("currentInactivePalette", nullptr);