1 #pragma once
2 
3 #ifndef SVN_REVERT_DIALOG_H
4 #define SVN_REVERT_DIALOG_H
5 
6 #include "toonzqt/dvdialog.h"
7 #include "versioncontrol.h"
8 
9 #include <QList>
10 
11 class QPushButton;
12 class QTreeWidget;
13 class QCheckBox;
14 
15 //-----------------------------------------------------------------------------
16 
17 class SVNRevertDialog final : public DVGui::Dialog {
18   Q_OBJECT
19 
20   QLabel *m_waitingLabel;
21   QLabel *m_textLabel;
22 
23   QString m_workingDir;
24   QStringList m_files;
25 
26   QPushButton *m_revertButton;
27   QPushButton *m_cancelButton;
28 
29   QTreeWidget *m_treeWidget;
30 
31   VersionControlThread m_thread;
32 
33   QList<SVNStatus> m_status;
34 
35   QList<QString> m_filesToRevert;
36   QStringList m_sceneResources;
37 
38   QCheckBox *m_revertSceneContentsCheckBox;
39 
40   // Perform a revert on one or more folder
41   bool m_folderOnly;
42 
43   int m_sceneIconAdded;
44 
45 public:
46   SVNRevertDialog(QWidget *parent, const QString &workingDir,
47                   const QStringList &files, bool folderOnly = false,
48                   int sceneIconAdded = 0);
49 
50   void checkFiles();
51 
52 private:
53   void switchToCloseButton();
54 
55   void revertFiles();
56 
57   void initTreeWidget();
58 
59 protected slots:
60 
61   void onRevertButtonClicked();
62   void onRevertDone();
63 
64   void onError(const QString &);
65   void onStatusRetrieved(const QString &);
66 
67   void onRevertSceneContentsToggled(bool checked);
68 
69 signals:
70   void done(const QStringList &);
71 };
72 
73 //-----------------------------------------------------------------------------
74 
75 class SVNRevertFrameRangeDialog final : public DVGui::Dialog {
76   Q_OBJECT
77 
78   QLabel *m_waitingLabel;
79   QLabel *m_textLabel;
80 
81   QString m_workingDir;
82   QString m_file;
83   QString m_tempFileName;
84 
85   QPushButton *m_revertButton;
86   QPushButton *m_cancelButton;
87 
88   VersionControlThread m_thread;
89   QList<SVNStatus> m_status;
90   QList<QString> m_filesToRevert;
91   QStringList m_files;
92 
93 public:
94   SVNRevertFrameRangeDialog(QWidget *parent, const QString &workingDir,
95                             const QString &file, const QString &tempFileName);
96 
97 private:
98   void switchToCloseButton();
99   void revertFiles();
100 
101   void checkFiles();
102 
103 protected slots:
104   void onRevertButtonClicked();
105   void onError(const QString &);
106   void onStatusRetrieved(const QString &);
107   void onRevertDone();
108 
109 signals:
110   void done(const QStringList &);
111 };
112 
113 #endif  // SVN_REVERT_DIALOG_H
114