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
|
@ -16,7 +16,7 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "progressloggergui.h"
|
#include "progressloggergui.h"
|
||||||
|
|
||||||
ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
|
ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
|
||||||
|
@ -28,18 +28,19 @@ ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(p
|
||||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProgressLoggerGui::addItem(const QString &text)
|
||||||
void ProgressLoggerGui::addItem(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);
|
QListWidgetItem* item = new QListWidgetItem(text);
|
||||||
|
|
||||||
switch(flag)
|
switch(flag)
|
||||||
{
|
{
|
||||||
|
case LOGNOICON:
|
||||||
|
break;
|
||||||
case LOGOK:
|
case LOGOK:
|
||||||
item->setIcon(QIcon(":/icons/icons/go-next.png"));
|
item->setIcon(QIcon(":/icons/icons/go-next.png"));
|
||||||
break;
|
break;
|
||||||
|
@ -53,14 +54,15 @@ void ProgressLoggerGui::addItem(QString text,int flag)
|
||||||
item->setIcon(QIcon(":/icons/icons/dialog-error.png"));
|
item->setIcon(QIcon(":/icons/icons/dialog-error.png"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp.listProgress->addItem(item);
|
dp.listProgress->addItem(item);
|
||||||
}
|
dp.listProgress->scrollToItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
void ProgressLoggerGui::setProgressValue(int value)
|
void ProgressLoggerGui::setProgressValue(int value)
|
||||||
{
|
{
|
||||||
dp.progressBar->setValue(value);
|
dp.progressBar->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressLoggerGui::setProgressMax(int max)
|
void ProgressLoggerGui::setProgressMax(int max)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +72,7 @@ void ProgressLoggerGui::setProgressMax(int max)
|
||||||
int ProgressLoggerGui::getProgressMax()
|
int ProgressLoggerGui::getProgressMax()
|
||||||
{
|
{
|
||||||
return dp.progressBar->maximum();
|
return dp.progressBar->maximum();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressLoggerGui::abort()
|
void ProgressLoggerGui::abort()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,22 +18,22 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef PROGRESSLOGGERGUI_H
|
#ifndef PROGRESSLOGGERGUI_H
|
||||||
#define PROGRESSLOGGERGUI_H
|
#define PROGRESSLOGGERGUI_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#include "progressloggerinterface.h"
|
#include "progressloggerinterface.h"
|
||||||
#include "ui_installprogressfrm.h"
|
#include "ui_installprogressfrm.h"
|
||||||
|
|
||||||
class ProgressLoggerGui :public ProgressloggerInterface
|
class ProgressLoggerGui :public ProgressloggerInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProgressLoggerGui(QObject * parent);
|
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 setProgressValue(int value);
|
||||||
virtual void setProgressMax(int max);
|
virtual void setProgressMax(int max);
|
||||||
virtual int getProgressMax();
|
virtual int getProgressMax();
|
||||||
|
@ -47,8 +47,8 @@ public slots:
|
||||||
virtual void undoAbort();
|
virtual void undoAbort();
|
||||||
virtual void close();
|
virtual void close();
|
||||||
virtual void show();
|
virtual void show();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::InstallProgressFrm dp;
|
Ui::InstallProgressFrm dp;
|
||||||
QDialog *downloadProgress;
|
QDialog *downloadProgress;
|
||||||
|
|
||||||
|
|
|
@ -16,43 +16,43 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef PROGRESSLOGGERINTERFACE_H
|
#ifndef PROGRESSLOGGERINTERFACE_H
|
||||||
#define PROGRESSLOGGERINTERFACE_H
|
#define PROGRESSLOGGERINTERFACE_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#define LOGOK 1
|
enum {
|
||||||
#define LOGINFO 2
|
LOGNOICON, LOGOK, LOGINFO, LOGWARNING, LOGERROR
|
||||||
#define LOGWARNING 3
|
};
|
||||||
#define LOGERROR 4
|
|
||||||
|
|
||||||
|
|
||||||
class ProgressloggerInterface : public QObject
|
class ProgressloggerInterface : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProgressloggerInterface(QObject* parent) : QObject(parent) {}
|
ProgressloggerInterface(QObject* parent) : QObject(parent) {}
|
||||||
virtual void addItem(QString text) =0 ; //adds a string to the list
|
virtual void addItem(const 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, int flag)=0; //adds a string to the list, with icon
|
||||||
|
|
||||||
virtual void setProgressValue(int value)=0;
|
virtual void setProgressValue(int value)=0;
|
||||||
virtual void setProgressMax(int max)=0;
|
virtual void setProgressMax(int max)=0;
|
||||||
virtual int getProgressMax()=0;
|
virtual int getProgressMax()=0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
virtual void aborted()=0;
|
virtual void aborted()=0;
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void abort()=0;
|
virtual void abort()=0;
|
||||||
virtual void undoAbort() =0;
|
virtual void undoAbort()=0;
|
||||||
virtual void close()=0;
|
virtual void close()=0;
|
||||||
virtual void show()=0;
|
virtual void show()=0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue