1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
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 <QSqlDatabase>
#include <QAbstractItemModel>
#include <QStringList>
#include <QtWidgets/QMessageBox>
#include <QSettings>
#include <QDir>
#include <QFile>
#include <QDataStream>
#include <QFileInfo>
#include <QTemporaryFile>
#include <QProcess>
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
#include "smglobals.h"
#include "seriestreemodel.h"
#include "filestreemodel.h"
#include "mappingtablemodel.h"
#include "seriesmetadatamodel.h"
#include "mappingtreemodel.h"
#include "pictureviewer2.h"
#include "picfilesmodel.h"
#include "configurationdialog.h"
#include "framecache.h"
SmGlobals *SmGlobals::mInstance = 0;
SmGlobals::~SmGlobals(){
foreach(QAbstractItemModel *model, mModels.values()){
delete model;
}
delete mFrameCache;
}
SmGlobals *SmGlobals::instance(){
if(!mInstance){
mInstance = new SmGlobals;
if(!QSqlDatabase::contains("treedb")){
QSettings s;
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL", "treedb");
db.setHostName(s.value("database/hostname").toString());
db.setUserName(s.value("database/dbuser").toString());
db.setPassword(s.value("database/dbpass").toString());
db.setDatabaseName(s.value("database/dbname").toString());
if(!db.open()){
QMessageBox::critical(0, tr("Error"), tr("Could not open database."));
ConfigurationDialog configDlg;
configDlg.exec();
QMessageBox::information(0, tr("Notice"), tr("I will exit now. Start me again!"));
exit(EXIT_SUCCESS);
}
}
}
return mInstance;
}
QAbstractItemModel *SmGlobals::model(const QString &which){
if(which == "SeriesModel"){
if(!mModels.contains(which)){
QStringList headers = QStringList() << tr("Series") << tr("Series ID") << tr("Series part ID") << tr("Part") << tr("Type") << tr("Favorite") << tr("Subtitle") << tr("Is Local");
SeriesTreeModel *model = new SeriesTreeModel(headers);
mModels.insert(which, model);
}
}else if(which == "FilesModel"){
if(!mModels.contains(which)){
QStringList headers = QStringList() << tr("Name") << tr("Part") << tr("Size") << tr("Qual.") << tr("Dvd") << tr("Full Path") << tr("Size (int)") << tr("Type") << tr("Md5 sum") << tr("Series part ID") << tr("File ID") << tr("Seriespart") << tr("Display name") << tr("Dur./Size") << tr("Series name") << tr("Favorite");
FilesTreeModel *model = new FilesTreeModel(headers);
mModels.insert(which, model);
}
}else if(which == "actors"){
if(!mModels.contains(which)){
QStringList headers = QStringList() << tr("Actor") << tr("Id");
MappingTableModel *model = new MappingTableModel(headers, "actors");
mModels.insert(which, model);
}
}else if(which == "genres"){
if(!mModels.contains(which)){
QStringList headers = QStringList() << tr("Genre") << tr("Id");
MappingTableModel *model = new MappingTableModel(headers, "genres");
mModels.insert(which, model);
}
}else if(which == "SeriesMetadata"){
if(!mModels.contains(which)){
QStringList headers = QStringList() << tr("SeriesPartId") << tr("Release Year") << tr("Source Medium") << tr("Subject") << tr("Release Group") << tr("Encoder Options") << tr("Comment") << tr("Encoding Passes") << tr("Added");
SeriesMetadataModel *model = new SeriesMetadataModel(headers);
mModels.insert(which, model);
}
}else if(which == "MappingTree"){
if(!mModels.contains("MappingTree")){
QStringList headers = QStringList() << tr("Name") << tr("Id") << tr("Date") << tr("Parent");
MappingTreeModel *model = new MappingTreeModel(headers);
mModels.insert(which, model);
}
}else if(which == "PicFiles"){
if(!mModels.contains("PicFiles")){
QStringList headers = QStringList() << tr("Filename") << tr("SizeNum") << tr("Format") << tr("Full Path") << tr("Id") << tr("Added") << tr("Md5Sum") << tr("Size");
PicFilesModel *model = new PicFilesModel(headers);
mModels.insert(which, model);
}
}
return mModels.contains(which) ? mModels.value(which) : 0;
}
PictureViewer2 *SmGlobals::pictureViewer() {
if(!mPictureViewer){
mPictureViewer = new PictureViewer2;
}
return mPictureViewer;
}
FrameCache *SmGlobals::frameCache() {
if(!mFrameCache){
mFrameCache = new FrameCache;
}
return mFrameCache;
}
SeriesTreeWidget *SmGlobals::seriesTreeWidget(){
return mSeriesTreeWidget;
}
QSize SmGlobals::cursorSize() {
if(!mCursorSize.isValid()){
Display *dpy = XOpenDisplay(0);
XFixesCursorImage *curImage = XFixesGetCursorImage(dpy);
mCursorSize = QSize(curImage->width, curImage->height);
XFree(curImage);
}
return mCursorSize;
}
SmGlobals::SmGlobals() : mPictureViewer(0), mFrameCache(0){
mIcons.insert("Dildo", ":/dildo.png");
mIcons.insert("Dick to left", ":/back_dick.png");
mIcons.insert("Dick pointing up", ":/up_dick.png");
mIcons.insert("Chastity belt", ":/chastity_belt.png");
mIcons.insert("Clitoris", ":/clitoris.png");
mIcons.insert("Gaping ass", ":/gaping_ass.png");
mIcons.insert("Nipple pointing up", ":/nipple_up.png");
mIcons.insert("Bald pussy", ":/bald_pussy.png");
mIcons.insert("Prince Albert", ":/prince_albert.png");
mIcons.insert("Diaper", ":/diaper.png");
mIcons.insert("High heels", ":/higheels.png");
mIcons.insert("Ball gag", ":/ball_gag.png");
mIcons.insert("French Maid Dress", ":/french_maid_dress.png");
mIcons.insert("Shackles", ":/shackles.png");
mIcons.insert("Steel collar", ":/steel_collar.png");
mIcons.insert("Butt plug", ":/butt_plug.png");
mIcons.insert("Hourglass figure", ":/hourglass_figure.png");
mIcons.insert("Big ass", ":/big_ass.png");
mIcons.insert("Big tit", ":/big_tit.png");
mIcons.insert("Bizarre amputee", ":/bizarre_amputee.png");
mIcons.insert("Spreading pants", ":/spreadingpants.png");
mIcons.insert("Leather dog hood", ":/dog_hood.png");
mIcons.insert("Male chastity belt", ":/male_chastity_belt.png");
mIcons.insert("Anal stretcher", ":/analstretcher.png");
mIcons.insert("Big balls", ":/big_balls.png");
mIcons.insert("Big pierced balls", ":/huge_balls_pierced.png");
mIcons.insert("Huge bra", ":/huge_bra.png");
mIcons.insert("Squirting nipple", ":/squirting_nipple.png");
mIcons.insert("Dick in a cage", ":/dick_in_cage.png");
mIcons.insert("Used tampon", ":/used_tampon.png");
mIcons.insert("Clean tampon", ":/clean_tampon.png");
mDvdSize = Q_INT64_C(4707319808) - 20 * 1024 *1024;
}
|