From 290be3df353488e6801dcd422ec391323d6b4ace Mon Sep 17 00:00:00 2001 From: namedkitten Date: Sat, 25 Apr 2020 00:21:55 +0100 Subject: [PATCH] Remove unneeded imports, making compile 1.1x faster and making startup 2.7x faster --- src/qml/ControlsBar.qml | 4 ---- src/qml/Dialogs/PlaylistDialog.qml | 2 -- src/qml/Items/AudioDeviceItem.qml | 2 -- src/qml/Items/ChapterMarkerItem.qml | 3 --- src/qml/Items/CustomMenuItem.qml | 1 - src/qml/Items/ThumbnailProcess.qml | 6 ------ src/qml/Items/TitleProcess.qml | 6 ------ src/qml/Items/TrackItem.qml | 2 -- src/qml/MainMenu.qml | 2 -- src/qml/SubtitlesBar.qml | 4 ---- src/qml/UIComponents/BackwardButton.qml | 7 ------ src/qml/UIComponents/ForwardButton.qml | 7 ------ src/qml/UIComponents/FullscreenButton.qml | 10 --------- src/qml/UIComponents/MenuTitleBar.qml | 2 -- src/qml/UIComponents/PlayPauseButton.qml | 6 ------ src/qml/UIComponents/PlaylistNextButton.qml | 7 ------ src/qml/UIComponents/PlaylistPrevButton.qml | 6 ------ src/qml/UIComponents/SettingsButton.qml | 24 +++++++++++---------- src/qml/UIComponents/SmoothButton.qml | 6 ------ src/qml/UIComponents/SpeedText.qml | 5 ----- src/qml/UIComponents/TimeLabel.qml | 7 ------ src/qml/UIComponents/VerticalVolume.qml | 5 ----- src/qml/UIComponents/VideoProgress.qml | 7 +----- src/qml/UIComponents/VolumeButton.qml | 6 ------ src/qml/UIComponents/VolumeSlider.qml | 6 ------ src/qml/Utils/Translator.qml | 2 -- src/qml/main.qml | 24 +++++++++------------ version | 1 + 28 files changed, 25 insertions(+), 145 deletions(-) create mode 100644 version diff --git a/src/qml/ControlsBar.qml b/src/qml/ControlsBar.qml index 355c6c1..c05d131 100644 --- a/src/qml/ControlsBar.qml +++ b/src/qml/ControlsBar.qml @@ -1,10 +1,6 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Item { diff --git a/src/qml/Dialogs/PlaylistDialog.qml b/src/qml/Dialogs/PlaylistDialog.qml index 3b3fa1c..dd678c2 100644 --- a/src/qml/Dialogs/PlaylistDialog.qml +++ b/src/qml/Dialogs/PlaylistDialog.qml @@ -2,8 +2,6 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 import QtQuick.Dialogs 1.3 import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Dialog { diff --git a/src/qml/Items/AudioDeviceItem.qml b/src/qml/Items/AudioDeviceItem.qml index b2f5f63..450ccf1 100644 --- a/src/qml/Items/AudioDeviceItem.qml +++ b/src/qml/Items/AudioDeviceItem.qml @@ -1,6 +1,4 @@ -import QtQuick 2.0 import QtQuick.Controls 2.3 -import Qt.labs.settings 1.0 import player 1.0 Action { diff --git a/src/qml/Items/ChapterMarkerItem.qml b/src/qml/Items/ChapterMarkerItem.qml index 5609f0f..71670f1 100644 --- a/src/qml/Items/ChapterMarkerItem.qml +++ b/src/qml/Items/ChapterMarkerItem.qml @@ -1,7 +1,4 @@ import QtQuick 2.0 -import QtQuick.Controls 2.3 -import Qt.labs.settings 1.0 -import player 1.0 Rectangle { id: chapterMarker diff --git a/src/qml/Items/CustomMenuItem.qml b/src/qml/Items/CustomMenuItem.qml index 87bf205..588049e 100644 --- a/src/qml/Items/CustomMenuItem.qml +++ b/src/qml/Items/CustomMenuItem.qml @@ -1,6 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import Qt.labs.settings 1.0 MenuItem { id: menuItem diff --git a/src/qml/Items/ThumbnailProcess.qml b/src/qml/Items/ThumbnailProcess.qml index d268123..8d1ad2a 100644 --- a/src/qml/Items/ThumbnailProcess.qml +++ b/src/qml/Items/ThumbnailProcess.qml @@ -1,9 +1,3 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Process { diff --git a/src/qml/Items/TitleProcess.qml b/src/qml/Items/TitleProcess.qml index 11bb9d3..47ef97d 100644 --- a/src/qml/Items/TitleProcess.qml +++ b/src/qml/Items/TitleProcess.qml @@ -1,9 +1,3 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Process { diff --git a/src/qml/Items/TrackItem.qml b/src/qml/Items/TrackItem.qml index 81e0017..76df324 100644 --- a/src/qml/Items/TrackItem.qml +++ b/src/qml/Items/TrackItem.qml @@ -1,6 +1,4 @@ -import QtQuick 2.0 import QtQuick.Controls 2.3 -import Qt.labs.settings 1.0 import player 1.0 Action { diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml index 9f85aa8..8218581 100644 --- a/src/qml/MainMenu.qml +++ b/src/qml/MainMenu.qml @@ -1,8 +1,6 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 import QtQuick.Dialogs 1.3 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 diff --git a/src/qml/SubtitlesBar.qml b/src/qml/SubtitlesBar.qml index cffe712..17c9593 100644 --- a/src/qml/SubtitlesBar.qml +++ b/src/qml/SubtitlesBar.qml @@ -1,10 +1,6 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Item { diff --git a/src/qml/UIComponents/BackwardButton.qml b/src/qml/UIComponents/BackwardButton.qml index 4d8cf28..09fc396 100644 --- a/src/qml/UIComponents/BackwardButton.qml +++ b/src/qml/UIComponents/BackwardButton.qml @@ -1,10 +1,3 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/ForwardButton.qml b/src/qml/UIComponents/ForwardButton.qml index 608feb5..9077287 100644 --- a/src/qml/UIComponents/ForwardButton.qml +++ b/src/qml/UIComponents/ForwardButton.qml @@ -1,10 +1,3 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/FullscreenButton.qml b/src/qml/UIComponents/FullscreenButton.qml index a9fd6cf..f555341 100644 --- a/src/qml/UIComponents/FullscreenButton.qml +++ b/src/qml/UIComponents/FullscreenButton.qml @@ -1,15 +1,5 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform -import player 1.0 - SmoothButton { iconSource: "icons/" + appearance.themeName + "/fullscreen.svg" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight onClicked: { toggleFullscreen() } diff --git a/src/qml/UIComponents/MenuTitleBar.qml b/src/qml/UIComponents/MenuTitleBar.qml index adb8df7..9fd2e95 100644 --- a/src/qml/UIComponents/MenuTitleBar.qml +++ b/src/qml/UIComponents/MenuTitleBar.qml @@ -1,7 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 Item { diff --git a/src/qml/UIComponents/PlayPauseButton.qml b/src/qml/UIComponents/PlayPauseButton.qml index 5983ee0..85063ed 100644 --- a/src/qml/UIComponents/PlayPauseButton.qml +++ b/src/qml/UIComponents/PlayPauseButton.qml @@ -1,10 +1,4 @@ import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/PlaylistNextButton.qml b/src/qml/UIComponents/PlaylistNextButton.qml index 7c620b3..3ac3a29 100644 --- a/src/qml/UIComponents/PlaylistNextButton.qml +++ b/src/qml/UIComponents/PlaylistNextButton.qml @@ -1,10 +1,3 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/PlaylistPrevButton.qml b/src/qml/UIComponents/PlaylistPrevButton.qml index c878d6a..4b97339 100644 --- a/src/qml/UIComponents/PlaylistPrevButton.qml +++ b/src/qml/UIComponents/PlaylistPrevButton.qml @@ -1,10 +1,4 @@ import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/SettingsButton.qml b/src/qml/UIComponents/SettingsButton.qml index 9002d36..7d64f6d 100644 --- a/src/qml/UIComponents/SettingsButton.qml +++ b/src/qml/UIComponents/SettingsButton.qml @@ -1,19 +1,21 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { id: settingsButton iconSource: "icons/" + appearance.themeName + "/settings.svg" - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight onClicked: { - var aptn = appearance.themeName - appearance.themeName = aptn == "YouTube" ? "RoosterTeeth" : aptn - == "RoosterTeeth" ? "Niconico" : "YouTube" + switch(appearance.themeName) { + case "YouTube": + appearance.themeName = "RoosterTeeth" + break + case "RoosterTeeth": + appearance.themeName = "Niconico" + break + case "Niconico": + appearance.themeName = "YouTube" + break + default: + appearance.themeName = "YouTube" + } } } diff --git a/src/qml/UIComponents/SmoothButton.qml b/src/qml/UIComponents/SmoothButton.qml index 9cd0a81..480b11e 100644 --- a/src/qml/UIComponents/SmoothButton.qml +++ b/src/qml/UIComponents/SmoothButton.qml @@ -1,13 +1,7 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 import QtGraphicalEffects 1.0 -import QtQuick 2.0 - Control { id: root hoverEnabled: true diff --git a/src/qml/UIComponents/SpeedText.qml b/src/qml/UIComponents/SpeedText.qml index de7ce5d..4832642 100644 --- a/src/qml/UIComponents/SpeedText.qml +++ b/src/qml/UIComponents/SpeedText.qml @@ -1,10 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Text { diff --git a/src/qml/UIComponents/TimeLabel.qml b/src/qml/UIComponents/TimeLabel.qml index f834dec..24d1944 100644 --- a/src/qml/UIComponents/TimeLabel.qml +++ b/src/qml/UIComponents/TimeLabel.qml @@ -1,15 +1,8 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform -import player 1.0 Text { id: timeLabel - objectName: "timeLabel" text: "0:00 / 0:00" color: "white" font.family: appearance.fontName diff --git a/src/qml/UIComponents/VerticalVolume.qml b/src/qml/UIComponents/VerticalVolume.qml index 958cc43..3c254e9 100644 --- a/src/qml/UIComponents/VerticalVolume.qml +++ b/src/qml/UIComponents/VerticalVolume.qml @@ -1,10 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Rectangle { diff --git a/src/qml/UIComponents/VideoProgress.qml b/src/qml/UIComponents/VideoProgress.qml index 632384f..1af92c5 100644 --- a/src/qml/UIComponents/VideoProgress.qml +++ b/src/qml/UIComponents/VideoProgress.qml @@ -1,10 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 Slider { @@ -40,7 +35,7 @@ Slider { onPlayStatusChanged: function (status) { if (status == Enums.PlayStatus.Playing) { progressBar.playing = true - } else if (status == status == Enums.PlayStatus.Paused) { + } else if (status == Enums.PlayStatus.Paused) { progressBar.playing = false } } diff --git a/src/qml/UIComponents/VolumeButton.qml b/src/qml/UIComponents/VolumeButton.qml index b109667..237e09f 100644 --- a/src/qml/UIComponents/VolumeButton.qml +++ b/src/qml/UIComponents/VolumeButton.qml @@ -1,10 +1,4 @@ import QtQuick 2.0 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 SmoothButton { diff --git a/src/qml/UIComponents/VolumeSlider.qml b/src/qml/UIComponents/VolumeSlider.qml index 424a514..cee9747 100644 --- a/src/qml/UIComponents/VolumeSlider.qml +++ b/src/qml/UIComponents/VolumeSlider.qml @@ -1,11 +1,5 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform -import player 1.0 Slider { id: volumeBar diff --git a/src/qml/Utils/Translator.qml b/src/qml/Utils/Translator.qml index 88c06c6..8e0d061 100644 --- a/src/qml/Utils/Translator.qml +++ b/src/qml/Utils/Translator.qml @@ -1,6 +1,4 @@ import QtQuick 2.0 -import Qt.labs.settings 1.0 - import "translations.js" as Translations Item { diff --git a/src/qml/main.qml b/src/qml/main.qml index 084e2ae..af97bdf 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -1,14 +1,9 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import Qt.labs.settings 1.0 -import Qt.labs.platform 1.0 as LabsPlatform import player 1.0 -import "codes.js" as LanguageCodes - Window { id: mainWindow title: "KittehPlayer" @@ -30,15 +25,16 @@ Window { } function getAppearanceValueForTheme(themeName, name) { - if (themeName == "YouTube") { - return youTubeAppearance[name] - } else if (themeName == "Niconico") { - return nicoNicoAppearance[name] - } else if (themeName == "RoosterTeeth") { - return roosterTeethAppearance[name] - } else { - appearance.themeName = "YouTube" - return youTubeAppearance[name] + switch(themeName) { + case"YouTube": + return youTubeAppearance[name] + case "Niconico": + return nicoNicoAppearance[name] + case "RoosterTeeth": + return roosterTeethAppearance[name] + default: + appearance.themeName = "YouTube" + return youTubeAppearance[name] } } diff --git a/version b/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/version @@ -0,0 +1 @@ +1