Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Trojitá
Commits
7ae4300e
Commit
7ae4300e
authored
Aug 24, 2013
by
Thomas Lübking
Browse files
use spinner instead progressbar for message sending
parent
dfd1c6d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Gui/ComposeWidget.cpp
View file @
7ae4300e
...
...
@@ -37,8 +37,8 @@
#include
"ComposeWidget.h"
#include
"FromAddressProxyModel.h"
#include
"LineEdit.h"
#include
"OverlayWidget.h"
#include
"ProgressPopUp.h"
#include
"Spinner.h"
#include
"Gui/Util.h"
#include
"Window.h"
#include
"ui_ComposeWidget.h"
...
...
@@ -286,17 +286,21 @@ void ComposeWidget::send()
m_settings
->
value
(
Common
::
SettingsNames
::
smtpUserKey
).
toString
());
ProgressPopUp
*
progress
=
new
ProgressPopUp
();
OverlayWidget
*
overlay
=
new
OverlayWidget
(
progress
,
this
);
overlay
->
show
();
Spinner
*
spinner
=
new
Spinner
(
ui
->
mailText
);
spinner
->
setType
(
Spinner
::
Sun
);
spinner
->
setAutoDelete
(
true
);
setUiWidgetsEnabled
(
false
);
connect
(
m_submission
,
SIGNAL
(
progressMin
(
int
)),
progress
,
SLOT
(
setMinimum
(
int
)));
connect
(
m_submission
,
SIGNAL
(
progressMax
(
int
)),
progress
,
SLOT
(
setMaximum
(
int
)));
connect
(
m_submission
,
SIGNAL
(
progress
(
int
)),
progress
,
SLOT
(
setValue
(
int
)));
connect
(
m_submission
,
SIGNAL
(
updateStatusMessage
(
QString
)),
progress
,
SLOT
(
setLabelText
(
QString
)));
connect
(
m_submission
,
SIGNAL
(
succeeded
()),
overlay
,
SLOT
(
deleteLater
()));
connect
(
m_submission
,
SIGNAL
(
failed
(
QString
)),
overlay
,
SLOT
(
deleteLater
()));
connect
(
m_submission
,
SIGNAL
(
progressMin
(
int
)),
spinner
,
SLOT
(
setMinimum
(
int
)));
connect
(
m_submission
,
SIGNAL
(
progressMax
(
int
)),
spinner
,
SLOT
(
setMaximum
(
int
)));
connect
(
m_submission
,
SIGNAL
(
progress
(
int
)),
spinner
,
SLOT
(
setValue
(
int
)));
connect
(
m_submission
,
SIGNAL
(
updateStatusMessage
(
QString
)),
spinner
,
SLOT
(
setText
(
QString
)));
connect
(
m_submission
,
SIGNAL
(
succeeded
()),
spinner
,
SLOT
(
stop
()));
connect
(
m_submission
,
SIGNAL
(
failed
(
QString
)),
spinner
,
SLOT
(
setText
(
QString
)));
connect
(
m_submission
,
SIGNAL
(
failed
(
QString
)),
spinner
,
SLOT
(
stop
()));
spinner
->
start
();
m_submission
->
send
();
}
...
...
@@ -535,7 +539,7 @@ void ComposeWidget::sent()
// FIXME: move back to the currently selected mailbox
m_sentMail
=
true
;
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
close
()));
QTimer
::
singleShot
(
100
0
,
this
,
SLOT
(
close
()));
}
bool
ComposeWidget
::
parseRecipients
(
QList
<
QPair
<
Composer
::
RecipientKind
,
Imap
::
Message
::
MailAddress
>
>
&
results
,
QString
&
errorMessage
)
...
...
src/Gui/Spinner.cpp
View file @
7ae4300e
...
...
@@ -35,12 +35,23 @@ using namespace Gui;
Spinner
::
Spinner
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_step
(
0
),
m_fadeStep
(
0
),
m_timer
(
0
),
m_startTimer
(
0
),
m_textCols
(
0
),
m_type
(
Sun
),
m_geometryDirty
(
false
),
m_minimum
(
0
),
m_maximum
(
0
),
m_value
(
-
1
),
m_valueStep
(
0xff
)
m_minimum
(
0
),
m_maximum
(
0
),
m_value
(
-
1
),
m_valueStep
(
0xff
),
m_autoDelete
(
false
)
{
updateAncestors
();
hide
();
}
bool
Spinner
::
autoDelete
()
const
{
return
m_autoDelete
;
}
void
Spinner
::
setAutoDelete
(
bool
autoDelete
)
{
m_autoDelete
=
autoDelete
;
}
void
Spinner
::
setMaximum
(
const
int
maximum
)
{
if
(
maximum
==
m_maximum
)
...
...
@@ -206,6 +217,8 @@ void Spinner::stop()
if
(
m_startTimer
)
m_startTimer
->
stop
();
m_fadeStep
=
qMax
(
-
11
,
qMin
(
-
1
,
-
qAbs
(
m_fadeStep
)));
// [-11,-1]
if
(
!
m_timer
)
// progress mode
m_timer
=
startTimer
(
100
);
}
bool
Spinner
::
event
(
QEvent
*
e
)
...
...
@@ -363,6 +376,8 @@ void Spinner::timerEvent(QTimerEvent *e)
killTimer
(
m_timer
);
m_timer
=
0
;
m_step
=
0
;
if
(
m_autoDelete
)
deleteLater
();
}
if
(
m_fadeStep
<
12
)
++
m_fadeStep
;
...
...
src/Gui/Spinner.h
View file @
7ae4300e
...
...
@@ -40,6 +40,12 @@ public:
/** Providing a @p parent that is NOT Null is mandatory! */
explicit
Spinner
(
QWidget
*
parent
);
/**
* Whether to delete itself when hiding after the stop finished
*/
bool
autoDelete
()
const
;
void
setAutoDelete
(
bool
autoDelete
);
/**
* Optional progress indicator values
* Defaulting to 0,0,-1
...
...
@@ -105,6 +111,7 @@ private:
bool
m_geometryDirty
;
int
m_minimum
,
m_maximum
,
m_value
;
uchar
m_valueStep
;
bool
m_autoDelete
;
};
}
// namespace
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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