/
RIP.h
126 lines (97 loc) · 2.32 KB
/
RIP.h
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
#pragma once
#include <thread>
#include <vector>
#include <QSystemTrayIcon>
#include <QDialog>
#include <QTime>
#include "DiscInfo.h"
#include "Paranoia.h"
#include "ui_Info.h"
class QAction;
class QTableWidget;
class Settings;
struct cddb_conn_s;
struct cddb_disc_s;
class RIP;
class Progress: public QWidget
{
public:
Progress(RIP* _r);
RIP* rip() const { return m_r; }
private:
void paintEvent(QPaintEvent*);
RIP* m_r;
};
class RIP: public QSystemTrayIcon
{
Q_OBJECT
public:
RIP();
~RIP();
QString directory() const { return QString::fromUtf8(m_path.c_str()); }
QString filename() const { return QString::fromUtf8(m_filename.c_str()); }
QString device() const { return QString::fromUtf8(m_device.c_str()); }
int paranoia() const { return m_paranoia; }
int squeeze() const { return m_squeeze; }
float amountDone() const;
std::vector<std::pair<unsigned, unsigned> > const& progress() const { return m_progress; }
public slots:
void setDirectory(QString _s) { m_path = _s.toUtf8().data(); }
void setFilename(QString _s) { m_filename = _s.toUtf8().data(); }
void setParanoia(int _s) { m_paranoia = _s; }
void setDevice(QString _s) { m_device = _s.toUtf8().data(); }
void setSqueeze(int _s) { m_squeeze = _s; }
void update();
void onConfirm();
void onUnconfirm();
private slots:
void onActivated(QSystemTrayIcon::ActivationReason);
void onAbortRip();
void onAbout();
void onQuit();
void updatePreset(int);
void plantInfo();
void harvestInfo();
private:
void rip();
void getDiscInfo();
void eject();
void tagAll();
void moveAll();
void createPopup();
void showPopup();
void readSettings();
void writeSettings();
virtual void timerEvent(QTimerEvent*);
QFrame* m_popup;
Settings* m_settings;
Ui::Info m_info;
DiscInfo m_di;
std::vector<DiscInfo> m_dis;
DiscIdentity m_id;
std::string m_path;
std::string m_filename;
std::string m_device;
int m_paranoia;
int m_squeeze;
Paranoia m_p;
std::thread* m_ripper;
std::thread* m_identifier;
bool m_ripped;
bool m_identified;
bool m_justRipped;
bool m_confirmed;
QTime m_started;
int m_lastPercentDone;
bool m_startingRip;
std::vector<std::pair<unsigned, unsigned> > m_progress;
std::string m_temp;
QIcon m_inactive;
bool m_aborting;
Progress* m_progressPie;
QAction* m_abortRip;
QAction* m_unconfirm;
#if DEBUG
QAction* m_testIcon;
#endif
};