Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit eae5656

Browse files
committed
add ProgressWdgt, preparing for unified progress dialog
The ProgressWdgt is going to be used internally by ProgressDlg to represent a single activity or step.
1 parent d61a3b8 commit eae5656

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

Libs/libMacGitverCore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ SET( UI_FILES
152152

153153
Widgets/ExpandableDlg.ui
154154
Widgets/ProgressDlg.ui
155+
156+
Widgets/ProgressWdgt.ui
155157
)
156158

157159
SET( HID_FILES

Libs/libMacGitverCore/Widgets/ProgressDlg.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,42 @@
11

22
#include "ProgressDlg.hpp"
33
#include "ui_ProgressDlg.h"
4+
#include "ui_ProgressWdgt.h"
45

56
#include <QStringBuilder>
67
#include <QCloseEvent>
78
#include <QDebug>
89
#include <QPushButton>
910
#include <QString>
1011

12+
namespace Private
13+
{
14+
15+
class ProgressWdgt : public QWidget, public Ui::ProgressWdgt
16+
{
17+
public:
18+
typedef QMap< QString, QPointer<ProgressWdgt> > Steps;
19+
20+
enum Status { Running = 0, Stopped };
21+
22+
public:
23+
ProgressWdgt(const QString& description)
24+
{
25+
setupUi(this);
26+
progressBar->setMinimum(0);
27+
progressBar->setMaximum(100);
28+
txtHeader->setText( description );
29+
}
30+
31+
public:
32+
Steps mSteps;
33+
Status mStatus = Running;
34+
35+
qreal mPercentage = 0.;
36+
};
37+
38+
}
39+
1140

1241
ProgressDlg::ProgressDlg()
1342
: BlueSky::Dialog()

Libs/libMacGitverCore/Widgets/ProgressDlg.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
#include "libMacGitverCore/MacGitverApi.hpp"
55
#include "libBlueSky/Dialog.hpp"
66

7+
#include <QMap>
8+
#include <QPointer>
9+
10+
namespace Private
11+
{
12+
class ProgressWdgt;
13+
};
14+
715
namespace Ui
816
{
917
class ProgressDlg;
@@ -12,6 +20,10 @@ namespace Ui
1220
class MGV_CORE_API ProgressDlg : public BlueSky::Dialog
1321
{
1422
Q_OBJECT
23+
24+
public:
25+
typedef QMap< QPointer<QObject>, QPointer<Private::ProgressWdgt> > Activities;
26+
1527
public:
1628
ProgressDlg();
1729
~ProgressDlg();
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>ProgressWdgt</class>
4+
<widget class="QWidget" name="ProgressWdgt">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>448</width>
10+
<height>83</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Progress</string>
15+
</property>
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
18+
<widget class="QLabel" name="txtHeader">
19+
<property name="text">
20+
<string>Progress:</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item>
25+
<widget class="QProgressBar" name="progressBar"/>
26+
</item>
27+
<item>
28+
<widget class="QLabel" name="txtStatusInfo">
29+
<property name="text">
30+
<string>Not started...</string>
31+
</property>
32+
</widget>
33+
</item>
34+
</layout>
35+
</widget>
36+
<resources/>
37+
<connections/>
38+
</ui>

0 commit comments

Comments
 (0)