diff --git a/TODO.md b/TODO.md index e426939..02d39d8 100644 --- a/TODO.md +++ b/TODO.md @@ -2,12 +2,6 @@ if ffmpeg/ocio not found, reset path in settings, and search again ## au prochain build -- check default ocio path on win & linux - -- check reset settings pour voir si les chemins (win, linux) sont bien trouvés - -- Check UI win (font size) - - doc: add ociobakelut instruction for macos - build doc diff --git a/src/Renderer/cachemanager.cpp b/src/Renderer/cachemanager.cpp index a5715a8..d02fdcd 100644 --- a/src/Renderer/cachemanager.cpp +++ b/src/Renderer/cachemanager.cpp @@ -29,7 +29,7 @@ CacheManager *CacheManager::instance() void CacheManager::init() { QSettings settings; - QString defaultCachePath = QDir::tempPath() + "/" + qApp->applicationName() + "/"; + QString defaultCachePath = FileUtils::applicationTempPath(); defaultCachePath = QDir::toNativeSeparators(defaultCachePath); QString currentCachePath = settings.value("cachePath", defaultCachePath).toString(); diff --git a/src/UI/Blocks/blockcontentwidget.cpp b/src/UI/Blocks/blockcontentwidget.cpp index 8438ab2..7d9c051 100644 --- a/src/UI/Blocks/blockcontentwidget.cpp +++ b/src/UI/Blocks/blockcontentwidget.cpp @@ -30,7 +30,7 @@ BlockContentWidget::BlockContentWidget(MediaInfo *mediaInfo, QWidget *parent) : _freezeUI = false; } -void BlockContentWidget::activate(bool act) +void BlockContentWidget::activate(bool /*act*/) { } diff --git a/src/UI/mainwindow.cpp b/src/UI/mainwindow.cpp index 122fd20..21b720e 100644 --- a/src/UI/mainwindow.cpp +++ b/src/UI/mainwindow.cpp @@ -182,8 +182,6 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) : connect(ffmpegSettingsWidget,SIGNAL(presetsPathChanged()),queueWidget,SLOT(presetsPathChanged())); log("Init - Setting stylesheet", LogUtils::Debug); - // Set style - duqf_setStyle(); //parse arguments if ffmpeg is valid autoQuit = false; @@ -306,6 +304,9 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) : connect(launchQueueButton, &QToolButton::clicked, this, &MainWindow::go); connect( goButton, &QToolButton::clicked, this, &MainWindow::go ); + // Set style + duqf_setStyle(); + log("Ready!"); } @@ -431,6 +432,8 @@ void MainWindow::duqf_initUi() void MainWindow::duqf_setStyle() { // ======== STYLE ======== + // Font first so it's available in the css + DuUI::setFont(settings.value("appearance/font", "Ubuntu").toString()); //Re-set StyleSheet QString cssFile = settings.value("appearance/cssFile", ":/styles/default").toString(); @@ -444,8 +447,7 @@ void MainWindow::duqf_setStyle() DuUI::updateCSS(""); qApp->setStyle(QStyleFactory::create(style)); } - //and font - DuUI::setFont(settings.value("appearance/font", "Ubuntu").toString()); + //and tool buttons int styleIndex = settings.value("appearance/toolButtonStyle", 2).toInt(); DuUI::setToolButtonStyle(styleIndex); diff --git a/src/duqf-app/app-style.h b/src/duqf-app/app-style.h index deeb91f..8a8befb 100644 --- a/src/duqf-app/app-style.h +++ b/src/duqf-app/app-style.h @@ -2,6 +2,7 @@ #define APPSTYLE_H #include "app-version.h" +#include "duqf-utils/utils.h" #include #include @@ -15,6 +16,7 @@ #include #include + class DuUI { public: @@ -116,39 +118,28 @@ class DuUI return css; } - static void setFont(QString family = "Ubuntu", int size=0) + static void setFont(QString family = "Ubuntu") { if (family == "Ubuntu") { - //add fonts - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-B"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-BI"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-C"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-L"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-LI"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-M"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-MI"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-R"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-RI"); - QFontDatabase::addApplicationFont(":/fonts/Ubuntu-Th"); - QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-B"); - QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-BI"); - QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-R"); - QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-RI"); + //extract fonts + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-B.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-BI.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-C.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-L.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-LI.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-M.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-MI.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-R.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-RI.ttf"); + QFontDatabase::addApplicationFont(":/fonts/Ubuntu-Th.ttf"); + QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-B.ttf"); + QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-BI.ttf"); + QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-R.ttf"); + QFontDatabase::addApplicationFont(":/fonts/UbuntuMono-RI.ttf"); } -#ifdef Q_OS_MAC - if (size == 0) size = 12; -#endif -#ifdef Q_OS_LINUX - if (size ==0) size = 10; -#endif - -#ifdef Q_OS_WIN - //There are strange issues with setting the font size on Win (at least with Qt 5.9.9) + qApp->setFont(QFont(family)); -#else - qApp->setFont(QFont(family,size)); -#endif } static void setToolButtonStyle(int styleIndex) diff --git a/src/duqf-utils/utils.cpp b/src/duqf-utils/utils.cpp index d2e6965..2c0f1f3 100644 --- a/src/duqf-utils/utils.cpp +++ b/src/duqf-utils/utils.cpp @@ -353,3 +353,8 @@ void ProcessUtils::runProcess(QProcess *p, QString binary, QStringList arguments p->start(QIODevice::ReadWrite); } + +QString FileUtils::applicationTempPath() +{ + return QDir::tempPath() + "/" + qApp->applicationName() + "/"; +} diff --git a/src/duqf-utils/utils.h b/src/duqf-utils/utils.h index 008ea39..2e9b0fd 100644 --- a/src/duqf-utils/utils.h +++ b/src/duqf-utils/utils.h @@ -9,9 +9,11 @@ #include #include #include +#include namespace FileUtils { + QString applicationTempPath(); void setReadWrite(QFile *file); void setReadWrite(QString path); void move(QString from, QString to); diff --git a/src/duqf_resources.qrc b/src/duqf_resources.qrc index fa79436..c8ed1ad 100644 --- a/src/duqf_resources.qrc +++ b/src/duqf_resources.qrc @@ -33,19 +33,19 @@ duqf_resources/styles/style-values.rui - duqf_resources/fonts/Ubuntu-B.ttf - duqf_resources/fonts/Ubuntu-BI.ttf - duqf_resources/fonts/Ubuntu-C.ttf - duqf_resources/fonts/Ubuntu-L.ttf - duqf_resources/fonts/Ubuntu-LI.ttf - duqf_resources/fonts/Ubuntu-M.ttf - duqf_resources/fonts/Ubuntu-MI.ttf - duqf_resources/fonts/UbuntuMono-B.ttf - duqf_resources/fonts/UbuntuMono-BI.ttf - duqf_resources/fonts/UbuntuMono-R.ttf - duqf_resources/fonts/UbuntuMono-RI.ttf - duqf_resources/fonts/Ubuntu-R.ttf - duqf_resources/fonts/Ubuntu-RI.ttf - duqf_resources/fonts/Ubuntu-Th.ttf + duqf_resources/fonts/Ubuntu-B.ttf + duqf_resources/fonts/Ubuntu-BI.ttf + duqf_resources/fonts/Ubuntu-C.ttf + duqf_resources/fonts/Ubuntu-L.ttf + duqf_resources/fonts/Ubuntu-LI.ttf + duqf_resources/fonts/Ubuntu-M.ttf + duqf_resources/fonts/Ubuntu-MI.ttf + duqf_resources/fonts/UbuntuMono-B.ttf + duqf_resources/fonts/UbuntuMono-BI.ttf + duqf_resources/fonts/UbuntuMono-R.ttf + duqf_resources/fonts/UbuntuMono-RI.ttf + duqf_resources/fonts/Ubuntu-R.ttf + duqf_resources/fonts/Ubuntu-RI.ttf + duqf_resources/fonts/Ubuntu-Th.ttf diff --git a/src/duqf_resources/styles/style-values.rui b/src/duqf_resources/styles/style-values.rui index e13983b..30da79b 100644 --- a/src/duqf_resources/styles/style-values.rui +++ b/src/duqf_resources/styles/style-values.rui @@ -20,6 +20,10 @@ @color-yellow = #ecd718 @color-light-red = #f96969 +@font-size-small = 9px +@font-size-medium = 12px +@font-size-large = 15px; + @margin = 3px @padding-small = 5px @padding-medium = 7px diff --git a/src/duqf_resources/styles/style.css b/src/duqf_resources/styles/style.css index b22d3fc..a224481 100644 --- a/src/duqf_resources/styles/style.css +++ b/src/duqf_resources/styles/style.css @@ -4,12 +4,9 @@ outline: none; } -MainWindow, QDialog { - background-color: @color-dark-grey; -} - -QWidget { - /*font-weight:400;*/ +MainWindow, QDialog, QWidget { + font-familiy = @font-family; + font-size: @font-size-medium; background-color: @color-dark-grey; }