Skip to content
Browse files

Use GCancellables & improve config UI

  • Loading branch information...
1 parent d3989b6 commit cc19753e1b7ed22fb727a321a52391d2993d913f @ximion committed Oct 19, 2011
View
3 data/data.qrc
@@ -315,7 +315,7 @@
<file>schema/schema-30.sql</file>
<file>schema/schema-31.sql</file>
<file>schema/schema-32.sql</file>
- <file>schema/schema-35.sql</file>
+ <file>schema/schema-35.sql</file>
<file>icons/22x22/edit-find.png</file>
<file>icons/32x32/edit-find.png</file>
<file>icons/48x48/edit-find.png</file>
@@ -347,5 +347,6 @@
<file>providers/digitallyimported-32.png</file>
<file>allthethings.png</file>
<file>globalsearch.css</file>
+ <file>tmo-banner.jpg</file>
</qresource>
</RCC>
View
BIN data/tmo-banner.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
12 src/internet/dancetagprovider.cpp
@@ -40,6 +40,7 @@ DanceTagProvider::DanceTagProvider(QObject* parent)
libdt_ = new QLibrary("dancetag", DanceTagProvider::DANCETAG_API_VERSION, this);
available_ = libdt_->load();
data_provider_.reset_without_add(new_dataprovider());
+ currentCancellable_ = NULL;
reloadSettings();
}
@@ -186,9 +187,18 @@ void DanceTagProvider::queryDancesFromFile(const char* fname, bool allowWebDB)
if ((allowWebDB) && (dances.isEmpty())) {
qLog(Debug) << "Searching the web for dances...";
+
+ if (currentCancellable_ != NULL) {
+ // Cancel prefious action
@davidsansome
davidsansome added a note Oct 30, 2011

previous?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ g_cancellable_cancel (currentCancellable_);
+ g_object_unref (currentCancellable_);
+ }
+ currentCancellable_ = g_cancellable_new ();
+
// Search the web for dances which match this song
// (Load dance info from web and write tag to file if setting set)
- _dt_file_query_db(dtFSong.get(), writeTags_, overrideTags_, NULL, song_file_query_web_database_finish, this);
+ _dt_file_query_db(dtFSong.get(), writeTags_, overrideTags_,
+ currentCancellable_, song_file_query_web_database_finish, this);
}
}
View
2 src/internet/dancetagprovider.h
@@ -27,6 +27,7 @@
#include "core/song.h"
class MimeData;
+typedef struct _GCancellable GCancellable;
class DanceTagProvider : public QObject {
Q_OBJECT
@@ -74,6 +75,7 @@ public slots:
bool overrideTags_;
Song currentSong_;
+ GCancellable *currentCancellable_;
bool setDataProviderApiKey(GObject* dt);
GObject* new_dataprovider();
View
1 src/internet/dancetagsettingspage.cpp
@@ -33,6 +33,7 @@ DanceTagSettingsPage::DanceTagSettingsPage(SettingsDialog* dialog)
{
ui_->setupUi(this);
setWindowIcon(QIcon(":/providers/dancetag.png"));
+ ui_->tmo_image->setPixmap(QPixmap(":tmo-banner.jpg"));
connect(ui_->dt_enabled, SIGNAL(toggled(bool)), this, SLOT(enableDanceTag(bool)));
}
View
109 src/internet/dancetagsettingspage.ui
@@ -16,6 +16,12 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Tanzmusik-Online.de Account Details</string>
</property>
@@ -47,7 +53,7 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="key_label">
<property name="enabled">
<bool>false</bool>
</property>
@@ -92,6 +98,67 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Project information</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="tmo_image">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Dance type information is provided by the
+&quot;Tanzmusik-Online.de&quot; database.
+You will need an API key to get this feature to work.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@davidsansome
davidsansome added a note Oct 30, 2011

This'll annoy the translators, can you edit the property's source in Designer and clean up the markup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://www.tanzmusik-online.de/registrieren&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;Register and get API key&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -115,12 +182,44 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>53</x>
- <y>243</y>
+ <x>64</x>
+ <y>183</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>71</x>
+ <y>208</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>dt_enabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>login_container</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>155</x>
+ <y>41</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>56</x>
+ <y>72</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>dt_enabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>key_label</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>81</x>
+ <y>38</y>
</hint>
<hint type="destinationlabel">
- <x>60</x>
- <y>275</y>
+ <x>33</x>
+ <y>72</y>
</hint>
</hints>
</connection>

0 comments on commit cc19753

Please sign in to comment.
Something went wrong with that request. Please try again.