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

Commit 71c84c5

Browse files
committed
moved progress dialog (ProgressDlg) to libMacGitverCore with required minor changes
The progress dialog can now be called from the MGV-Core API.
1 parent 30f6fb0 commit 71c84c5

File tree

6 files changed

+59
-37
lines changed

6 files changed

+59
-37
lines changed

Libs/libMacGitverCore/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ SET( SRC_FILES
6161
Widgets/FlatTreeComboBox.cpp
6262
Widgets/FlatTreeModel.cpp
6363
Widgets/FlatTreeDelegate.cpp
64+
Widgets/ProgressDlg.cpp
6465
Widgets/SHA1Input.cpp
6566
Widgets/ShortCommitModel.cpp
6667
Widgets/RepoStateWidget.cpp
@@ -114,6 +115,7 @@ SET( PUB_HDR_FILES
114115
Widgets/FlatTreeComboBox.h
115116
Widgets/FlatTreeModel.h
116117
Widgets/FlatTreeDelegate.h
118+
Widgets/ProgressDlg.hpp
117119
Widgets/SHA1Input.h
118120
Widgets/ShortCommitModel.h
119121
Widgets/TreeViewCtxMenu.hpp
@@ -161,6 +163,7 @@ SET( UI_FILES
161163
RepoMan/Config/RepoManConfigPage.ui
162164

163165
Widgets/ExpandableDlg.ui
166+
Widgets/ProgressDlg.ui
164167
)
165168

166169
SET( HID_FILES

Modules/Repository/ProgressDlg.cpp renamed to Libs/libMacGitverCore/Widgets/ProgressDlg.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11

2+
#include "ProgressDlg.hpp"
3+
#include "ui_ProgressDlg.h"
4+
25
#include <QStringBuilder>
36
#include <QCloseEvent>
47
#include <QDebug>
58
#include <QPushButton>
69
#include <QString>
710

8-
#include "ProgressDlg.hpp"
9-
1011

1112
ProgressDlg::ProgressDlg()
1213
: BlueSky::Dialog()
14+
, ui( new Ui::ProgressDlg )
1315
, mDone( false )
1416
{
15-
setupUi( this );
17+
ui->setupUi( this );
1618

17-
QPushButton* close = buttonBox->button( QDialogButtonBox::Close );
19+
QPushButton* close = ui->buttonBox->button( QDialogButtonBox::Close );
1820
close->setEnabled( false );
19-
connect( close, SIGNAL(clicked()), this, SLOT(close ()) );
21+
connect( close, &QPushButton::clicked, this, &ProgressDlg::close );
2022

2123
QPalette p;
2224
p.setColor( QPalette::Base, p.color( QPalette::Window ) );
2325
p.setColor( QPalette::Text, p.color( QPalette::WindowText ) );
24-
txtLog->setPalette( p );
26+
ui->txtLog->setPalette( p );
27+
}
2528

29+
ProgressDlg::~ProgressDlg()
30+
{
31+
delete ui;
2632
}
2733

2834
void ProgressDlg::setAction( const QString& action,
@@ -47,7 +53,7 @@ void ProgressDlg::setAction( const QString& action,
4753
act += QStringLiteral( " (<font color=\"red\">" ) % s % QStringLiteral( "</font>)" );
4854
}
4955

50-
lblAction->setText( act );
56+
ui->lblAction->setText( act );
5157
}
5258

5359
void ProgressDlg::setCurrent(QObject* current)
@@ -93,10 +99,10 @@ void ProgressDlg::transportProgress( quint32 totalObjects,
9399
{
94100
recv = QString::number( receivedBytes );
95101
}
96-
lblTransferSize->setText( recv );
102+
ui->lblTransferSize->setText( recv );
97103

98-
progressBar->setRange( 0, totalObjects * 2 );
99-
progressBar->setValue( indexedObjects + receivedObjects );
104+
ui->progressBar->setRange( 0, totalObjects * 2 );
105+
ui->progressBar->setValue( indexedObjects + receivedObjects );
100106
}
101107

102108
void ProgressDlg::remoteMessage( const QString& msg )
@@ -133,25 +139,25 @@ void ProgressDlg::remoteMessage( const QString& msg )
133139
QString log = mBaseLog % QStringLiteral( "<br/>" ) %
134140
output.replace( QChar( L'\n' ), QLatin1String("<br/>") ).simplified();
135141

136-
txtLog->setHtml( log );
142+
ui->txtLog->setHtml( log );
137143
}
138144

139145
void ProgressDlg::beginStep( const QString& step )
140146
{
141147
mBaseLog += tr( "<font color=\"blue\">%1</font><br/>" ).arg( step );
142-
txtLog->setHtml( mBaseLog );
148+
ui->txtLog->setHtml( mBaseLog );
143149
}
144150

145151
void ProgressDlg::finalizeStep()
146152
{
147-
mBaseLog = txtLog->toHtml() % QStringLiteral( "<br/>" );
153+
mBaseLog = ui->txtLog->toHtml() % QStringLiteral( "<br/>" );
148154
mRawRemoteMessage = QString();
149155

150-
txtLog->setHtml( mBaseLog );
156+
ui->txtLog->setHtml( mBaseLog );
151157
}
152158

153159
void ProgressDlg::setDone()
154160
{
155161
mDone = true;
156-
buttonBox->button( QDialogButtonBox::Close )->setEnabled( true );
162+
ui->buttonBox->button( QDialogButtonBox::Close )->setEnabled( true );
157163
}

Modules/Repository/ProgressDlg.hpp renamed to Libs/libMacGitverCore/Widgets/ProgressDlg.hpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11

2-
#ifndef MODREPO_PROGRESS_DLG_HPP
3-
#define MODREPO_PROGRESS_DLG_HPP
2+
#pragma once
43

4+
#include "libMacGitverCore/MacGitverApi.hpp"
55
#include "libBlueSky/Dialog.hpp"
66

7-
#include "ui_ProgressDlg.h"
8-
7+
namespace Ui
8+
{
9+
class ProgressDlg;
10+
};
911

10-
class ProgressDlg
11-
: public BlueSky::Dialog
12-
, private Ui::ProgressDlg
12+
class MGV_CORE_API ProgressDlg : public BlueSky::Dialog
1313
{
1414
Q_OBJECT
1515
public:
1616
ProgressDlg();
17+
~ProgressDlg();
1718

1819
public:
1920
void setAction( const QString& action, const QStringList& open,
@@ -33,11 +34,12 @@ private slots:
3334
protected:
3435
void closeEvent( QCloseEvent* ev );
3536

37+
private:
38+
Ui::ProgressDlg* ui;
39+
3640
private:
3741
bool mDone;
3842
QString mBaseLog;
3943
QObject* mCurrent;
4044
QString mRawRemoteMessage;
4145
};
42-
43-
#endif

Modules/Repository/ProgressDlg.ui renamed to Libs/libMacGitverCore/Widgets/ProgressDlg.ui

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
<property name="windowTitle">
2323
<string>Progress</string>
2424
</property>
25-
<property name="sizeGripEnabled">
26-
<bool>false</bool>
27-
</property>
2825
<property name="modal">
2926
<bool>true</bool>
3027
</property>
@@ -57,7 +54,16 @@
5754
<property name="sizeConstraint">
5855
<enum>QLayout::SetDefaultConstraint</enum>
5956
</property>
60-
<property name="margin">
57+
<property name="leftMargin">
58+
<number>0</number>
59+
</property>
60+
<property name="topMargin">
61+
<number>0</number>
62+
</property>
63+
<property name="rightMargin">
64+
<number>0</number>
65+
</property>
66+
<property name="bottomMargin">
6167
<number>0</number>
6268
</property>
6369
<item>
@@ -85,15 +91,24 @@
8591
<string>Current operation</string>
8692
</property>
8793
<layout class="QGridLayout" name="gridLayout_2">
94+
<property name="leftMargin">
95+
<number>3</number>
96+
</property>
97+
<property name="topMargin">
98+
<number>3</number>
99+
</property>
100+
<property name="rightMargin">
101+
<number>3</number>
102+
</property>
103+
<property name="bottomMargin">
104+
<number>3</number>
105+
</property>
88106
<property name="horizontalSpacing">
89-
<number>-1</number>
107+
<number>6</number>
90108
</property>
91109
<property name="verticalSpacing">
92110
<number>2</number>
93111
</property>
94-
<property name="margin">
95-
<number>3</number>
96-
</property>
97112
<item row="1" column="1">
98113
<widget class="QProgressBar" name="progressBar">
99114
<property name="sizePolicy">

Modules/Repository/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ SET( SRC_FILES
1818

1919
CloneRepositoryDlg.cpp
2020
CreateRepositoryDlg.cpp
21-
ProgressDlg.cpp
2221
)
2322

2423
SET( HDR_FILES
@@ -31,13 +30,11 @@ SET( HDR_FILES
3130

3231
CloneRepositoryDlg.hpp
3332
CreateRepositoryDlg.h
34-
ProgressDlg.hpp
3533
)
3634

3735
SET( UI_FILES
3836

3937
CloneOptionsWdgt.ui
40-
CloneRepositoryDlg.ui
4138
CreateRepositoryDlg.ui
4239
)
4340

@@ -60,4 +57,3 @@ ADD_MGV_MODULE(
6057
${UIC_FILES} ${UI_FILES}
6158
${HIC_FILES} ${HID_FILES}
6259
)
63-

Modules/Repository/CloneRepositoryDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
#include "libGitWrap/Operations/CloneOperation.hpp"
2525

2626
#include "libMacGitverCore/App/MacGitver.hpp"
27+
#include "libMacGitverCore/Widgets/ProgressDlg.hpp"
2728

2829
#include <QFileDialog>
2930
#include <QMessageBox>
30-
#include "ProgressDlg.hpp"
3131

3232

3333
CloneOptionsWdgt::CloneOptionsWdgt()

0 commit comments

Comments
 (0)