Update style sheets on palette change
This commit is contained in:
parent
b023c26205
commit
d6e70764c4
|
@ -49,11 +49,7 @@ DbQueryWidget::DbQueryWidget(TagEditorWidget *tagEditorWidget, QWidget *parent)
|
||||||
, m_menu(new QMenu(parent))
|
, m_menu(new QMenu(parent))
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
#ifdef Q_OS_WIN32
|
updateStyleSheet();
|
||||||
setStyleSheet(dialogStyle());
|
|
||||||
#else
|
|
||||||
setStyleSheet(QStringLiteral("QGroupBox { color: palette(text); background-color: palette(base); }"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_ui->notificationLabel->setText(tr("Search hasn't been started"));
|
m_ui->notificationLabel->setText(tr("Search hasn't been started"));
|
||||||
m_ui->notificationLabel->setContext(tr("MusicBrainz/LyricsWikia notifications"));
|
m_ui->notificationLabel->setContext(tr("MusicBrainz/LyricsWikia notifications"));
|
||||||
|
@ -714,6 +710,18 @@ void DbQueryWidget::showLyricsFromIndex(const QModelIndex &index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DbQueryWidget::event(QEvent *event)
|
||||||
|
{
|
||||||
|
const auto res = QWidget::event(event);
|
||||||
|
switch (event->type()) {
|
||||||
|
case QEvent::PaletteChange:
|
||||||
|
updateStyleSheet();
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void DbQueryWidget::clearSearchCriteria()
|
void DbQueryWidget::clearSearchCriteria()
|
||||||
{
|
{
|
||||||
m_ui->titleLineEdit->clear();
|
m_ui->titleLineEdit->clear();
|
||||||
|
@ -722,6 +730,15 @@ void DbQueryWidget::clearSearchCriteria()
|
||||||
m_ui->trackSpinBox->setValue(0);
|
m_ui->trackSpinBox->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbQueryWidget::updateStyleSheet()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
setStyleSheet(dialogStyleForPalette(palette()));
|
||||||
|
#else
|
||||||
|
setStyleSheet(QStringLiteral("QGroupBox { color: palette(text); background-color: palette(base); }"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
|
bool DbQueryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (obj == m_ui->searchGroupBox) {
|
if (obj == m_ui->searchGroupBox) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ public Q_SLOTS:
|
||||||
void clearSearchCriteria();
|
void clearSearchCriteria();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void updateStyleSheet();
|
||||||
void showResults();
|
void showResults();
|
||||||
void setStatus(bool aborted);
|
void setStatus(bool aborted);
|
||||||
void fileStatusChanged(bool opened, bool hasTags);
|
void fileStatusChanged(bool opened, bool hasTags);
|
||||||
|
@ -65,6 +66,7 @@ private Q_SLOTS:
|
||||||
void showLyricsFromIndex(const QModelIndex &index);
|
void showLyricsFromIndex(const QModelIndex &index);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool event(QEvent *event) override;
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -68,10 +68,7 @@ EnterTargetDialog::EnterTargetDialog(QWidget *parent)
|
||||||
{
|
{
|
||||||
// setup UI
|
// setup UI
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
// apply style sheets
|
updateStyleSheet();
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
setStyleSheet(dialogStyle());
|
|
||||||
#endif
|
|
||||||
// setup views
|
// setup views
|
||||||
m_ui->tracksListView->setModel(m_tracksModel);
|
m_ui->tracksListView->setModel(m_tracksModel);
|
||||||
m_ui->chaptersListView->setModel(m_chaptersModel);
|
m_ui->chaptersListView->setModel(m_chaptersModel);
|
||||||
|
@ -91,7 +88,14 @@ EnterTargetDialog::~EnterTargetDialog()
|
||||||
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
||||||
{
|
{
|
||||||
m_ui->levelNameLineEdit->setPlaceholderText(qstringFromStdStringView(
|
m_ui->levelNameLineEdit->setPlaceholderText(qstringFromStdStringView(
|
||||||
i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : std::string_view()));
|
i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : std::string_view()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnterTargetDialog::updateStyleSheet()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
setStyleSheet(dialogStyleForPalette(palette()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TagParser::TagTarget EnterTargetDialog::target() const
|
TagParser::TagTarget EnterTargetDialog::target() const
|
||||||
|
@ -141,4 +145,16 @@ void EnterTargetDialog::setTarget(const TagTarget &target, const MediaFileInfo *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EnterTargetDialog::event(QEvent *event)
|
||||||
|
{
|
||||||
|
const auto res = QDialog::event(event);
|
||||||
|
switch (event->type()) {
|
||||||
|
case QEvent::PaletteChange:
|
||||||
|
updateStyleSheet();
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QtGui
|
} // namespace QtGui
|
||||||
|
|
|
@ -33,8 +33,12 @@ public:
|
||||||
TagParser::TagTarget target() const;
|
TagParser::TagTarget target() const;
|
||||||
void setTarget(const TagParser::TagTarget &target, const TagParser::MediaFileInfo *file = nullptr);
|
void setTarget(const TagParser::TagTarget &target, const TagParser::MediaFileInfo *file = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateLevelNamePlaceholderText(int i);
|
void updateLevelNamePlaceholderText(int i);
|
||||||
|
void updateStyleSheet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::EnterTargetDialog> m_ui;
|
std::unique_ptr<Ui::EnterTargetDialog> m_ui;
|
||||||
|
|
|
@ -76,11 +76,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
{
|
{
|
||||||
// setup UI
|
// setup UI
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
#ifdef Q_OS_WIN32
|
updateStyleSheet();
|
||||||
setStyleSheet(dialogStyle() + QStringLiteral("#tagEditorWidget { color: palette(text); background-color: palette(base); }"));
|
|
||||||
#else
|
|
||||||
setStyleSheet(dialogStyle());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// restore geometry and state
|
// restore geometry and state
|
||||||
const auto &settings = Settings::values();
|
const auto &settings = Settings::values();
|
||||||
|
@ -243,6 +239,9 @@ bool MainWindow::event(QEvent *event)
|
||||||
{
|
{
|
||||||
auto &settings = Settings::values();
|
auto &settings = Settings::values();
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
|
case QEvent::PaletteChange:
|
||||||
|
updateStyleSheet();
|
||||||
|
break;
|
||||||
case QEvent::Close:
|
case QEvent::Close:
|
||||||
if (m_ui->tagEditorWidget->isFileOperationOngoing()) {
|
if (m_ui->tagEditorWidget->isFileOperationOngoing()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -348,6 +347,18 @@ void MainWindow::handleCurrentPathChanged(const QString &newPath)
|
||||||
activateWindow();
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Updates the style sheet.
|
||||||
|
*/
|
||||||
|
void MainWindow::updateStyleSheet()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
setStyleSheet(dialogStyleForPalette(palette()) + QStringLiteral("#tagEditorWidget { color: palette(text); background-color: palette(base); }"));
|
||||||
|
#else
|
||||||
|
setStyleSheet(dialogStyleForPalette(palette()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Spawns an external player for the current file.
|
* \brief Spawns an external player for the current file.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,6 +67,7 @@ private Q_SLOTS:
|
||||||
void showSaveAsDlg();
|
void showSaveAsDlg();
|
||||||
void handleFileStatusChange(bool opened, bool hasTag);
|
void handleFileStatusChange(bool opened, bool hasTag);
|
||||||
void handleCurrentPathChanged(const QString &newPath);
|
void handleCurrentPathChanged(const QString &newPath);
|
||||||
|
void updateStyleSheet();
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
void showNewWindow();
|
void showNewWindow();
|
||||||
|
|
|
@ -601,8 +601,8 @@ void PicturePreviewSelection::convertSelected()
|
||||||
m_imageConversionDialog = new QDialog(this);
|
m_imageConversionDialog = new QDialog(this);
|
||||||
m_imageConversionUI = make_unique<Ui::ImageConversionDialog>();
|
m_imageConversionUI = make_unique<Ui::ImageConversionDialog>();
|
||||||
m_imageConversionUI->setupUi(m_imageConversionDialog);
|
m_imageConversionUI->setupUi(m_imageConversionDialog);
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WINDOWS
|
||||||
m_imageConversionDialog->setStyleSheet(dialogStyle());
|
m_imageConversionDialog->setStyleSheet(dialogStyleForPalette(palette()));
|
||||||
#endif
|
#endif
|
||||||
m_imageConversionUI->formatComboBox->addItems({ tr("JPEG"), tr("PNG") });
|
m_imageConversionUI->formatComboBox->addItems({ tr("JPEG"), tr("PNG") });
|
||||||
m_imageConversionUI->aspectRatioComboBox->addItems({ tr("Ignore"), tr("Keep"), tr("Keep by expanding") });
|
m_imageConversionUI->aspectRatioComboBox->addItems({ tr("Ignore"), tr("Keep"), tr("Keep by expanding") });
|
||||||
|
@ -638,6 +638,22 @@ void PicturePreviewSelection::setCoverButtonsHidden(bool hideCoverButtons)
|
||||||
m_ui->coverButtonsWidget->setHidden(hideCoverButtons);
|
m_ui->coverButtonsWidget->setHidden(hideCoverButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PicturePreviewSelection::event(QEvent *event)
|
||||||
|
{
|
||||||
|
const auto res = QWidget::event(event);
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
switch (event->type()) {
|
||||||
|
case QEvent::PaletteChange:
|
||||||
|
if (m_imageConversionDialog) {
|
||||||
|
m_imageConversionDialog->setStyleSheet(dialogStyleForPalette(palette()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void PicturePreviewSelection::changeEvent(QEvent *event)
|
void PicturePreviewSelection::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
|
|
|
@ -68,6 +68,7 @@ Q_SIGNALS:
|
||||||
void pictureChanged();
|
void pictureChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool event(QEvent *event) override;
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
|
|
|
@ -37,9 +37,7 @@ RenameFilesDialog::RenameFilesDialog(QWidget *parent)
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_QuitOnClose, false);
|
setAttribute(Qt::WA_QuitOnClose, false);
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
#ifdef Q_OS_WIN32
|
updateStyleSheet();
|
||||||
setStyleSheet(dialogStyle() + QStringLiteral("QSplitter:handle { background-color: palette(base); }"));
|
|
||||||
#endif
|
|
||||||
// setup javascript editor and script file selection
|
// setup javascript editor and script file selection
|
||||||
m_ui->javaScriptPlainTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
m_ui->javaScriptPlainTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
m_highlighter = new JavaScriptHighlighter(m_ui->javaScriptPlainTextEdit->document());
|
m_highlighter = new JavaScriptHighlighter(m_ui->javaScriptPlainTextEdit->document());
|
||||||
|
@ -114,6 +112,9 @@ bool RenameFilesDialog::event(QEvent *event)
|
||||||
{
|
{
|
||||||
auto &settings = Settings::values().renamingUtility;
|
auto &settings = Settings::values().renamingUtility;
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
|
case QEvent::PaletteChange:
|
||||||
|
updateStyleSheet();
|
||||||
|
break;
|
||||||
case QEvent::Close:
|
case QEvent::Close:
|
||||||
// save settings
|
// save settings
|
||||||
settings.scriptSource = m_ui->sourceFileStackedWidget->currentIndex();
|
settings.scriptSource = m_ui->sourceFileStackedWidget->currentIndex();
|
||||||
|
@ -402,4 +403,11 @@ void RenameFilesDialog::setScriptModified(bool scriptModified)
|
||||||
m_scriptModified = scriptModified;
|
m_scriptModified = scriptModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenameFilesDialog::updateStyleSheet()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
setStyleSheet(dialogStyleForPalette(palette()) + QStringLiteral("QSplitter:handle { background-color: palette(base); }"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QtGui
|
} // namespace QtGui
|
||||||
|
|
|
@ -52,6 +52,7 @@ private Q_SLOTS:
|
||||||
void abortClose();
|
void abortClose();
|
||||||
void toggleScriptSource();
|
void toggleScriptSource();
|
||||||
void setScriptModified(bool scriptModified);
|
void setScriptModified(bool scriptModified);
|
||||||
|
void updateStyleSheet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::RenameFilesDialog> m_ui;
|
std::unique_ptr<Ui::RenameFilesDialog> m_ui;
|
||||||
|
|
Loading…
Reference in New Issue