Abstract out progress dialog.
authorAkos Polster <akos@pipacs.com>
Fri, 29 Oct 2010 23:42:08 +0000 (01:42 +0200)
committerAkos Polster <akos@pipacs.com>
Fri, 29 Oct 2010 23:42:08 +0000 (01:42 +0200)
dorian.pro
librarydialog.cpp
librarydialog.h
mainwindow.cpp
mainwindow.h
searchresultinfodialog.cpp
widgets/progressdialog.cpp [new file with mode: 0644]
widgets/progressdialog.h [new file with mode: 0644]

index eb938a8..1688435 100644 (file)
@@ -38,7 +38,8 @@ SOURCES += \
     widgets/flickable.cpp \
     widgets/listview.cpp \
     searchresultsdialog.cpp \
-    searchresultinfodialog.cpp
+    searchresultinfodialog.cpp \
+    widgets/progressdialog.cpp
 
 HEADERS += \
     mainwindow.h \
@@ -78,7 +79,8 @@ HEADERS += \
     search.h \
     widgets/flickable.h \
     searchresultsdialog.h \
-    searchresultinfodialog.h
+    searchresultinfodialog.h \
+    widgets/progressdialog.h
 
 RESOURCES += \
     dorian.qrc
index c6e7e24..6d4f5fe 100644 (file)
@@ -21,6 +21,7 @@
 #include "searchdialog.h"
 #include "platform.h"
 #include "searchresultsdialog.h"
+#include "progressdialog.h"
 
 LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
 {
@@ -49,7 +50,7 @@ LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
     setSelected(current);
     addList(list);
 
-    progress = new QProgressDialog(tr("Adding books"), "", 0, 0, this);
+    progress = new ProgressDialog(tr("Adding books"), this);
     progress->reset();
     progress->setMinimumDuration(0);
     progress->setWindowModality(Qt::WindowModal);
index 6af37b3..52b0deb 100644 (file)
@@ -11,7 +11,7 @@ class ListView;
 class QPushButton;
 class QModelIndex;
 class QCloseEvent;
-class QProgressDialog;
+class ProgressDialog;
 class Book;
 class InfoWindow;
 class SortedLibrary;
@@ -47,7 +47,7 @@ private:
     QModelIndex selected() const;
     ListView *list;
     SortedLibrary *sortedLibrary;
-    QProgressDialog *progress;
+    ProgressDialog *progress;
     SearchDialog *searchDialog;
 };
 
index 2ef654e..aab4ca0 100755 (executable)
@@ -35,6 +35,7 @@
 #include "dyalog.h"
 #include "translucentbutton.h"
 #include "platform.h"
+#include "progressdialog.h"
 
 #ifdef DORIAN_TEST_MODEL
 #   include "modeltest.h"
@@ -116,7 +117,7 @@ MainWindow::MainWindow(QWidget *parent):
             this, SLOT(onCurrentBookChanged()));
 
     // Load library, upgrade it if needed
-    libraryProgress = new QProgressDialog(tr("Upgrading library"), "", 0, 0, this);
+    libraryProgress = new ProgressDialog(tr("Upgrading library"), this);
     libraryProgress->reset();
     libraryProgress->setMinimumDuration(0);
     libraryProgress->setWindowModality(Qt::WindowModal);
index 3a40286..82c7f98 100755 (executable)
@@ -12,6 +12,7 @@ class BookView;
 class Book;
 class FullScreenWindow;
 class Progress;
+class ProgressDialog;
 class TranslucentButton;
 
 class MainWindow: public AdopterWindow
@@ -73,7 +74,7 @@ private:
     Progress *progress;
     TranslucentButton *previousButton;
     TranslucentButton *nextButton;
-    QProgressDialog *libraryProgress;
+    ProgressDialog *libraryProgress;
 };
 
 #endif // MAINWINDOW_H
index 4825a58..2ba2350 100644 (file)
@@ -8,7 +8,7 @@ SearchResultInfoDialog::SearchResultInfoDialog(const Search::Result &result_,
                                                QWidget *parent):
     Dyalog(parent), result(result_)
 {
-    setWindowTitle(tr("Book Details"));
+    setWindowTitle(tr("Download Book?"));
 
     QLabel *title = new QLabel(result.title, this);
     addWidget(title);
diff --git a/widgets/progressdialog.cpp b/widgets/progressdialog.cpp
new file mode 100644 (file)
index 0000000..7ea0b99
--- /dev/null
@@ -0,0 +1,9 @@
+#include <QString>
+#include <QtGui>
+
+#include "progressdialog.h"
+
+ProgressDialog::ProgressDialog(const QString &label, QWidget *parent):
+    QProgressDialog(label, "", 0, 0, parent)
+{
+}
diff --git a/widgets/progressdialog.h b/widgets/progressdialog.h
new file mode 100644 (file)
index 0000000..ed7a43e
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef PROGRESSDIALOG_H
+#define PROGRESSDIALOG_H
+
+#include <QString>
+#include <QProgressDialog>
+
+class ProgressDialog: public QProgressDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ProgressDialog(const QString &label, QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // PROGRESSDIALOG_H