added config
This commit is contained in:
parent
893a2990af
commit
f02f439790
7 changed files with 168 additions and 17 deletions
|
|
@ -1,10 +1,30 @@
|
|||
#include "UiStateModel.h"
|
||||
#include <iostream>
|
||||
|
||||
UiStateModel::UiStateModel(QObject *parent) : QObject(parent)
|
||||
{
|
||||
initProfiles();
|
||||
showNavigation();
|
||||
}
|
||||
|
||||
void UiStateModel::setProfile(UiStateModel::EProfile profile)
|
||||
{
|
||||
mProfile = profile;
|
||||
emit profileChanged();
|
||||
}
|
||||
|
||||
bool UiStateModel::isShowQuitAppButton() const
|
||||
{
|
||||
const auto & profileInfo = mProfileInfoMap[mProfile];
|
||||
return profileInfo.isShowQuitAppButton;
|
||||
}
|
||||
|
||||
bool UiStateModel::isShowVolumeControls() const
|
||||
{
|
||||
const auto & profileInfo = mProfileInfoMap[mProfile];
|
||||
return profileInfo.isShowVolumeControls;
|
||||
}
|
||||
|
||||
QUrl UiStateModel::getSource() const
|
||||
{
|
||||
return mSource;
|
||||
|
|
@ -19,3 +39,32 @@ void UiStateModel::showNavigation(){
|
|||
mSource = QUrl("Navigation.qml");
|
||||
emit sourceChanged();
|
||||
}
|
||||
|
||||
void UiStateModel::initProfiles()
|
||||
{
|
||||
// Profile_RasPiTouch
|
||||
ProfileInfo rasPiTouchProfile;
|
||||
rasPiTouchProfile.profileType = Profile_RasPiTouch;
|
||||
rasPiTouchProfile.isShowQuitAppButton = false;
|
||||
rasPiTouchProfile.isShowVolumeControls = false;
|
||||
|
||||
mProfileInfoMap.insert(rasPiTouchProfile.profileType, rasPiTouchProfile);
|
||||
|
||||
// Profile_Desktop
|
||||
ProfileInfo desktopProfile;
|
||||
desktopProfile.profileType = Profile_Desktop;
|
||||
desktopProfile.isShowQuitAppButton = true;
|
||||
desktopProfile.isShowVolumeControls = true;
|
||||
|
||||
mProfileInfoMap.insert(desktopProfile.profileType, desktopProfile);
|
||||
}
|
||||
|
||||
UiStateModel::EProfile UiStateModel::getProfileFromString(const QString &profileString)
|
||||
{
|
||||
if(profileString == "Desktop"){
|
||||
return Profile_Desktop;
|
||||
} else if(profileString != "RasPiTouch"){
|
||||
std::cout << "WARNING: Unknown profile\t" << profileString.toStdString() << std::endl;
|
||||
}
|
||||
return Profile_RasPiTouch;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue