From 2f6f55c2bb356d83d63014d8167be2f7539c2130 Mon Sep 17 00:00:00 2001 From: namedkitten Date: Wed, 6 May 2020 13:41:18 +0100 Subject: [PATCH] Tidy up some code. --- .travis.yml | 2 +- CMakeLists.txt | 6 ---- src/Backends/MPV/MPVBackend.cpp | 2 +- src/logger.cpp | 9 ++++-- src/qml/MainMenu.qml | 50 +++++++++++++++------------------ 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5072ac4..5340e99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ before_install: - sudo apt-get update install: - - sudo apt-get -y install ccache build-essential git qt512-meta-minimal qt512quickcontrols qt512quickcontrols2 qt512svg qt512x11extras qt512graphicaleffects qt512svg libgl1-mesa-dev libmpv-dev libgl1-mesa-dev x11proto-xext-dev libx11-dev python3-setuptools + - sudo apt-get -y install build-essential git qt512-meta-minimal qt512quickcontrols qt512quickcontrols2 qt512svg qt512x11extras qt512graphicaleffects qt512svg libgl1-mesa-dev libmpv-dev libgl1-mesa-dev x11proto-xext-dev libx11-dev python3-setuptools - sudo apt-get build-dep mpv - source /opt/qt*/bin/qt*-env.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 04bf5e5..a2b0722 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,12 +69,6 @@ set(SOURCES ${SOURCES} ) -find_program(CCACHE_FOUND cache) -if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) -endif(CCACHE_FOUND) - set(CMAKE_BUILD_TYPE DEBUG) option(DEBUG "debugging out" OFF) diff --git a/src/Backends/MPV/MPVBackend.cpp b/src/Backends/MPV/MPVBackend.cpp index e44596d..3f295d9 100644 --- a/src/Backends/MPV/MPVBackend.cpp +++ b/src/Backends/MPV/MPVBackend.cpp @@ -151,7 +151,7 @@ MPVBackend::MPVBackend(QQuickItem* parent) QSettings settings; usedirect = settings.value("Backend/direct", false).toBool(); - mpv_set_option_string(mpv, "terminal", "false"); + mpv_set_option_string(mpv, "terminal", "true"); mpv_set_option_string(mpv, "msg-level", "all=v"); // Fix? diff --git a/src/logger.cpp b/src/logger.cpp index 0b7da85..73a8483 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -27,12 +27,17 @@ initLogger(std::string name) QString logFile = settings.value("Logging/logFile", "/tmp/KittehPlayer.log").toString(); std::vector sinks; + + sinks.push_back(std::make_shared()); - sinks.push_back(std::make_shared( - logFile.toUtf8().constData())); + auto fileLogger = std::make_shared(logFile.toUtf8().constData()); + fileLogger->set_level(spdlog::level::trace); + sinks.push_back(fileLogger); auto console = std::make_shared(name, begin(sinks), end(sinks)); console->set_pattern("[%l][%n] %v%$"); spdlog::register_logger(console); + console->set_level(spdlog::level::debug); + return spdlog::get(name); } diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml index fb11d2f..0bda632 100644 --- a/src/qml/MainMenu.qml +++ b/src/qml/MainMenu.qml @@ -48,34 +48,28 @@ MenuBar { trackLang = trackLang == undefined ? "" : trackLang var trackTitle = track["title"] == undefined ? "" : track["title"] + " " var component = Qt.createComponent("TrackItem.qml") + var menu, menuGroup, itemText, type; if (trackType == "sub") { - var action = component.createObject(subMenu, { - "text": trackLang, - "trackID": String(trackID), - "trackType": "sid", - "checked": track["selected"] - }) - action.ActionGroup.group = subMenuGroup - subMenu.addAction(action) + menu = subMenu; + menuGroup = subMenuGroup; + itemText = trackLang; } else if (trackType == "audio") { - var action = component.createObject(audioMenu, { - "text": trackTitle + trackLang, - "trackID": String(trackID), - "trackType": "aid", - "checked": track["selected"] - }) - action.ActionGroup.group = audioMenuGroup - audioMenu.addAction(action) + menu = audioMenu; + menuGroup = audioMenuGroup; + itemText = trackTitle + trackLang; } else if (trackType == "video") { - var action = component.createObject(videoMenu, { - "text": "Video " + trackID + trackTitle, - "trackID": String(trackID), - "trackType": "vid", - "checked": track["selected"] - }) - action.ActionGroup.group = videoMenuGroup - videoMenu.addAction(action) + menu = videoMenu; + menuGroup = videoMenuGroup; + itemText = "Video " + trackID + trackTitle; } + var action = component.createObject(menu, { + "text": itemText, + "trackID": String(trackID), + "trackType": trackType == "sub" ? "sid" : trackType == "video" ? "vid" : "aid", + "checked": track["selected"] + }) + action.ActionGroup.group = menuGroup + videoMenu.addAction(action) } } @@ -330,9 +324,11 @@ MenuBar { audioDeviceMenu.addAction(action) } } - - ActionGroup { - id: audioDeviceMenuGroup + ScrollView { + clip: true + ActionGroup { + id: audioDeviceMenuGroup + } } }