AppSettings for android
added debug output for Navigation as debugger does not work for Android yet
This commit is contained in:
parent
75308b4423
commit
9e7a55fc20
8 changed files with 405 additions and 90 deletions
|
|
@ -21,11 +21,17 @@ NavigationController::NavigationController(QObject *parent) : QObject(parent),
|
|||
});
|
||||
}
|
||||
|
||||
void NavigationController::setDebugOutput(const QString& text)
|
||||
{
|
||||
mDebugOutput = text;
|
||||
emit debugOutputChanged();
|
||||
}
|
||||
|
||||
void NavigationController::init(const QString &rootPath)
|
||||
{
|
||||
auto rootDir = QDir(rootPath);
|
||||
if(!rootDir.exists()) return;
|
||||
mRootPath = rootPath;
|
||||
mRootPath = rootPath;
|
||||
|
||||
add(mRootPath, mRootItem);
|
||||
|
||||
|
|
@ -49,6 +55,7 @@ void NavigationController::setContextProperties()
|
|||
mContext->setContextProperty("navigationList", mNavList);
|
||||
mContext->setContextProperty("uiStateModel", mUiState);
|
||||
mContext->setContextProperty("musicModel", mMediaPlayer);
|
||||
mContext->setContextProperty("debug", this);
|
||||
}
|
||||
|
||||
void NavigationController::add(const QString &path, NavigationItemModel *parentItem)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ class MusicPlayer;
|
|||
class NavigationController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString pDebugOutput READ getDebugOutput NOTIFY debugOutputChanged)
|
||||
|
||||
signals:
|
||||
void debugOutputChanged();
|
||||
|
||||
public:
|
||||
explicit NavigationController(QObject *parent = nullptr);
|
||||
|
||||
|
|
@ -37,6 +43,8 @@ public:
|
|||
*/
|
||||
void setContext(QQmlContext* context);
|
||||
|
||||
QString getDebugOutput() const { return mDebugOutput; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Register models in context
|
||||
|
|
@ -55,6 +63,12 @@ private:
|
|||
*/
|
||||
bool checkContent(const QString& path);
|
||||
|
||||
/**
|
||||
* @brief Set Debug Output. Necessary as Android Debugger does not work yet
|
||||
* @param text Output to show in ui
|
||||
*/
|
||||
void setDebugOutput(const QString& text);
|
||||
|
||||
NavigationItemModel* mRootItem;
|
||||
NavigationListModel* mNavList;
|
||||
|
||||
|
|
@ -63,6 +77,8 @@ private:
|
|||
|
||||
QString mRootPath = ".";
|
||||
|
||||
QString mDebugOutput;
|
||||
|
||||
QQmlContext* mContext = nullptr;
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "SettingsHandler.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
constexpr const char* const rootPath = "rootPath";
|
||||
constexpr const char* const profile = "profile";
|
||||
|
|
@ -59,11 +60,20 @@ QString SettingsHandler::getShutdownScript() const
|
|||
|
||||
void SettingsHandler::initDefaults()
|
||||
{
|
||||
mDefaults.insert(rootPath, "/home/ar/source/lenaMusic/");
|
||||
mDefaults.insert(profile, "RasPiTouch");
|
||||
mDefaults.insert(enableEnergySaver, true);
|
||||
mDefaults.insert(rootPath, QStandardPaths::MusicLocation);
|
||||
mDefaults.insert(enableEnergySaver, false);
|
||||
mDefaults.insert(timeout, 60);
|
||||
mDefaults.insert(shutdownScript, "/usr/local/sbin/do_shutdown.sh");
|
||||
mDefaults.insert(profile, "RasPiTouch");
|
||||
// @todo add profile Android? Or simply scale ui for RasPi
|
||||
// mDefaults.insert(profile, "Android");
|
||||
|
||||
// Defaults for LenaPi
|
||||
// mDefaults.insert(rootPath, "/home/ar/source/lenaMusic/");
|
||||
// mDefaults.insert(profile, "RasPiTouch");
|
||||
// mDefaults.insert(enableEnergySaver, true);
|
||||
// mDefaults.insert(timeout, 60);
|
||||
// mDefaults.insert(shutdownScript, "/usr/local/sbin/do_shutdown.sh");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue