mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
Add spinner while opening or saving cloud storage
Right now this is quite ugly. And at least in my VM the transparency doesn't seem to work correctly. But at least we now have some visual indication that we are doing something while opening or saving cloud storage. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6721698fcd
commit
0db80103ca
2 changed files with 34 additions and 2 deletions
|
@ -58,7 +58,8 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
actionPreviousDive(0),
|
actionPreviousDive(0),
|
||||||
helpView(0),
|
helpView(0),
|
||||||
state(VIEWALL),
|
state(VIEWALL),
|
||||||
survey(0)
|
survey(0),
|
||||||
|
spinner(0)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
|
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
|
||||||
m_Instance = this;
|
m_Instance = this;
|
||||||
|
@ -374,6 +375,7 @@ void MainWindow::on_actionCloudstorageopen_triggered()
|
||||||
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
startSpinner();
|
||||||
QByteArray fileNamePtr = QFile::encodeName(filename);
|
QByteArray fileNamePtr = QFile::encodeName(filename);
|
||||||
error = parse_file(fileNamePtr.data());
|
error = parse_file(fileNamePtr.data());
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
@ -382,6 +384,7 @@ void MainWindow::on_actionCloudstorageopen_triggered()
|
||||||
}
|
}
|
||||||
getNotificationWidget()->hideNotification();
|
getNotificationWidget()->hideNotification();
|
||||||
process_dives(false, false);
|
process_dives(false, false);
|
||||||
|
stopSpinner();
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
ui.actionAutoGroup->setChecked(autogroup);
|
ui.actionAutoGroup->setChecked(autogroup);
|
||||||
}
|
}
|
||||||
|
@ -397,10 +400,15 @@ void MainWindow::on_actionCloudstoragesave_triggered()
|
||||||
if (information()->isEditing())
|
if (information()->isEditing())
|
||||||
information()->acceptChanges();
|
information()->acceptChanges();
|
||||||
|
|
||||||
|
startSpinner();
|
||||||
|
|
||||||
if (save_dives(filename.toUtf8().data())) {
|
if (save_dives(filename.toUtf8().data())) {
|
||||||
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
|
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopSpinner();
|
||||||
|
|
||||||
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
|
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
|
||||||
set_filename(filename.toUtf8().data(), true);
|
set_filename(filename.toUtf8().data(), true);
|
||||||
setTitle(MWTF_FILENAME);
|
setTitle(MWTF_FILENAME);
|
||||||
|
@ -1762,3 +1770,24 @@ void MainWindow::setApplicationState(const QByteArray& state) {
|
||||||
}
|
}
|
||||||
#undef SET_CURRENT_INDEX
|
#undef SET_CURRENT_INDEX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::startSpinner()
|
||||||
|
{
|
||||||
|
if (!spinner) {
|
||||||
|
spinner = new QtWaitingSpinner(Qt::WindowModal, this, true);
|
||||||
|
spinner->setRevolutionsPerSecond(1);
|
||||||
|
spinner->setColor(WHITE1);
|
||||||
|
spinner->setLineWidth(7);
|
||||||
|
spinner->setRoundness(40.0);
|
||||||
|
spinner->setMinimumTrailOpacity(0.25);
|
||||||
|
}
|
||||||
|
int shorterEdge = MIN(this->geometry().height(), this->geometry().width());
|
||||||
|
spinner->setInnerRadius(shorterEdge / 12);
|
||||||
|
spinner->setLineLength(shorterEdge / 8);
|
||||||
|
spinner->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::stopSpinner()
|
||||||
|
{
|
||||||
|
spinner->stop();
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "notificationwidget.h"
|
#include "notificationwidget.h"
|
||||||
#include "windowtitleupdate.h"
|
#include "windowtitleupdate.h"
|
||||||
|
#include "qtwaitingspinner.h"
|
||||||
|
|
||||||
struct DiveList;
|
struct DiveList;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
@ -189,7 +190,8 @@ slots:
|
||||||
void planCreated();
|
void planCreated();
|
||||||
void setEnabledToolbar(bool arg1);
|
void setEnabledToolbar(bool arg1);
|
||||||
void setPlanNotes();
|
void setPlanNotes();
|
||||||
|
void startSpinner();
|
||||||
|
void stopSpinner();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
@ -244,6 +246,7 @@ private:
|
||||||
QHash<QByteArray, PropertiesForQuadrant> stateProperties;
|
QHash<QByteArray, PropertiesForQuadrant> stateProperties;
|
||||||
|
|
||||||
WindowTitleUpdate *wtu;
|
WindowTitleUpdate *wtu;
|
||||||
|
QtWaitingSpinner *spinner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
Loading…
Reference in a new issue