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->setHeaderData(UNAME, Qt::Horizontal, tr("Name", "i.e: file name"));
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(ULSPEED, Qt::Horizontal, tr("Speed", "i.e: upload speed"));
ULListModel->setHeaderData(USTATUS, Qt::Horizontal, tr("Status"));
@ -131,32 +131,35 @@ TransfersDialog::TransfersDialog(QWidget *parent)
ui.uploadsList->setRootIsDecorated(false);
//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*/
// QHeaderView * upheader = ui.uploadsList->header () ;
// upheader->setResizeMode (0, QHeaderView::Interactive); /*Name */
// upheader->setResizeMode (1, QHeaderView::Interactive); /*Size */
// upheader->setResizeMode (2, QHeaderView::Interactive); /*User Name*/
// upheader->setResizeMode (3, QHeaderView::Interactive); /*Progress*/
// upheader->setResizeMode (4, QHeaderView::Interactive); /*Speed */
// upheader->setResizeMode (5, QHeaderView::Interactive); /*Status*/
// upheader->setResizeMode (6, QHeaderView::Interactive); /*Transferred*/
//
// upheader->resizeSection ( 0, 100 ); /*Name */
// upheader->resizeSection ( 1, 75 ); /*Size */
// upheader->resizeSection ( 2, 100 ); /*User Name*/
// upheader->resizeSection ( 3, 100 ); /*Progress*/
// upheader->resizeSection ( 4, 75 ); /*Speed */
// upheader->resizeSection ( 5, 100 ); /*Status*/
// upheader->resizeSection ( 6, 75 ); /*Transferred*/
/* Set header resize modes and initial section sizes Uploads TreeView*/
QHeaderView * upheader = ui.uploadsList->header () ;
upheader->setResizeMode (UNAME, QHeaderView::Interactive);
upheader->setResizeMode (USIZE, QHeaderView::Interactive);
upheader->setResizeMode (UTRANSFERRED, QHeaderView::Interactive);
upheader->setResizeMode (ULSPEED, QHeaderView::Interactive);
upheader->setResizeMode (UPROGRESS, QHeaderView::Interactive);
upheader->setResizeMode (USTATUS, QHeaderView::Interactive);
upheader->setResizeMode (USERNAME, QHeaderView::Interactive);
upheader->resizeSection ( UNAME, 170 );
upheader->resizeSection ( USIZE, 70 );
upheader->resizeSection ( UTRANSFERRED, 75 );
upheader->resizeSection ( ULSPEED, 75 );
upheader->resizeSection ( UPROGRESS, 170 );
upheader->resizeSection ( USTATUS, 100 );
upheader->resizeSection ( USERNAME, 75 );
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
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, 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, 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;
}

View File

@ -125,7 +125,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
{
progress = index.data().toDouble();
// 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.setValue(progress); // set the progress value
progressBar.setVerticalSpan(1);

View File

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

View File

@ -7,21 +7,21 @@
* v1.0:
* -----
* - First release
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "xprogressbar.h"
@ -143,6 +143,32 @@ void xProgressBar::setColor()
gradColor2.setRgb(248, 170, 59);
// ok
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)
{
progressValue = value < 0 ? 0 : value > 100 ? 100 : value;

View File

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