forked from len0rd/rockbox
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
This commit is contained in:
parent
4bcd0fa2d4
commit
78d7ece5e9
3 changed files with 40 additions and 38 deletions
|
@ -28,18 +28,19 @@ ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(p
|
|||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
||||
}
|
||||
|
||||
|
||||
void ProgressLoggerGui::addItem(QString text)
|
||||
void ProgressLoggerGui::addItem(const QString &text)
|
||||
{
|
||||
dp.listProgress->addItem(text);
|
||||
addItem(text, LOGNOICON);
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::addItem(QString text,int flag)
|
||||
void ProgressLoggerGui::addItem(const QString &text, int flag)
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(text);
|
||||
|
||||
switch(flag)
|
||||
{
|
||||
case LOGNOICON:
|
||||
break;
|
||||
case LOGOK:
|
||||
item->setIcon(QIcon(":/icons/icons/go-next.png"));
|
||||
break;
|
||||
|
@ -55,6 +56,7 @@ void ProgressLoggerGui::addItem(QString text,int flag)
|
|||
}
|
||||
|
||||
dp.listProgress->addItem(item);
|
||||
dp.listProgress->scrollToItem(item);
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::setProgressValue(int value)
|
||||
|
|
|
@ -30,9 +30,9 @@ class ProgressLoggerGui :public ProgressloggerInterface
|
|||
public:
|
||||
ProgressLoggerGui(QObject * parent);
|
||||
|
||||
virtual void addItem(QString text) ; //adds a string to the list
|
||||
virtual void addItem(const QString &text); //adds a string to the list
|
||||
|
||||
virtual void addItem(QString text, int flag) ; //adds a string to the list
|
||||
virtual void addItem(const QString &text, int flag); //adds a string to the list
|
||||
|
||||
virtual void setProgressValue(int value);
|
||||
virtual void setProgressMax(int max);
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
#include <QtGui>
|
||||
|
||||
#define LOGOK 1
|
||||
#define LOGINFO 2
|
||||
#define LOGWARNING 3
|
||||
#define LOGERROR 4
|
||||
enum {
|
||||
LOGNOICON, LOGOK, LOGINFO, LOGWARNING, LOGERROR
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ProgressloggerInterface : public QObject
|
||||
|
@ -34,8 +34,8 @@ class ProgressloggerInterface : public QObject
|
|||
|
||||
public:
|
||||
ProgressloggerInterface(QObject* parent) : QObject(parent) {}
|
||||
virtual void addItem(QString text) =0 ; //adds a string to the list
|
||||
virtual void addItem(QString text,int flag) =0 ; //adds a string to the list, with icon
|
||||
virtual void addItem(const QString &text)=0; //adds a string to the list
|
||||
virtual void addItem(const QString &text, int flag)=0; //adds a string to the list, with icon
|
||||
|
||||
virtual void setProgressValue(int value)=0;
|
||||
virtual void setProgressMax(int max)=0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue