Skip to content

Commit

Permalink
Providers getResult method returns a plain QList now.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarmack committed Jan 1, 2011
1 parent bdfe633 commit 2d1f7d1
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Applications.cpp
Expand Up @@ -27,9 +27,9 @@ Applications::Applications()
Applications::~Applications()
{}

AppList Applications::getResults(QString query)
QList<Application> Applications::getResults(QString query)
{
AppList list = AppList();
QList<Application> list = QList<Application>();
int count = 0;
int seconds = time(NULL);
foreach(QString name, this->appTable->keys())
Expand Down
2 changes: 1 addition & 1 deletion Applications.h
Expand Up @@ -29,7 +29,7 @@ class Applications : public Provider
Applications();
~Applications();
public slots:
AppList getResults(QString query);
QList<Application> getResults(QString query);
int launch(QVariant selected);
private:
void setPopularity(QString entry, popularity pop);
Expand Down
4 changes: 2 additions & 2 deletions Calculator.cpp
Expand Up @@ -23,14 +23,14 @@ Calculator::Calculator()
Calculator::~Calculator()
{}

AppList Calculator::getResults(QString query)
QList<Application> Calculator::getResults(QString query)
{
Application result = Application();
result.icon = "accessories-calculator";
result.name = QString::number(calculate(query), 'g', 12);
result.priority = 2147483647;
result.object = this;
AppList list = AppList();
QList<Application> list = QList<Application>();
list.append(result);
return list;
}
Expand Down
2 changes: 1 addition & 1 deletion Calculator.h
Expand Up @@ -12,7 +12,7 @@ class Calculator : public Provider
Calculator();
~Calculator();
public slots:
AppList getResults(QString query);
QList<Application> getResults(QString query);
int launch(QVariant selected);
private:
QHash<char, calcFunct> functions;
Expand Down
4 changes: 2 additions & 2 deletions Mangonel.cpp
Expand Up @@ -130,9 +130,9 @@ void Mangonel::getApp(QString query)
this->current = -1;
foreach(Provider* provider, this->providers)
{
AppList list = provider->getResults(query);
QList<Application> list = provider->getResults(query);
foreach(Application app, list)
this->apps->insertSorted(app);
this->apps->insertSorted(app);
}
if (!this->apps->isEmpty())
{
Expand Down
8 changes: 8 additions & 0 deletions Mangonel.h
Expand Up @@ -46,6 +46,14 @@ class IconView : public QGraphicsView
int current;
};

class AppList : public QList<Application>
{
public:
AppList();
~AppList();
void insertSorted(Application value);
};

class Mangonel : public Plasma::Dialog
{
Q_OBJECT
Expand Down
4 changes: 2 additions & 2 deletions Paths.cpp
Expand Up @@ -10,9 +10,9 @@ Paths::Paths()
Paths::~Paths()
{}

AppList Paths::getResults(QString query)
QList<Application> Paths::getResults(QString query)
{
AppList list = AppList();
QList<Application> list = QList<Application>();
QString original = query;
QDir dir;
if (query.startsWith("/"))
Expand Down
2 changes: 1 addition & 1 deletion Paths.h
Expand Up @@ -11,7 +11,7 @@ class Paths : public Provider
Paths();
~Paths();
public slots:
AppList getResults(QString query);
QList<Application> getResults(QString query);
int launch(QVariant selected);
};

Expand Down
13 changes: 2 additions & 11 deletions Provider.h
Expand Up @@ -5,15 +5,15 @@
#include <QVariant>


class AppList;
class Application;

// Abstract base class of providers.
class Provider : public QObject
{
public:
virtual ~Provider() {};
public slots:
virtual AppList getResults(QString query) = 0;
virtual QList<Application> getResults(QString query) = 0;
virtual int launch(QVariant selected) = 0;
};

Expand All @@ -28,14 +28,5 @@ struct Application
Provider* object; //Pointer to the search provider that provided this result.
};

// Search providers return an AppList with their results, they do not need to sort the results.
class AppList : public QList<Application>
{
public:
AppList();
~AppList();
void insertSorted(Application value);
};

#endif // Provider_H
// kate: indent-mode cstyle; space-indent on; indent-width 4;
4 changes: 2 additions & 2 deletions Shell.cpp
Expand Up @@ -19,9 +19,9 @@ Shell::Shell()
Shell::~Shell()
{}

AppList Shell::getResults(QString query)
QList<Application> Shell::getResults(QString query)
{
AppList list = AppList();
QList<Application> list = QList<Application>();
foreach(QString key, this->index.keys())
{
if (key.startsWith(query.left(query.indexOf(" ")), Qt::CaseInsensitive))
Expand Down
2 changes: 1 addition & 1 deletion Shell.h
Expand Up @@ -13,7 +13,7 @@ class Shell : public Provider
Shell();
~Shell();
public slots:
AppList getResults(QString query);
QList<Application> getResults(QString query);
int launch(QVariant selected);
private:
QHash<QString, QString> index;
Expand Down

0 comments on commit 2d1f7d1

Please sign in to comment.