Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
2673646c
Commit
2673646c
authored
May 05, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the files update dialog
parent
0f4f8277
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
0 deletions
+117
-0
UBUpdateDlg.cpp
src/gui/UBUpdateDlg.cpp
+76
-0
UBUpdateDlg.h
src/gui/UBUpdateDlg.h
+41
-0
No files found.
src/gui/UBUpdateDlg.cpp
0 → 100644
View file @
2673646c
#include <QMessageBox>
#include <QFileDialog>
#include "UBUpdateDlg.h"
UBUpdateDlg
::
UBUpdateDlg
(
QWidget
*
parent
,
int
nbFiles
,
const
QString
&
bkpPath
)
:
QDialog
(
parent
)
,
mpDlgBttn
(
NULL
)
{
setFixedSize
(
400
,
110
);
setModal
(
true
);
setWindowTitle
(
tr
(
"Document updater"
));
setLayout
(
&
mLayout
);
QString
str
=
QString
::
number
(
nbFiles
);
str
.
append
(
tr
(
" files require an update."
));
mNbFilesLabel
.
setText
(
str
);
mLayout
.
addWidget
(
&
mNbFilesLabel
);
mBkpLabel
.
setText
(
tr
(
"Backup path: "
));
mBkpPath
.
setText
(
bkpPath
);
mBrowseBttn
.
setText
(
tr
(
"Browse"
));
mHLayout
.
addWidget
(
&
mBkpLabel
);
mHLayout
.
addWidget
(
&
mBkpPath
,
1
);
mHLayout
.
addWidget
(
&
mBrowseBttn
);
mLayout
.
addLayout
(
&
mHLayout
);
mpDlgBttn
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
Qt
::
Horizontal
,
this
);
mLayout
.
addWidget
(
mpDlgBttn
);
mpDlgBttn
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"Update"
));
mpDlgBttn
->
button
(
QDialogButtonBox
::
Cancel
)
->
setText
(
"Remind me later"
);
QObject
::
connect
(
&
mBrowseBttn
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBrowse
()));
QObject
::
connect
(
mpDlgBttn
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
onUpdate
()));
QObject
::
connect
(
mpDlgBttn
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
}
UBUpdateDlg
::~
UBUpdateDlg
()
{
if
(
NULL
!=
mpDlgBttn
)
{
delete
mpDlgBttn
;
mpDlgBttn
=
NULL
;
}
}
void
UBUpdateDlg
::
onBrowse
()
{
QString
qsSelectedDir
;
qsSelectedDir
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Select a backup folder"
),
mBkpPath
.
text
());
mBkpPath
.
setText
(
qsSelectedDir
);
}
void
UBUpdateDlg
::
onUpdate
()
{
emit
updateFiles
();
}
void
UBUpdateDlg
::
onFilesUpdated
(
bool
bResult
)
{
QString
qsMsg
;
if
(
bResult
)
{
qsMsg
=
tr
(
"Files update successful"
);
}
else
{
qsMsg
=
tr
(
"An error occured during the update. The files have not been affected."
);
}
QMessageBox
::
information
(
this
,
tr
(
"Files update results"
),
qsMsg
,
QMessageBox
::
Ok
);
}
QString
UBUpdateDlg
::
backupPath
()
{
return
mBkpPath
.
text
();
}
src/gui/UBUpdateDlg.h
0 → 100644
View file @
2673646c
#ifndef UBUPDATEDLG_H
#define UBUPDATEDLG_H
#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
class
UBUpdateDlg
:
public
QDialog
{
Q_OBJECT
public
:
UBUpdateDlg
(
QWidget
*
parent
=
0
,
int
nbFiles
=
0
,
const
QString
&
bkpPath
=
""
);
~
UBUpdateDlg
();
QString
backupPath
();
public
slots
:
void
onFilesUpdated
(
bool
bResult
);
signals
:
void
updateFiles
();
private
slots
:
void
onBrowse
();
void
onUpdate
();
private
:
QLabel
mNbFilesLabel
;
QLabel
mBkpLabel
;
QLineEdit
mBkpPath
;
QPushButton
mBrowseBttn
;
QDialogButtonBox
*
mpDlgBttn
;
QVBoxLayout
mLayout
;
QHBoxLayout
mHLayout
;
};
#endif // UBUPDATEDLG_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment