-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prototype for app customization/whitelabeling via custom file
- Loading branch information
1 parent
1ea0050
commit 4965782
Showing
5 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "appcustomisation.h" | ||
|
||
AppCustomisation::AppCustomisation( QObject *parent ): QObject( parent ) | ||
{ | ||
// This file will have only empty contructor in main production MM app; | ||
// in whitelabelled apps it will have the overriden properties like AC_ORG_NAME | ||
mValues[AC_ORG_NAME] = "blabllba"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef APPCUSTOMISATION_H | ||
#define APPCUSTOMISATION_H | ||
|
||
#include <QObject> | ||
#include <QHash> | ||
#include <QVariant> | ||
#include <QString> | ||
#include <QColor> | ||
|
||
// Like this or pure string in code? If we use AC_* (like App Customization, ..) | ||
// then at least we have here list of all entries that could be whitelabeled? | ||
const QString AC_ORG_NAME = QStringLiteral("organizationName"); | ||
|
||
class AppCustomisation: public QObject | ||
{ | ||
public: | ||
explicit AppCustomisation( QObject *parent = nullptr ); | ||
Q_INVOKABLE QString value( const QString &key, const QString &defaultValue ) {return getValue<QString>(key, defaultValue);} | ||
Q_INVOKABLE QColor color( const QString &key, const QColor &defaultValue ){return getValue<QColor>(key, defaultValue);} | ||
|
||
// maybe for some on -off things like allow switching default server (so in the QML we can read this and do not need to patch the file) | ||
Q_INVOKABLE bool boolean( const QString &key, bool defaultValue ){return getValue<bool>(key, defaultValue);} | ||
|
||
private: | ||
// Template, ou yeah! | ||
template <typename T> T getValue(const QString &key, const T &defaultValue ) | ||
{ | ||
const auto it = mValues.find(key); | ||
if (it == mValues.constEnd()) { | ||
return defaultValue; | ||
} else { | ||
return it->value<T>(); | ||
} | ||
} | ||
|
||
QHash<QString, QVariant> mValues; | ||
}; | ||
|
||
#endif // APPCUSTOMISATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4965782
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS - version 24.5.626511 just submitted!