Changend Uploads columns order

Changend Uploads Progressbar color

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1425 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-07-24 22:39:34 +00:00
parent 313d25e559
commit c3cc5c22ce
5 changed files with 98 additions and 60 deletions

View file

@ -117,7 +117,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
ULListModel = new QStandardItemModel(0,7); ULListModel = new QStandardItemModel(0,7);
ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name")); ULListModel->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
ULListModel->setHeaderData(USIZE, Qt::Horizontal, tr("Size", "i.e: file size")); ULListModel->setHeaderData(USIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
ULListModel->setHeaderData(USERNAME, Qt::Horizontal, tr("User Name", "i.e: user name")); ULListModel->setHeaderData(USERNAME, Qt::Horizontal, tr("Peer", "i.e: user name"));
ULListModel->setHeaderData(UPROGRESS, Qt::Horizontal, tr("Progress", "i.e: % uploaded")); ULListModel->setHeaderData(UPROGRESS, Qt::Horizontal, tr("Progress", "i.e: % uploaded"));
ULListModel->setHeaderData(ULSPEED, Qt::Horizontal, tr("Speed", "i.e: upload speed")); ULListModel->setHeaderData(ULSPEED, Qt::Horizontal, tr("Speed", "i.e: upload speed"));
ULListModel->setHeaderData(USTATUS, Qt::Horizontal, tr("Status")); ULListModel->setHeaderData(USTATUS, Qt::Horizontal, tr("Status"));
@ -131,32 +131,35 @@ TransfersDialog::TransfersDialog(QWidget *parent)
ui.uploadsList->setRootIsDecorated(false); ui.uploadsList->setRootIsDecorated(false);
//Selection Setup //Selection Setup
//selection = ui.uploadsList->selectionModel(); selection = ui.uploadsList->selectionModel();
ui.uploadsList->setSelectionMode(QAbstractItemView::ExtendedSelection);
/* Set header resize modes and initial section sizes Uploads TreeView*/ /* Set header resize modes and initial section sizes Uploads TreeView*/
// QHeaderView * upheader = ui.uploadsList->header () ; QHeaderView * upheader = ui.uploadsList->header () ;
// upheader->setResizeMode (0, QHeaderView::Interactive); /*Name */ upheader->setResizeMode (UNAME, QHeaderView::Interactive);
// upheader->setResizeMode (1, QHeaderView::Interactive); /*Size */ upheader->setResizeMode (USIZE, QHeaderView::Interactive);
// upheader->setResizeMode (2, QHeaderView::Interactive); /*User Name*/ upheader->setResizeMode (UTRANSFERRED, QHeaderView::Interactive);
// upheader->setResizeMode (3, QHeaderView::Interactive); /*Progress*/ upheader->setResizeMode (ULSPEED, QHeaderView::Interactive);
// upheader->setResizeMode (4, QHeaderView::Interactive); /*Speed */ upheader->setResizeMode (UPROGRESS, QHeaderView::Interactive);
// upheader->setResizeMode (5, QHeaderView::Interactive); /*Status*/ upheader->setResizeMode (USTATUS, QHeaderView::Interactive);
// upheader->setResizeMode (6, QHeaderView::Interactive); /*Transferred*/ upheader->setResizeMode (USERNAME, QHeaderView::Interactive);
//
// upheader->resizeSection ( 0, 100 ); /*Name */ upheader->resizeSection ( UNAME, 170 );
// upheader->resizeSection ( 1, 75 ); /*Size */ upheader->resizeSection ( USIZE, 70 );
// upheader->resizeSection ( 2, 100 ); /*User Name*/ upheader->resizeSection ( UTRANSFERRED, 75 );
// upheader->resizeSection ( 3, 100 ); /*Progress*/ upheader->resizeSection ( ULSPEED, 75 );
// upheader->resizeSection ( 4, 75 ); /*Speed */ upheader->resizeSection ( UPROGRESS, 170 );
// upheader->resizeSection ( 5, 100 ); /*Status*/ upheader->resizeSection ( USTATUS, 100 );
// upheader->resizeSection ( 6, 75 ); /*Transferred*/ upheader->resizeSection ( USERNAME, 75 );
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
#endif #endif
} }
void TransfersDialog::keyPressEvent(QKeyEvent *e) void TransfersDialog::keyPressEvent(QKeyEvent *e)
@ -451,11 +454,11 @@ int TransfersDialog::addUploadItem(QString symbol, QString name, QString coreID,
ULListModel->setData(ULListModel->index(row, UNAME), QVariant((QString)name), Qt::DisplayRole); ULListModel->setData(ULListModel->index(row, UNAME), QVariant((QString)name), Qt::DisplayRole);
ULListModel->setData(ULListModel->index(row, USIZE), QVariant((qlonglong)fileSize)); ULListModel->setData(ULListModel->index(row, USIZE), QVariant((qlonglong)fileSize));
ULListModel->setData(ULListModel->index(row, USERNAME), QVariant((QString)sources));
ULListModel->setData(ULListModel->index(row, UPROGRESS), QVariant((double)progress));
ULListModel->setData(ULListModel->index(row, ULSPEED), QVariant((double)dlspeed));
ULListModel->setData(ULListModel->index(row, USTATUS), QVariant((QString)status));
ULListModel->setData(ULListModel->index(row, UTRANSFERRED), QVariant((qlonglong)completed)); ULListModel->setData(ULListModel->index(row, UTRANSFERRED), QVariant((qlonglong)completed));
ULListModel->setData(ULListModel->index(row, ULSPEED), QVariant((double)dlspeed));
ULListModel->setData(ULListModel->index(row, UPROGRESS), QVariant((double)progress));
ULListModel->setData(ULListModel->index(row, USTATUS), QVariant((QString)status));
ULListModel->setData(ULListModel->index(row, USERNAME), QVariant((QString)sources));
return row; return row;
} }

View file

@ -125,7 +125,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
{ {
progress = index.data().toDouble(); progress = index.data().toDouble();
// create a xProgressBar // create a xProgressBar
xProgressBar progressBar(option.rect, painter); // the 3rd param is the color schema (0 is the default value) xProgressBar progressBar(option.rect, painter, 8); // the 3rd param is the color schema (0 is the default value)
progressBar.setDisplayText(false); // should display % text? progressBar.setDisplayText(false); // should display % text?
progressBar.setValue(progress); // set the progress value progressBar.setValue(progress); // set the progress value
progressBar.setVerticalSpan(1); progressBar.setVerticalSpan(1);

View file

@ -26,13 +26,14 @@
#include "xprogressbar.h" #include "xprogressbar.h"
// Defines for upload list list columns // Defines for upload list list columns
#define USERNAME 0 #define UNAME 0
#define UNAME 1 #define USIZE 1
#define ULSPEED 2 #define UTRANSFERRED 2
#define UTRANSFERRED 3 #define ULSPEED 3
#define UPROGRESS 4 #define UPROGRESS 4
#define USTATUS 5 #define USTATUS 5
#define USIZE 6 #define USERNAME 6
#define MAX_CHAR_TMP 128 #define MAX_CHAR_TMP 128

View file

@ -7,21 +7,21 @@
* v1.0: * v1.0:
* ----- * -----
* - First release * - First release
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include "xprogressbar.h" #include "xprogressbar.h"
@ -143,6 +143,32 @@ void xProgressBar::setColor()
gradColor2.setRgb(248, 170, 59); gradColor2.setRgb(248, 170, 59);
// ok // ok
break; break;
/* clean schema */
case 8:
// background
backgroundBorderColor.setRgb(143, 180, 219);
backgroundColor.setRgb(198, 209, 221);
// progress
gradBorderColor.setRgb(209, 128, 24);
gradColor1.setRgb(246, 199, 138);
gradColor2.setRgb(255, 227, 190);
// ok
break;
/* light gray */
case 9:
// background
backgroundBorderColor.setRgb(194, 194, 194);
backgroundColor.setRgb(232, 233, 233);
// progress
gradBorderColor.setRgb(176, 176, 176);
gradColor1.setRgb(201, 201, 201);
gradColor2.setRgb(223, 223, 223);
// set text color (white is not a good option)
textColor = QColor(58, 58, 58);
// ok
break;
} }
} }
@ -179,6 +205,13 @@ void xProgressBar::paint()
} }
} }
void xProgressBar::setColorSchema(const int value)
{
schemaIndex = value;
// set the progress bar colors
setColor();
}
void xProgressBar::setValue(const float value) void xProgressBar::setValue(const float value)
{ {
progressValue = value < 0 ? 0 : value > 100 ? 100 : value; progressValue = value < 0 ? 0 : value > 100 ? 100 : value;

View file

@ -7,21 +7,21 @@
* v1.0: * v1.0:
* ----- * -----
* - First release * - First release
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#ifndef XPROGRESSBAR_H #ifndef XPROGRESSBAR_H
@ -59,6 +59,7 @@ Q_OBJECT
public: public:
xProgressBar(QRect rect, QPainter *painter, int schemaIndex = 0); xProgressBar(QRect rect, QPainter *painter, int schemaIndex = 0);
void paint(); void paint();
void setColorSchema(const int value);
void setValue(const float value); void setValue(const float value);
void setDisplayText(const bool display); void setDisplayText(const bool display);
void setVerticalSpan(const int value); void setVerticalSpan(const int value);