~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/scripting/scriptinfo.h

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of Clementine.
2
 
   Copyright 2010, David Sansome <me@davidsansome.com>
3
 
 
4
 
   Clementine is free software: you can redistribute it and/or modify
5
 
   it under the terms of the GNU General Public License as published by
6
 
   the Free Software Foundation, either version 3 of the License, or
7
 
   (at your option) any later version.
8
 
 
9
 
   Clementine is distributed in the hope that it will be useful,
10
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
   GNU General Public License for more details.
13
 
 
14
 
   You should have received a copy of the GNU General Public License
15
 
   along with Clementine.  If not, see <http://www.gnu.org/licenses/>.
16
 
*/
17
 
 
18
 
#ifndef SCRIPTINFO_H
19
 
#define SCRIPTINFO_H
20
 
 
21
 
#include <QIcon>
22
 
#include <QSharedData>
23
 
#include <QSharedDataPointer>
24
 
 
25
 
class Script;
26
 
class ScriptManager;
27
 
 
28
 
class ScriptInfo {
29
 
public:
30
 
  ScriptInfo();
31
 
 
32
 
  enum Language {
33
 
    Language_Unknown = 0,
34
 
    Language_Python,
35
 
  };
36
 
 
37
 
  static const char* kIniFileName;
38
 
  static const char* kIniSettingsGroup;
39
 
 
40
 
  void InitFromDirectory(const ScriptManager* manager, const QString& path);
41
 
  void InitFromFile(const ScriptManager* manager,
42
 
                    const QString& id,
43
 
                    const QString& path,
44
 
                    const QString& filename);
45
 
  void TakeMetadataFrom(const ScriptInfo& other);
46
 
 
47
 
  bool is_valid() const { return d->language_ != Language_Unknown; }
48
 
  bool operator ==(const ScriptInfo& other) const;
49
 
  bool operator !=(const ScriptInfo& other) const;
50
 
 
51
 
  const QString& path() const { return d->path_; }
52
 
  const QString& id() const { return d->id_; }
53
 
 
54
 
  const QString& name() const { return d->name_; }
55
 
  const QString& description() const { return d->description_; }
56
 
  const QString& author() const { return d->author_; }
57
 
  const QString& url() const { return d->url_; }
58
 
  const QString& icon_filename() const { return d->icon_filename_; }
59
 
  QIcon icon() const { return QIcon(icon_filename()); }
60
 
 
61
 
  Language language() const { return d->language_; }
62
 
  const QString& script_file() const { return d->script_file_; }
63
 
 
64
 
  Script* loaded() const { return d->loaded_; }
65
 
  void set_loaded(Script* loaded) { d->loaded_ = loaded; }
66
 
 
67
 
private:
68
 
  struct Private : public QSharedData {
69
 
    Private() : language_(Language_Unknown), loaded_(NULL) {}
70
 
 
71
 
    QString path_;
72
 
    QString id_;
73
 
 
74
 
    QString name_;
75
 
    QString description_;
76
 
    QString author_;
77
 
    QString url_;
78
 
    QString icon_filename_;
79
 
 
80
 
    Language language_;
81
 
    QString script_file_;
82
 
 
83
 
    Script* loaded_;
84
 
  };
85
 
 
86
 
  QSharedDataPointer<Private> d;
87
 
};
88
 
 
89
 
#endif // SCRIPTINFO_H