From: Jean-Baptiste Mardelle Date: Fri, 9 Oct 2009 19:54:23 +0000 (+0000) Subject: New: change application color scheme (Settings->themes) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ddd090ccd267add7bba7eafe28438d3fc1606915;p=kdenlive New: change application color scheme (Settings->themes) svn path=/trunk/kdenlive/; revision=4025 --- diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index cd49a86b..74bb73ff 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -143,7 +143,7 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscen QPen pen1 = QPen(); pen1.setWidth(1); - pen1.setColor(Qt::black); + pen1.setColor(palette().text().color()); m_cursorLine->setPen(pen1); m_cursorLine->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); diff --git a/src/kdenliveui.rc b/src/kdenliveui.rc index cfe35999..bbeafd6c 100644 --- a/src/kdenliveui.rc +++ b/src/kdenliveui.rc @@ -1,6 +1,6 @@ - + Extra Toolbar @@ -131,6 +131,8 @@ + Themes + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 08b5afb4..7d71aeeb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -88,6 +88,7 @@ #include #include #include +#include #include @@ -249,8 +250,23 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent m_clipMonitor->setupMenu(static_cast(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast(factory()->container("marker_menu", this))); m_projectList->setupGeneratorMenu(static_cast(factory()->container("generators", this)), static_cast(factory()->container("transcoders", this))); - // build effects menus QAction *action; + // build themes menus + QMenu *themesMenu = static_cast(factory()->container("themes_menu", this)); + action = new QAction(i18n("Default"), this); + themesMenu->addAction(action); + fprintf(stderr, "THEMES: %s\n", KStandardDirs::installPath("data").toUtf8().data()); + KGlobal::dirs()->addResourceDir("themes", KStandardDirs::installPath("data") + QString("kdenlive/themes")); + QStringList themes = KGlobal::dirs()->findAllResources("themes", QString(), KStandardDirs::Recursive | KStandardDirs::NoDuplicates); + for (QStringList::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it) { + QFileInfo fi(*it); + action = new QAction(fi.fileName(), this); + action->setData(*it); + themesMenu->addAction(action); + } + connect(themesMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotChangePalette(QAction*))); + + // build effects menus QMenu *videoEffectsMenu = static_cast(factory()->container("video_effects_menu", this)); QStringList effectInfo; @@ -688,7 +704,7 @@ void MainWindow::setupActions() toolbar->setMovable(false); m_toolGroup = new QActionGroup(this); statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize())); - QString style1 = "QToolBar { border: 0px } QToolButton {background-color: rgba(230, 230, 230, 220); border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}"; + QString style1 = "QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}"; m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this); m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s")); @@ -2903,4 +2919,82 @@ void MainWindow::slotUpdateTrackInfo() m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList()); } +void MainWindow::slotChangePalette(QAction *action) +{ + // Load the theme file + QString theme = action->data().toString(); + + // Make palette for all widgets. + QPalette plt; + if (theme.isEmpty()) + plt = QApplication::desktop()->palette(); + else { + KConfig confFile(theme, KConfig::SimpleConfig); + plt = kapp->palette(); + int h, s, v; + const QColor fg(confFile.entryMap().value("TextRegularColor")); + const QColor bg(confFile.entryMap().value("BaseColor")); + + bg.getHsv(&h, &s, &v); + v += (v < 128) ? + 50 : -50; + v &= 255; //ensures 0 <= v < 256 + const QColor highlight = QColor::fromHsv(h, s, v); + + fg.getHsv(&h, &s, &v); + v += (v < 128) ? + 150 : -150; + v &= 255; //ensures 0 <= v < 256 + const QColor alternate = QColor::fromHsv(h, s, v); + + plt.setColor(QPalette::Active, QPalette::Base, bg); + plt.setColor(QPalette::Active, QPalette::AlternateBase, alternate); + plt.setColor(QPalette::Active, QPalette::Background, bg.dark(115)); + plt.setColor(QPalette::Active, QPalette::Foreground, fg); + plt.setColor(QPalette::Active, QPalette::Highlight, highlight); + plt.setColor(QPalette::Active, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor")); + plt.setColor(QPalette::Active, QPalette::Dark, Qt::darkGray); + plt.setColor(QPalette::Active, QPalette::Button, bg); + plt.setColor(QPalette::Active, QPalette::ButtonText, fg); + plt.setColor(QPalette::Active, QPalette::Text, fg); + plt.setColor(QPalette::Active, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor")); + plt.setColor(QPalette::Active, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor")); + + plt.setColor(QPalette::Inactive, QPalette::Base, bg); + plt.setColor(QPalette::Inactive, QPalette::AlternateBase, alternate); + plt.setColor(QPalette::Inactive, QPalette::Background, bg.dark(115)); + plt.setColor(QPalette::Inactive, QPalette::Foreground, fg); + plt.setColor(QPalette::Inactive, QPalette::Highlight, highlight); + plt.setColor(QPalette::Inactive, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor")); + plt.setColor(QPalette::Inactive, QPalette::Dark, Qt::darkGray); + plt.setColor(QPalette::Inactive, QPalette::Button, bg); + plt.setColor(QPalette::Inactive, QPalette::ButtonText, fg); + plt.setColor(QPalette::Inactive, QPalette::Text, fg); + plt.setColor(QPalette::Inactive, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor")); + plt.setColor(QPalette::Inactive, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor")); + + plt.setColor(QPalette::Disabled, QPalette::Base, bg); + plt.setColor(QPalette::Disabled, QPalette::AlternateBase, alternate); + plt.setColor(QPalette::Disabled, QPalette::Background, bg.dark(115)); + plt.setColor(QPalette::Disabled, QPalette::Foreground, fg); + plt.setColor(QPalette::Disabled, QPalette::Highlight, highlight); + plt.setColor(QPalette::Disabled, QPalette::HighlightedText, confFile.entryMap().value("TextSelectedColor")); + plt.setColor(QPalette::Disabled, QPalette::Dark, Qt::darkGray); + plt.setColor(QPalette::Disabled, QPalette::Button, bg); + plt.setColor(QPalette::Disabled, QPalette::ButtonText, fg); + plt.setColor(QPalette::Disabled, QPalette::Text, fg); + plt.setColor(QPalette::Disabled, QPalette::Link, confFile.entryMap().value("TextSpecialRegularColor")); + plt.setColor(QPalette::Disabled, QPalette::LinkVisited, confFile.entryMap().value("TextSpecialSelectedColor")); + + /* + cg.setColor(QColorGroup::Light, ThemeEngine::instance()->textRegColor()); + cg.setColor(QColorGroup::Midlight, ThemeEngine::instance()->textRegColor()); + cg.setColor(QColorGroup::Mid, ThemeEngine::instance()->textRegColor()); + cg.setColor(QColorGroup::Shadow, ThemeEngine::instance()->textRegColor()); + */ + } + + kapp->setPalette(plt); +} + + #include "mainwindow.moc" + diff --git a/src/mainwindow.h b/src/mainwindow.h index 12d22c23..c9ed8822 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -203,7 +203,6 @@ private: QByteArray m_timelineState; void loadTranscoders(); - public slots: void openFile(const KUrl &url); void slotGotProgressInfo(const QString &message, int progress); @@ -320,6 +319,8 @@ private slots: void slotRevert(); void slotShutdown(); void slotUpdateTrackInfo(); + /** \brief Change color scheme */ + void slotChangePalette(QAction *action); signals: Q_SCRIPTABLE void abortRenderJob(const QString &url); diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index 84a7ecf7..98234d2e 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #if KDE_IS_VERSION(4,2,0) #include @@ -254,6 +255,7 @@ QPixmap RecMonitor::mergeSideBySide(const QPixmap& pix, const QString txt) res.fill(Qt::transparent); p.begin(&res); p.drawPixmap(0, 0, pix); + p.setPen(kapp->palette().text().color()); p.drawText(QRect(pixWidth + 8, 0, strWidth, strHeight), 0, txt); p.end(); return res; diff --git a/src/widgets/effectlist_ui.ui b/src/widgets/effectlist_ui.ui index 7b9b8449..3cd5c58c 100644 --- a/src/widgets/effectlist_ui.ui +++ b/src/widgets/effectlist_ui.ui @@ -1,7 +1,8 @@ - + + EffectList_UI - - + + 0 0 @@ -9,92 +10,90 @@ 296 - - - + + + - + All - + Video - + Audio - + Custom - - + + - - - + + + true - + - - - + + + Qt::Vertical - - - QFrame::StyledPanel + + + QFrame::NoFrame - + QFrame::Raised - - - + + + 0 0 - + QFrame::StyledPanel - + QFrame::Raised - + - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + true - type_combo - search_effect - buttonInfo - effectlistframe - infopanel - infopanel - splitter + + KLineEdit + QLineEdit +
klineedit.h
+
KComboBox QComboBox @@ -106,6 +105,11 @@
klistwidgetsearchline.h
+ + type_combo + search_effect + buttonInfo +