Initial commit

parents
cmake_minimum_required(VERSION 3.5)
project(ReproductorMultimedia LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(Qt5 COMPONENTS Multimedia REQUIRED)
find_package(Qt5 COMPONENTS MultimediaWidgets REQUIRED)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
playlistmodel.h
playlistmodel.cpp
videowidget.h
videowidget.cpp
assets.qrc
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(ReproductorMultimedia
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET ReproductorMultimedia APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(ReproductorMultimedia SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(ReproductorMultimedia
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(ReproductorMultimedia PRIVATE Qt5::Widgets Qt5::Multimedia Qt5::MultimediaWidgets)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 7.0.1, 2022-05-23T04:34:40. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{1636bb3f-4b97-40db-b2ec-5b6e7867ed04}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">6</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win64_mingw81_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="CMake.Build.Type">Debug</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="CMake.Build.Type">Release</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="CMake.Build.Type">RelWithDebInfo</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Desktop_Qt_5_15_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<value type="QString" key="CMake.Build.Type">MinSizeRel</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Desktop_Qt_5_15_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">4</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">ReproductorMultimedia</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.ReproductorMultimedia</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">ReproductorMultimedia</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Dalton/Documents/build-ReproductorMultimedia-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">WebAssemblyDeviceType</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.15.2 WebAssembly</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.15.2 WebAssembly</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.wasm_32_kit</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">-1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="CMake.Build.Type">Debug</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Qt_5_15_2_WebAssembly-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="CMake.Build.Type">Release</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Qt_5_15_2_WebAssembly-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="CMake.Build.Type">RelWithDebInfo</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Qt_5_15_2_WebAssembly-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<value type="QString" key="CMake.Build.Type">MinSizeRel</value>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Dalton\Documents\build-ReproductorMultimedia-Qt_5_15_2_WebAssembly-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">4</value>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">2</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
<RCC>
<qresource prefix="/">
<file>assets/aleatorio.png</file>
<file>assets/anterior.png</file>
<file>assets/bucle.png</file>
<file>assets/expandir.png</file>
<file>assets/icon.png</file>
<file>assets/pausa.png</file>
<file>assets/play.png</file>
<file>assets/siguiente.png</file>
<file>assets/stop.png</file>
<file>assets/eliminar.png</file>
<file>assets/guardar.png</file>
<file>assets/altavoz.png</file>
<file>assets/bucle1.png</file>
<file>assets/cerrar.png</file>
<file>assets/flecha.png</file>
<file>assets/abrir.png</file>
<file>assets/uno.png</file>
<file>assets/anadir.png</file>
<file>assets/anadirrem.png</file>
</qresource>
</RCC>
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QTime>
#include <QResource>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), _playlist(nullptr),
_autosave(false), _defaultDir(QDir::home()), _onlyPlayer(false) {
ui->setupUi(this);
// Iniciar recursos
QResource::registerResource("assets.qrc");
// Pone el reproductor por defecto.
// Desde qt design se pone el ultimo que se haya pinchado y no el por defecto.
ui->tabWidget->setCurrentIndex(0);
// Cargar recurso relacionados con las playlist
_playlist = new QMediaPlaylist();
playListModeSequential();
_model = new PlayListModel(parent);
_model->setPlaylist(_playlist);
ui->playlistTable->setModel(_model);
//Conectamos funciones de la playlist con funciones
connect(_playlist, SIGNAL(loadFailed()), this, SLOT(openFailedPlaylist()));
connect(_playlist, SIGNAL(loaded()), this, SLOT(loadPlaylist()));
connect(ui->guardarPlaylist, SIGNAL(clicked()), this, SLOT(save()));
connect(ui->eliminarPlaylist, SIGNAL(clicked()), this, SLOT(delPlayList()));
connect(ui->playlistTable, &QListView::clicked, this, &MainWindow::clickItem);
connect(ui->playlistTable, &QListView::doubleClicked, this, &MainWindow::playItem);
connect(_playlist, &QMediaPlaylist::mediaInserted, this, &MainWindow::playListChanged);
connect(_playlist, &QMediaPlaylist::mediaRemoved, this, &MainWindow::playListChanged);
// Playlist modes
connect(ui->CurrentItemOnce, SIGNAL(clicked()), this, SLOT(playListModeCurrentItemOnce()));
connect(ui->CurrentItemInLoop, SIGNAL(clicked()), this, SLOT(playListModeCurrentItemInLoop()));
connect(ui->Sequential, SIGNAL(clicked()), this, SLOT(playListModeSequential()));
connect(ui->Loop, SIGNAL(clicked()), this, SLOT(playListModeLoop()));
connect(ui->Random, SIGNAL(clicked()), this, SLOT(playListModeRandom()));
//Cargamos el reproductor
_metadatosLoader = new QMediaPlayer(this);
_reproductor = new QMediaPlayer(this);
_reproductor->setVideoOutput(ui->videoWidget);
_reproductor->setPlaylist(_playlist);
if (!_reproductor->isAvailable()) {
QMessageBox::warning(this, "El servicio no esta disponible",
"No ha sido posible obtener el servicio de reproduccion");
setDisablePlaylistControl(true);
setDisablePlaybackControl(true);
}
//Conectamos controladores del reproductor con sus funciones
connect(_metadatosLoader, SIGNAL(metaDataChanged()), SLOT(metadataChanged()));
connect(ui->actionPlay_Pause, SIGNAL(triggered()), SLOT(on_videoButtonPlay_clicked()));
connect(ui->actionStop, SIGNAL(triggered()), SLOT(on_videoButtonStop_clicked()));
connect(ui->actionSiguiente, SIGNAL(triggered()), SLOT(on_playlistButtonNext_clicked()));
connect(ui->actionAnterior, SIGNAL(triggered()), SLOT(on_playlistButtonBack_clicked()));
connect(ui->actionAbrir, SIGNAL(triggered()), SLOT(openFile()));
connect(ui->actionSalir, SIGNAL(triggered()), SLOT(close()));
connect(ui->fullScreenButton, SIGNAL(clicked()), this, SLOT(fullScreenVideo()));
connect(_reproductor, &QMediaPlayer::positionChanged,
this, &MainWindow::on_videoTimeChanged);
connect(_reproductor, &QMediaPlayer::stateChanged,
this, &MainWindow::on_videoStateChanged);
//Poner controles como desmarcados
setDisablePlaybackControl(true);
setDisablePlaylistControl(true);
_sliderPressed = false;
}
MainWindow::~MainWindow() {
delete ui;
delete _reproductor;
delete _metadatosLoader;
delete _model;
delete _playlist;
}
/*
*
* Desactivar los controles graficos
*
*/
void MainWindow::setDisablePlaylistControl(bool disable) {
ui->playlistButtonBack->setDisabled(disable);
ui->playlistButtonNext->setDisabled(disable);
ui->actionSiguiente->setDisabled(disable);
ui->actionAnterior->setDisabled(disable);
}
void MainWindow::setDisablePlaybackControl(bool disable) {
ui->videoButtonStop->setDisabled(disable);
ui->videoButtonPlay->setDisabled(disable);
ui->fullScreenButton->setDisabled(disable);
ui->actionStop->setDisabled(disable);
ui->actionPlay_Pause->setDisabled(disable);
}
void MainWindow::on_videoButtonPlay_clicked() {
if (_reproductor->state() == QMediaPlayer::State::PausedState) {
_reproductor->play();
} else if (_reproductor->state() == QMediaPlayer::State::PlayingState) {
_reproductor->pause();
}
}
void MainWindow::on_videoButtonStop_clicked() {
if(ui->videoWidget->isFullScreen()) ui->videoWidget->setFullScreen(false);
_reproductor->stop();
}
void MainWindow::on_playlistButtonBack_clicked() {
_playlist->previous();
}
void MainWindow::on_playlistButtonNext_clicked() {
_playlist->next();
}
void MainWindow::on_videoStateChanged(QMediaPlayer::State state) {
switch (state) {
case QMediaPlayer::State::StoppedState:
setDisablePlaybackControl(true);
ui->videoTime->setValue(0);
ui->videoLabelCurrentTime->setText("00:00:00");
ui->videoLabelTime->setText("00:00:00");
break;
case QMediaPlayer::State::PausedState:
ui->actionPlay_Pause->setIcon(QIcon(":/assets/play.png"));
ui->videoButtonPlay->setIcon(QIcon(":/assets/play.png"));
setDisablePlaybackControl(false);
break;
case QMediaPlayer::State::PlayingState:
ui->actionPlay_Pause->setIcon(QIcon(":/assets/pausa.png"));
ui->videoButtonPlay->setIcon(QIcon(":/assets/pausa.png"));
setDisablePlaybackControl(false);
break;
default:
setDisablePlaybackControl(false);
break;
}
}
void MainWindow::on_videoTime_sliderPressed()
{
//Pausar la reproducción mientras se esta cambiando la barra
_reproductor->pause();
_sliderPressed = true;
}
void MainWindow::on_videoTime_sliderReleased()
{
_reproductor->play();
_sliderPressed = false;
}
void MainWindow::on_videoTime_sliderMoved(int position)
{
qDebug() << "Desplazamiento de la barra en: " << position;
qint64 newposition;
newposition = (position / qreal(ui->videoTime->maximum())) * _reproductor->duration();
_reproductor->setPosition(newposition);
}
void MainWindow::on_videoTimeChanged(qint64 position) {
int valor;
if(_reproductor->state() != QMediaPlayer::State::StoppedState)
{
qint64 duracion = _reproductor->duration();
valor = (position / qreal(duracion)) * ui->videoTime->maximum();
//Fix: No cambiar el valor cuando se esta modificando la barra, crea inconsistencia
if(!_sliderPressed)
ui->videoTime->setValue(valor);
qint64 temp = _reproductor->duration() / 1000;
QTime total((temp / 3600) % 60, (temp / 60) % 60,
temp % 60, (temp * 1000) % 1000);
ui->videoLabelTime->setText(total.toString("hh:mm:ss"));
temp = position / 1000;
QTime current((temp / 3600) % 60, (temp / 60) % 60,
temp % 60, (temp * 1000) % 1000);
ui->videoLabelCurrentTime->setText(current.toString("hh:mm:ss"));
}
}
void MainWindow::on_videoSlideVolume_valueChanged(int value) {
//Es necesario hacer conversiones para pasar de un valor lineal a una escala logaritmica
qreal linealVolume = QAudio::convertVolume(value / qreal(100),
QAudio::LogarithmicVolumeScale,
QAudio::LinearVolumeScale);
_reproductor->setVolume(linealVolume * 100);
}
void MainWindow::openFile() {
QString filter;
filter.append("Media (*.m3u ").append(MEDIA_TYPE).append(")");
filter.append(";;PlayList (*.m3u)");
filter.append(";;Todos (*.*)");
QUrl path = QFileDialog::getOpenFileUrl(this, "Abrir archivo", _defaultDir.path(), filter);
if (!path.isEmpty()) {
//Si es una playlist la cargamos si no cargamos el ficheor
if (path.toString().endsWith(".m3u")) {
closePlayList(!_onlyPlayer);
_playListPath = path;
QFile f(path.path());
if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
emit openFailedPlaylist();
_playlist->load(&f, "m3u");
_onlyPlayer = false;
ui->tabWidget->setCurrentIndex(1);
} else {
closePlayList(!_onlyPlayer);
_playlist->addMedia(path);
_metadatosLoader->setMedia(path);
_reproductor->play();
_onlyPlayer = true;
playListModeCurrentItemOnce();
}
_model->updateModel();
}
}
void MainWindow::playListChanged(int start, int end) {
if (_model->rowCount() >= 1) {
setDisablePlaylistControl(false);
} else {
setDisablePlaylistControl(true);
}
for (int i = start; i <= end; i++) {
_metadatosLoader->setMedia(_playlist->media(i));
}
}
void MainWindow::openFailedPlaylist() {
closePlayList();
QMessageBox::critical(this, "Error al cargar", "No se ha podido cargar la lista de reproducción");
}
void MainWindow::loadPlaylist() {
_autosave = true;
_onlyPlayer = false;
}
void MainWindow::save(bool ask) {
if (!_autosave && ask) {
QString file = QFileDialog::getSaveFileName(this,
"Guardar PlayList", _defaultDir.path(),
"PlayList (*.m3u)");
if (!file.endsWith(".m3u"))
file.append(".m3u");
_playListPath = QUrl::fromLocalFile(file);
if (_playListPath.isEmpty())
return;
} else if (!_autosave) return;
if (_playlist->save(_playListPath, "m3u")) {
_autosave = true;
} else {
closePlayList(false);
QMessageBox::critical(this, "Error al guardar", "No se ha podido guardar la lista de reproducción");
}
}
void MainWindow::closePlayList(bool ask) {
if (!_autosave && !_playlist->isEmpty() && ask) {
QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Guardar?",
"La playlist no ha sido guardada. ¿Guardar ahora?\n",
QMessageBox::Save | QMessageBox::Discard,
QMessageBox::Save);
if (resBtn == QMessageBox::Save)
save();
}
ui->eliminarPlaylist->setDisabled(true);
_playListPath.clear();
_playlist->clear();
_autosave = false;
}
void MainWindow::addPlayList() {
QString filter;
filter.append("Media (").append(MEDIA_TYPE).append(")");
filter.append(";;Todos (*.*)");
QFileDialog dialog(this);
dialog.setDirectory(_defaultDir.path());
dialog.setFileMode(QFileDialog::ExistingFiles);
dialog.setNameFilter(filter);
QList<QUrl> files;
if (dialog.exec())
files = dialog.selectedUrls();
if (files.isEmpty())
return;
for (QUrl &item: files) {
_playlist->addMedia(item);
}
save(false);
_onlyPlayer = false;
_model->updateModel();
}
void MainWindow::delPlayList() {
int pos = ui->playlistTable->currentIndex().row();
if (!_playlist->removeMedia(pos))
QMessageBox::warning(this, "Error", "No se ha podido eliminar de la playlist");
save(false);
_model->updateModel();
if (_playlist->isEmpty())
ui->eliminarPlaylist->setDisabled(true);
}
void MainWindow::metadataChanged() {
QString mkey = _metadatosLoader->media().request().url().toString();
if (_metadatosLoader->isMetaDataAvailable()) {
//Eliminamos metadatos anteriores si existen
_metadatos.remove(mkey);
//Introducimos los nuevos
QList<QPair<QString, QString>> metadatos;
for (QString key : _metadatosLoader->availableMetaData()) {
QString value = _metadatosLoader->metaData(key).toString();
QPair<QString, QString> pair(key, value);
metadatos.append(pair);
}
_metadatos.insert(mkey, metadatos);
}
}
void MainWindow::updateMetadataView(int row) {
QString key = _playlist->media(row).request().url().toString();
QList<QPair<QString, QString>> metadatos = _metadatos.value(key);
if (!metadatos.isEmpty()) {
ui->metadataWidget->clear();
for (QPair<QString, QString> pareja : metadatos) {
ui->metadataWidget->addItem(pareja.first + ": " + pareja.second);
}
} else {
ui->metadataWidget->addItem("Estamos cargando los metadatos, sea paciente!");
}
}
void MainWindow::clickItem(const QModelIndex &index) {
ui->eliminarPlaylist->setDisabled(false);
//Limpiar visualizador de metadatos
ui->metadataWidget->clear();
_metadatosLoader->setMedia(_playlist->media(index.row()));
updateMetadataView(index.row());
}
void MainWindow::playItem(const QModelIndex &index) {
_playlist->setCurrentIndex(index.row());
_reproductor->play();
ui->tabWidget->setCurrentIndex(0);
}
void MainWindow::closeEvent(QCloseEvent *event) {
closePlayList(!_onlyPlayer);
event->accept();
}
void MainWindow::fullScreenVideo() {
if(!ui->videoWidget->isFullScreen())
ui->videoWidget->setFullScreen(true);
}
void MainWindow::playListModeCurrentItemOnce() {
_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::CurrentItemOnce);
ui->CurrentItemOnce->setDisabled(true);
ui->CurrentItemInLoop->setDisabled(false);
ui->Sequential->setDisabled(false);
ui->Loop->setDisabled(false);
ui->Random->setDisabled(false);
}
void MainWindow::playListModeCurrentItemInLoop() {
_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::CurrentItemInLoop);
ui->CurrentItemOnce->setDisabled(false);
ui->CurrentItemInLoop->setDisabled(true);
ui->Sequential->setDisabled(false);
ui->Loop->setDisabled(false);
ui->Random->setDisabled(false);
}
void MainWindow::playListModeSequential() {
_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Sequential);
ui->CurrentItemOnce->setDisabled(false);
ui->CurrentItemInLoop->setDisabled(false);
ui->Sequential->setDisabled(true);
ui->Loop->setDisabled(false);
ui->Random->setDisabled(false);
}
void MainWindow::playListModeLoop() {
_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Loop);
ui->CurrentItemOnce->setDisabled(false);
ui->CurrentItemInLoop->setDisabled(false);
ui->Sequential->setDisabled(false);
ui->Loop->setDisabled(true);
ui->Random->setDisabled(false);
}
void MainWindow::playListModeRandom() {
_playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Random);
ui->CurrentItemOnce->setDisabled(false);
ui->CurrentItemInLoop->setDisabled(false);
ui->Sequential->setDisabled(false);
ui->Loop->setDisabled(false);
ui->Random->setDisabled(true);
}
void MainWindow::on_videoTime_actionTriggered(int action)
{
qDebug() << "Slider action "<< action;
int position;
switch (action)
{
case QAbstractSlider::SliderSingleStepAdd:
qDebug() << "SingleStepAdd";
position = +ui->videoTime->singleStep()+ui->videoTime->value();
ui->videoTime->setValue(position);
on_videoTime_sliderMoved(position);
break;
case QAbstractSlider::SliderSingleStepSub:
qDebug() << "SingleStepSub";
position = -ui->videoTime->singleStep()+ui->videoTime->value();
ui->videoTime->setValue(position);
on_videoTime_sliderMoved(position);
break;
case QAbstractSlider::SliderPageStepAdd:
position = ui->videoTime->pageStep()+ui->videoTime->value();
ui->videoTime->setValue(position);
on_videoTime_sliderMoved(position);
break;
case QAbstractSlider::SliderPageStepSub:
position = -ui->videoTime->pageStep()+ui->videoTime->value();
ui->videoTime->setValue(position);
on_videoTime_sliderMoved(position);
break;
}
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMediaPlayer>
#include <QMediaObject>
#include <QMessageBox>
#include <QMediaPlaylist>
#include <QDir>
#include "playlistmodel.h"
#include <QCloseEvent>
const QString MEDIA_TYPE("*.mp3 *.mp4 *.mkv *.avi' *.ogg *.flv *.ogv *.webm");
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
//Interacciones con la interfaz
void on_videoButtonPlay_clicked();
void on_videoButtonStop_clicked();
void on_playlistButtonBack_clicked();
void on_playlistButtonNext_clicked();
void on_videoSlideVolume_valueChanged(int value);
void closeEvent(QCloseEvent *event);
void fullScreenVideo();
// PlayList
void openFailedPlaylist();
void loadPlaylist();
void save(bool ask = true);
void addPlayList();
void delPlayList();
void clickItem(const QModelIndex &index);
void playItem(const QModelIndex &index);
void openFile();
void closePlayList(bool ask = true);
void playListChanged(int start, int end);
// Playlist modes
void playListModeCurrentItemOnce();
void playListModeCurrentItemInLoop();
void playListModeSequential();
void playListModeLoop();
void playListModeRandom();
//Interacciones con el qmediaplayer
void on_videoTimeChanged(qint64 position);
void on_videoTime_sliderMoved(int position);
void on_videoStateChanged(QMediaPlayer::State state);
void on_videoTime_sliderPressed();
void on_videoTime_sliderReleased();
void on_videoTime_actionTriggered(int action);
void metadataChanged();
void updateMetadataView(int row);
private:
void setDisablePlaybackControl(bool disable);
void setDisablePlaylistControl(bool disable);
Ui::MainWindow *ui;
PlayListModel *_model;
QMediaPlaylist *_playlist;
bool _autosave;
bool _onlyPlayer;
QUrl _playListPath;
QDir _defaultDir;
bool _sliderPressed;
QMediaPlayer *_reproductor = nullptr;
QMap<QString ,QList<QPair<QString,QString>>> _metadatos;
QMediaPlayer *_metadatosLoader = nullptr;
};
#endif // MAINWINDOW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>EL MEJOR REPRODUCTOR</string>
</property>
<property name="windowIcon">
<iconset resource="assets.qrc">
<normaloff>:/assets/icon.png</normaloff>:/assets/icon.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="videowidget" name="videoWidget">
<attribute name="title">
<string>Visualizador</string>
</attribute>
</widget>
<widget class="QWidget" name="playlistWidget">
<attribute name="title">
<string>Playlist</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListView" name="playlistTable"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="eliminarPlaylist">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/eliminar.png</normaloff>:/assets/eliminar.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="guardarPlaylist">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/guardar.png</normaloff>:/assets/guardar.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="metadataWidget"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="videoLabelCurrentTime">
<property name="text">
<string>00:00:00</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="videoTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="videoLabelTime">
<property name="text">
<string>00:00:00</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="playlistButtonBack">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/anterior.png</normaloff>:/assets/anterior.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="videoButtonPlay">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/play.png</normaloff>:/assets/play.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="videoButtonStop">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/stop.png</normaloff>:/assets/stop.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playlistButtonNext">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/siguiente.png</normaloff>:/assets/siguiente.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="CurrentItemOnce">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/uno.png</normaloff>:/assets/uno.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="CurrentItemInLoop">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/bucle1.png</normaloff>:/assets/bucle1.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Sequential">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/flecha.png</normaloff>:/assets/flecha.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Loop">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/bucle.png</normaloff>:/assets/bucle.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Random">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/aleatorio.png</normaloff>:/assets/aleatorio.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="fullScreenButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/expandir.png</normaloff>:/assets/expandir.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="videoLabelVolume">
<property name="text">
<string>Volumen</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="videoSlideVolume">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>84</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>84</width>
<height>15</height>
</size>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuArchivo">
<property name="title">
<string>Archivo</string>
</property>
<addaction name="separator"/>
<addaction name="actionAbrir"/>
<addaction name="separator"/>
<addaction name="actionPlay_Pause"/>
<addaction name="actionStop"/>
<addaction name="separator"/>
<addaction name="actionAnterior"/>
<addaction name="actionSiguiente"/>
<addaction name="separator"/>
<addaction name="actionSalir"/>
</widget>
<addaction name="menuArchivo"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAbrir">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/abrir.png</normaloff>:/assets/abrir.png</iconset>
</property>
<property name="text">
<string>Abrir...</string>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
</property>
</action>
<action name="actionSalir">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/cerrar.png</normaloff>:/assets/cerrar.png</iconset>
</property>
<property name="text">
<string>Salir</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</action>
<action name="actionPlay_Pause">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/play.png</normaloff>:/assets/play.png</iconset>
</property>
<property name="text">
<string>Play/Pause</string>
</property>
<property name="shortcut">
<string>Space</string>
</property>
</action>
<action name="actionStop">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/stop.png</normaloff>:/assets/stop.png</iconset>
</property>
<property name="text">
<string>Stop</string>
</property>
<property name="shortcut">
<string>S</string>
</property>
</action>
<action name="actionSiguiente">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/siguiente.png</normaloff>:/assets/siguiente.png</iconset>
</property>
<property name="text">
<string>Siguiente</string>
</property>
<property name="shortcut">
<string>Right</string>
</property>
</action>
<action name="actionAnterior">
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/anterior.png</normaloff>:/assets/anterior.png</iconset>
</property>
<property name="text">
<string>Anterior</string>
</property>
<property name="shortcut">
<string>Left</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>videowidget</class>
<extends>QWidget</extends>
<header>videowidget/videowidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
</ui>
#include "playlistmodel.h"
#include <qdebug.h>
PlayListModel::PlayListModel(QObject *parent)
: QAbstractListModel(parent), _playlist(nullptr) {
}
PlayListModel::~PlayListModel() {
}
int PlayListModel::rowCount(const QModelIndex &parent) const {
if (parent.isValid() && !_playlist)
return 0;
return _playlist->mediaCount();
}
QVariant PlayListModel::data(const QModelIndex &index, int role) const {
if (!index.isValid() && !_playlist)
return QVariant();
switch (role) {
case Qt::DisplayRole:
return _playlist->media(index.row()).request().url().fileName();
default:
return QVariant();
}
}
QMediaPlaylist *PlayListModel::getPlaylist() const {
return _playlist;
}
void PlayListModel::setPlaylist(QMediaPlaylist *playlist) {
beginResetModel();
_playlist = playlist;
endResetModel();
}
#ifndef PLAYLISTMODEL_H
#define PLAYLISTMODEL_H
#include <QAbstractListModel>
#include <QMediaPlaylist>
class PlayListModel : public QAbstractListModel {
Q_OBJECT
public:
explicit PlayListModel(QObject *parent = nullptr);
virtual ~PlayListModel();
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QMediaPlaylist *getPlaylist() const;
void setPlaylist(QMediaPlaylist *playlist);
void updateModel() {
this->layoutChanged();
}
private:
QMediaPlaylist *_playlist;
};
#endif // PLAYLISTMODEL_H
#include "videowidget.h"
#include <QKeyEvent>
#include <QMouseEvent>
videowidget::videowidget(QWidget *parent)
: QVideoWidget(parent)
{
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QPalette p = palette();
p.setColor(QPalette::Window, Qt::black);
setPalette(p);
setAttribute(Qt::WA_OpaquePaintEvent);
}
void videowidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape && isFullScreen()) {
setFullScreen(false);
event->accept();
} else if (event->key() == Qt::Key_Enter && event->modifiers() & Qt::Key_Alt) {
setFullScreen(!isFullScreen());
event->accept();
} else {
QVideoWidget::keyPressEvent(event);
}
}
void videowidget::mouseDoubleClickEvent(QMouseEvent *event)
{
setFullScreen(!isFullScreen());
event->accept();
}
void videowidget::mousePressEvent(QMouseEvent *event)
{
QVideoWidget::mousePressEvent(event);
}
#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H
#include <QVideoWidget>
class videowidget : public QVideoWidget
{
Q_OBJECT
public:
explicit videowidget(QWidget *parent = nullptr);
protected:
void keyPressEvent(QKeyEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
};
#endif // VIDEOWIDGET_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment