-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
109 lines (90 loc) · 3.54 KB
/
main.cpp
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
#include <QApplication>
#include <QIcon>
#include <QMenu>
#include <QAction>
#include <QApplication>
#include <QStandardPaths>
#include <QFileIconProvider>
#include <QSettings>
#include "fmiconview.h"
#include "splitter.h"
#include "titlebar.h"
#include "addactiondialog.h"
#include "settingscontroller.h"
#include <QDebug>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//allReset();
/* NOTE:
* we need set system theme and inhert the QFileIconProvider's icon() method,
* QIcon::fromTheme will return the theme icon, see fmfileiconprovider.cpp.
* TODO:
* get the current system icon theme
* gsettings get org.mate.interface icon-theme
* is there a more general way?
*/
//QGSettings gsettings = QGSettings(QByteArray("org.mate.interface"),QByteArray("icon-theme"));
//qDebug()<<gsettings.get("org.mate.interface icon-theme");
QIcon::setThemeName("ukui-icon-theme");
//QIcon::setThemeName("Humanity");
//QIcon::setThemeName("gnome");
//QIcon::setThemeName("HighContrast");
//QIcon::setThemeName("deepin");
/*
QPushButton bt;
const QIcon icon;
//bt.setIcon(QIcon::fromTheme("inode-directory", icon));
bt.setIcon(QIcon::fromTheme("inode-directory"));
bt.show();
*/
//============================================================
QSettings iconview_idcount;
iconview_idcount.beginGroup("iconview/id_count");
int idCout = iconview_idcount.value("lastid").toInt();
for (int i = 1; i <= idCout; i++) {
QSettings iconview_id_title_table;
iconview_id_title_table.beginGroup("iconview/id_title_table");
QString title_for_this_id = iconview_id_title_table.value(QString(i)).toString();
qDebug()<<"id: "<<i<<", title: "<<title_for_this_id;
QSettings iconview_id_state_table;
iconview_id_state_table.beginGroup("iconview/id_state_table");
int state = iconview_id_state_table.value(QString(i)).toInt();
if (state == 1) {
Splitter *page = new Splitter(i, title_for_this_id);
page->setOrientation(Qt::Vertical);
TitleBar *bar = new TitleBar(page);
bar->setTitle(title_for_this_id);
FMIconView *iconview = new FMIconView(i);
page->addWidget(bar);
page->setTitleBar(bar);
bar->setIconView(iconview);
page->addWidget(iconview);
page->show();
}
}
QSystemTrayIcon *tray = new QSystemTrayIcon;
QFileIconProvider iconProvider;
tray->setIcon(QIcon(iconProvider.icon(QFileIconProvider::Desktop)));
tray->show();
QMenu *trayMenu;
trayMenu = new QMenu();
QAction *trayQuitAction;
trayQuitAction = new QAction();
trayQuitAction->setText("save and quit");
QObject::connect(trayQuitAction,SIGNAL(triggered()),qApp,SLOT(quit()));
QAction *trayAddWidgetAction = new QAction;
trayAddWidgetAction->setText("add");
AddActionDialog *addActionDialog = new AddActionDialog;
QObject::connect(trayAddWidgetAction, &QAction::triggered, addActionDialog, &AddActionDialog::show);
QAction *trayResetAction = new QAction;
trayResetAction->setText("delete all views and files and quit");
SettingsController *controller = new SettingsController;
QObject::connect(trayResetAction, &QAction::triggered, controller, &SettingsController::resetAll);
trayMenu->addAction(trayAddWidgetAction);
trayMenu->addAction(trayQuitAction);
trayMenu->addAction(trayResetAction);
tray->setContextMenu(trayMenu);
return a.exec();
}