Skip to content

Commit

Permalink
[features] Add proto for featuremanager
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernd Wachter committed Oct 15, 2013
1 parent 9146fb3 commit 3999dd0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libssu/libssu.pro
Expand Up @@ -13,7 +13,8 @@ public_headers = \
HEADERS = \
$${public_headers} \
sandbox_p.h \
ssucoreconfig.h
ssucoreconfig.h \
ssufeaturemanager.h

SOURCES = \
sandbox.cpp \
Expand Down
30 changes: 30 additions & 0 deletions libssu/ssufeaturemanager.h
@@ -0,0 +1,30 @@
/**
* @file ssufeaturemanager.h
* @copyright 2013 Jolla Ltd.
* @author Bernd Wachter <bwachter@lart.info>
* @date 2013
*/

#ifndef _SSUFEATUREMANAGER_H
#define _SSUFEATUREMANAGER_H

#include <QObject>
#include <QHash>
#include <QStringList>

#include "ssusettings.h"

class SsuFeatureManager: public QObject {
Q_OBJECT

public:
SsuFeatureManager(){};
// add rnd-flag?
QStringList repos(){};
QString url(QString repo){ return ""; };

private:
SsuSettings *featureSettings;
};

#endif
11 changes: 11 additions & 0 deletions libssu/ssurepomanager.cpp
Expand Up @@ -15,6 +15,7 @@
#include "ssusettings.h"
#include "ssulog.h"
#include "ssuvariables.h"
#include "ssufeaturemanager.h"
#include "ssu.h"

#include "../constants.h"
Expand Down Expand Up @@ -111,6 +112,7 @@ QStringList SsuRepoManager::repos(bool rnd, int filter){
return repos(rnd, deviceInfo, filter);
}

// @todo the non-device specific repository resolving should move from deviceInfo to repomanager
QStringList SsuRepoManager::repos(bool rnd, SsuDeviceInfo &deviceInfo, int filter){
QStringList result;
result = deviceInfo.repos(rnd, filter);
Expand Down Expand Up @@ -314,8 +316,17 @@ QString SsuRepoManager::url(QString repoName, bool rndRepo,
i++;
}

// search for URLs for repositories. Lookup order is:
// 1. overrides in ssu.ini
// 2. URLs from features
// 3. URLs from repos.ini

SsuFeatureManager featureManager;

if (settings->contains("repository-urls/" + repoName))
r = settings->value("repository-urls/" + repoName).toString();
else if (featureManager.url(repoName) != "")
r = featureManager.url(repoName);
else {
foreach (const QString &section, configSections){
repoSettings.beginGroup(section);
Expand Down

0 comments on commit 3999dd0

Please sign in to comment.