Clementine Adore Mod
 All Classes Namespaces Files Functions Variables Macros Pages
adoredb.h
Go to the documentation of this file.
1 /* This file is part of Clementine.
2  Copyright 2015, Thomas Mielke <thomas.mielke@c3s.cc>
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 #ifndef ADOREDB_H
18 #define ADOREDB_H
19 
20 #include <QObject>
21 #include <QSqlDatabase>
22 #include <QSqlQuery>
23 #include <QSqlError>
24 #include <QFile>
25 #include <QDir>
26 
27 #define ADOREDB_VERSION "101"
28 
29 #define TYPE_UNKNOWN 0
31 #define TYPE_DELAY 1
32 #define TYPE_SUCCESS 2
33 #define TYPE_WARNING 3
34 #define TYPE_ERROR 4
35 
43 class AdoreDb : public QObject
44 {
45 public:
46  AdoreDb();
47  ~AdoreDb();
48 
49 public:
50  bool Open();
51  bool Delete();
52  QSqlError LastError();
53  bool Add(QStringList &names, QStringList &values);
54  bool GetQueued(QStringList &names, QStringList &values);
55 
56 private:
57  QSqlDatabase db;
58 
59  static const char* kFileName;
60  static const char* kLinuxPath;
61 };
62 
63 #endif // ADOREDB_H
static const char * kFileName
the queue db filename is defined here.
Definition: adoredb.h:59
bool Open()
Opens/Creates the SQlite queue file.
Definition: adoredb.cpp:62
bool Delete()
This is to delete the whole queue file.
Definition: adoredb.cpp:142
This class handles SQLite access to the queue file.
Definition: adoredb.h:43
QSqlDatabase db
Definition: adoredb.h:57
static const char * kLinuxPath
under Linux the extra Clementine config path (based on the home directory) is defined here...
Definition: adoredb.h:60
AdoreDb()
Definition: adoredb.cpp:23
QSqlError LastError()
Retrieves the last occured SQLite error.
Definition: adoredb.cpp:132
bool Add(QStringList &names, QStringList &values)
Adds a new record to the log table of the queue db.
Definition: adoredb.cpp:167
bool GetQueued(QStringList &names, QStringList &values)
Gets the next record not marked as TYPE_SUCCESS.
Definition: adoredb.cpp:219
~AdoreDb()
Definition: adoredb.cpp:28