Use the QtWaitingSpinner instead of blocking the MainTab

We shouldn't allow the user to change the location when we are probing
the web for the correct places if we are updating an old file from
Subsurface. This makes use of a pleasant spinner that works beautifully.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-17 18:50:22 -03:00 committed by Dirk Hohndel
parent c2f77353ee
commit 253d9ff300
2 changed files with 32 additions and 13 deletions

View file

@ -186,6 +186,15 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.socialNetworks->setVisible(false);
#endif
ui.waitingSpinner->setRoundness(70.0);
ui.waitingSpinner->setMinimumTrailOpacity(15.0);
ui.waitingSpinner->setTrailFadePercentage(70.0);
ui.waitingSpinner->setNumberOfLines(8);
ui.waitingSpinner->setLineLength(5);
ui.waitingSpinner->setLineWidth(3);
ui.waitingSpinner->setInnerRadius(5);
ui.waitingSpinner->setRevolutionsPerSecond(1);
acceptingEdit = false;
}
@ -202,12 +211,14 @@ MainTab::~MainTab()
void MainTab::enableGeoLoockupEdition()
{
setEnabled(true);
ui.waitingSpinner->stop();
ui.manageDiveSite->show();
}
void MainTab::disableGeoLoockupEdition()
{
setDisabled(true);
ui.waitingSpinner->start();
ui.manageDiveSite->hide();
}
void MainTab::prepareDiveSiteEdit() {
@ -407,7 +418,7 @@ void MainTab::updateDiveInfo(bool clear)
// don't execute this while adding / planning a dive
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics()->isPlanner())
return;
if (!isEnabled() && !clear && !ReverseGeoLoockupThread::instance()->isRunning())
if (!isEnabled() && !clear )
setEnabled(true);
if (isEnabled() && clear)
setEnabled(false);

View file

@ -22,8 +22,7 @@
<number>0</number>
</property>
<item row="2" column="1">
<widget class="KMessageWidget" name="diveNotesMessage" native="true">
</widget>
<widget class="KMessageWidget" name="diveNotesMessage" native="true"/>
</item>
<item row="3" column="1">
<widget class="QScrollArea" name="scrollArea">
@ -41,8 +40,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>753</height>
<width>417</width>
<height>744</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -142,6 +141,9 @@
</property>
</widget>
</item>
<item>
<widget class="QtWaitingSpinner" name="waitingSpinner" native="true"/>
</item>
</layout>
</item>
<item>
@ -385,8 +387,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>68</width>
<height>40</height>
<width>98</width>
<height>55</height>
</rect>
</property>
<layout class="QGridLayout" name="equipmentTabScrollAreaLayout">
@ -441,8 +443,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>363</height>
<width>330</width>
<height>334</height>
</rect>
</property>
<layout class="QGridLayout" name="diveInfoScrollAreaLayout">
@ -758,8 +760,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>215</height>
<width>328</width>
<height>208</height>
</rect>
</property>
<layout class="QGridLayout" name="statsScrollAreaLayout">
@ -1009,6 +1011,12 @@
<extends>QListView</extends>
<header>divepicturewidget.h</header>
</customwidget>
<customwidget>
<class>QtWaitingSpinner</class>
<extends>QWidget</extends>
<header>qtwaitingspinner.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>dateEdit</tabstop>