diff options
author | Antoine Cellerier <dionoea@videolan.org> | 2007-09-15 22:13:41 +0000 |
---|---|---|
committer | Antoine Cellerier <dionoea@videolan.org> | 2007-09-15 22:13:41 +0000 |
commit | 78d7ece5e914c3f307c42aea2dbb36cf33e7d81c (patch) | |
tree | 160b5d8260461456c9db3ab9ed275096b44d21de /rbutil/rbutilqt | |
parent | 4bcd0fa2d4a64b6c90c5d07b35001e967bd6ec60 (diff) | |
download | rockbox-78d7ece5e914c3f307c42aea2dbb36cf33e7d81c.tar.gz rockbox-78d7ece5e914c3f307c42aea2dbb36cf33e7d81c.zip |
Automatically scroll to the last line of the progress logger when adding a new item.
Cosmetics.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/progressloggergui.cpp | 24 | ||||
-rw-r--r-- | rbutil/rbutilqt/progressloggergui.h | 18 | ||||
-rw-r--r-- | rbutil/rbutilqt/progressloggerinterface.h | 36 |
3 files changed, 40 insertions, 38 deletions
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp index 5bf7b92aaa..0d3fcb4187 100644 --- a/rbutil/rbutilqt/progressloggergui.cpp +++ b/rbutil/rbutilqt/progressloggergui.cpp | |||
@@ -16,7 +16,7 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "progressloggergui.h" | 20 | #include "progressloggergui.h" |
21 | 21 | ||
22 | ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent) | 22 | ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent) |
@@ -28,18 +28,19 @@ ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(p | |||
28 | connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); | 28 | connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort())); |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | void ProgressLoggerGui::addItem(const QString &text) | |
32 | void ProgressLoggerGui::addItem(QString text) | ||
33 | { | 32 | { |
34 | dp.listProgress->addItem(text); | 33 | addItem(text, LOGNOICON); |
35 | } | 34 | } |
36 | 35 | ||
37 | void ProgressLoggerGui::addItem(QString text,int flag) | 36 | void ProgressLoggerGui::addItem(const QString &text, int flag) |
38 | { | 37 | { |
39 | QListWidgetItem* item = new QListWidgetItem(text); | 38 | QListWidgetItem* item = new QListWidgetItem(text); |
40 | 39 | ||
41 | switch(flag) | 40 | switch(flag) |
42 | { | 41 | { |
42 | case LOGNOICON: | ||
43 | break; | ||
43 | case LOGOK: | 44 | case LOGOK: |
44 | item->setIcon(QIcon(":/icons/icons/go-next.png")); | 45 | item->setIcon(QIcon(":/icons/icons/go-next.png")); |
45 | break; | 46 | break; |
@@ -53,14 +54,15 @@ void ProgressLoggerGui::addItem(QString text,int flag) | |||
53 | item->setIcon(QIcon(":/icons/icons/dialog-error.png")); | 54 | item->setIcon(QIcon(":/icons/icons/dialog-error.png")); |
54 | break; | 55 | break; |
55 | } | 56 | } |
56 | 57 | ||
57 | dp.listProgress->addItem(item); | 58 | dp.listProgress->addItem(item); |
58 | } | 59 | dp.listProgress->scrollToItem(item); |
60 | } | ||
59 | 61 | ||
60 | void ProgressLoggerGui::setProgressValue(int value) | 62 | void ProgressLoggerGui::setProgressValue(int value) |
61 | { | 63 | { |
62 | dp.progressBar->setValue(value); | 64 | dp.progressBar->setValue(value); |
63 | } | 65 | } |
64 | 66 | ||
65 | void ProgressLoggerGui::setProgressMax(int max) | 67 | void ProgressLoggerGui::setProgressMax(int max) |
66 | { | 68 | { |
@@ -70,7 +72,7 @@ void ProgressLoggerGui::setProgressMax(int max) | |||
70 | int ProgressLoggerGui::getProgressMax() | 72 | int ProgressLoggerGui::getProgressMax() |
71 | { | 73 | { |
72 | return dp.progressBar->maximum(); | 74 | return dp.progressBar->maximum(); |
73 | } | 75 | } |
74 | 76 | ||
75 | void ProgressLoggerGui::abort() | 77 | void ProgressLoggerGui::abort() |
76 | { | 78 | { |
diff --git a/rbutil/rbutilqt/progressloggergui.h b/rbutil/rbutilqt/progressloggergui.h index e7ccce8d33..17483150f3 100644 --- a/rbutil/rbutilqt/progressloggergui.h +++ b/rbutil/rbutilqt/progressloggergui.h | |||
@@ -18,22 +18,22 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #ifndef PROGRESSLOGGERGUI_H | 19 | #ifndef PROGRESSLOGGERGUI_H |
20 | #define PROGRESSLOGGERGUI_H | 20 | #define PROGRESSLOGGERGUI_H |
21 | 21 | ||
22 | #include <QtGui> | 22 | #include <QtGui> |
23 | 23 | ||
24 | #include "progressloggerinterface.h" | 24 | #include "progressloggerinterface.h" |
25 | #include "ui_installprogressfrm.h" | 25 | #include "ui_installprogressfrm.h" |
26 | 26 | ||
27 | class ProgressLoggerGui :public ProgressloggerInterface | 27 | class ProgressLoggerGui :public ProgressloggerInterface |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | ProgressLoggerGui(QObject * parent); | 31 | ProgressLoggerGui(QObject * parent); |
32 | 32 | ||
33 | virtual void addItem(QString text) ; //adds a string to the list | 33 | virtual void addItem(const QString &text); //adds a string to the list |
34 | 34 | ||
35 | virtual void addItem(QString text, int flag) ; //adds a string to the list | 35 | virtual void addItem(const QString &text, int flag); //adds a string to the list |
36 | 36 | ||
37 | virtual void setProgressValue(int value); | 37 | virtual void setProgressValue(int value); |
38 | virtual void setProgressMax(int max); | 38 | virtual void setProgressMax(int max); |
39 | virtual int getProgressMax(); | 39 | virtual int getProgressMax(); |
@@ -47,8 +47,8 @@ public slots: | |||
47 | virtual void undoAbort(); | 47 | virtual void undoAbort(); |
48 | virtual void close(); | 48 | virtual void close(); |
49 | virtual void show(); | 49 | virtual void show(); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | Ui::InstallProgressFrm dp; | 52 | Ui::InstallProgressFrm dp; |
53 | QDialog *downloadProgress; | 53 | QDialog *downloadProgress; |
54 | 54 | ||
diff --git a/rbutil/rbutilqt/progressloggerinterface.h b/rbutil/rbutilqt/progressloggerinterface.h index cf78bded7e..2f593540fe 100644 --- a/rbutil/rbutilqt/progressloggerinterface.h +++ b/rbutil/rbutilqt/progressloggerinterface.h | |||
@@ -16,43 +16,43 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #ifndef PROGRESSLOGGERINTERFACE_H | 20 | #ifndef PROGRESSLOGGERINTERFACE_H |
21 | #define PROGRESSLOGGERINTERFACE_H | 21 | #define PROGRESSLOGGERINTERFACE_H |
22 | 22 | ||
23 | #include <QtGui> | 23 | #include <QtGui> |
24 | 24 | ||
25 | #define LOGOK 1 | 25 | enum { |
26 | #define LOGINFO 2 | 26 | LOGNOICON, LOGOK, LOGINFO, LOGWARNING, LOGERROR |
27 | #define LOGWARNING 3 | 27 | }; |
28 | #define LOGERROR 4 | 28 | |
29 | 29 | ||
30 | 30 | ||
31 | class ProgressloggerInterface : public QObject | 31 | class ProgressloggerInterface : public QObject |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | 34 | ||
35 | public: | 35 | public: |
36 | ProgressloggerInterface(QObject* parent) : QObject(parent) {} | 36 | ProgressloggerInterface(QObject* parent) : QObject(parent) {} |
37 | virtual void addItem(QString text) =0 ; //adds a string to the list | 37 | virtual void addItem(const QString &text)=0; //adds a string to the list |
38 | virtual void addItem(QString text,int flag) =0 ; //adds a string to the list, with icon | 38 | virtual void addItem(const QString &text, int flag)=0; //adds a string to the list, with icon |
39 | 39 | ||
40 | virtual void setProgressValue(int value)=0; | 40 | virtual void setProgressValue(int value)=0; |
41 | virtual void setProgressMax(int max)=0; | 41 | virtual void setProgressMax(int max)=0; |
42 | virtual int getProgressMax()=0; | 42 | virtual int getProgressMax()=0; |
43 | 43 | ||
44 | signals: | 44 | signals: |
45 | virtual void aborted()=0; | 45 | virtual void aborted()=0; |
46 | 46 | ||
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | virtual void abort()=0; | 49 | virtual void abort()=0; |
50 | virtual void undoAbort() =0; | 50 | virtual void undoAbort()=0; |
51 | virtual void close()=0; | 51 | virtual void close()=0; |
52 | virtual void show()=0; | 52 | virtual void show()=0; |
53 | 53 | ||
54 | private: | 54 | private: |
55 | 55 | ||
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |