mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #80 from F1ynn/fix-widget-win8
Small widget improvements
This commit is contained in:
commit
8e46c78068
BIN
debug/filetransfertwidget.o
Normal file
BIN
debug/filetransfertwidget.o
Normal file
Binary file not shown.
1
res.qrc
1
res.qrc
|
@ -102,5 +102,6 @@
|
|||
<file>img/status/dot_busy_notification.png</file>
|
||||
<file>translations/fr.qm</file>
|
||||
<file>translations/ru.qm</file>
|
||||
<file>ui/fileTransferWidget/fileTransferWidget.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
26
ui/fileTransferWidget/fileTransferWidget.css
Normal file
26
ui/fileTransferWidget/fileTransferWidget.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
#default {
|
||||
border-top-left-radius: 6px;
|
||||
border-bottom-left-radius: 6px;
|
||||
background-color: rgb(209,209,209);
|
||||
}
|
||||
|
||||
#error {
|
||||
border-radius: 6px;
|
||||
background-color: rgb(200,78,78);
|
||||
}
|
||||
|
||||
#success {
|
||||
background-color: rgb(107,194,96);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
QProgressBar {
|
||||
background-color: transparent;
|
||||
border: 1px solid black;
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
background-color: black;
|
||||
width: 2px;
|
||||
}
|
272
widget.ui
272
widget.ui
|
@ -243,6 +243,51 @@
|
|||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
|
@ -261,8 +306,80 @@
|
|||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
|
@ -281,8 +398,80 @@
|
|||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
|
@ -301,12 +490,57 @@
|
|||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QSplitter{
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: rgb(255, 255, 255);
|
||||
alternate-background-color: rgb(255, 255, 255);
|
||||
border-color: rgb(255, 255, 255);
|
||||
gridline-color: rgb(255, 255, 255);
|
||||
selection-color: rgb(255, 255, 255);
|
||||
selection-background-color: rgb(255, 255, 255);
|
||||
}
|
||||
QSplitter:handle{
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: rgb(255, 255, 255);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -781,7 +1015,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -1252,6 +1495,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="EditableLabelWidget" name="nameLabel">
|
||||
<property name="enabled">
|
||||
|
@ -1845,7 +2091,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>258</width>
|
||||
<width>256</width>
|
||||
<height>199</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -2291,7 +2537,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -2892,7 +3147,16 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "math.h"
|
||||
#include <QFileDialog>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
|
||||
FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
||||
: lastUpdate{QDateTime::currentDateTime()}, lastBytesSent{0},
|
||||
|
@ -17,6 +18,11 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
|||
buttonWidget = new QWidget();
|
||||
QFont prettysmall;
|
||||
prettysmall.setPixelSize(10);
|
||||
this->setObjectName("default");
|
||||
QFile f0(":/ui/fileTransferWidget/fileTransferWidget.css");
|
||||
f0.open(QFile::ReadOnly | QFile::Text);
|
||||
QTextStream fileTransfertWidgetStylesheet(&f0);
|
||||
this->setStyleSheet(fileTransfertWidgetStylesheet.readAll());
|
||||
QPalette greybg;
|
||||
greybg.setColor(QPalette::Window, QColor(209,209,209));
|
||||
greybg.setColor(QPalette::Base, QColor(150,150,150));
|
||||
|
@ -41,6 +47,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
|||
progress->setValue(0);
|
||||
progress->setMinimumHeight(11);
|
||||
progress->setFont(prettysmall);
|
||||
progress->setTextVisible(false);
|
||||
QPalette whitebg;
|
||||
whitebg.setColor(QPalette::Window, QColor(255,255,255));
|
||||
buttonWidget->setPalette(whitebg);
|
||||
|
@ -111,9 +118,11 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
|||
infoLayout->setSpacing(4);
|
||||
|
||||
textLayout->addWidget(size);
|
||||
textLayout->addStretch(.5);
|
||||
textLayout->addWidget(speed);
|
||||
textLayout->addStretch(.5);
|
||||
textLayout->addWidget(eta);
|
||||
textLayout->setMargin(0);
|
||||
textLayout->setMargin(2);
|
||||
textLayout->setSpacing(5);
|
||||
|
||||
buttonLayout->addWidget(topright);
|
||||
|
@ -164,6 +173,7 @@ void FileTransfertWidget::onFileTransferCancelled(int FriendId, int FileNum, Tox
|
|||
{
|
||||
if (FileNum != fileNum || FriendId != friendId || Direction != direction)
|
||||
return;
|
||||
buttonLayout->setContentsMargins(0,0,0,0);
|
||||
disconnect(topright);
|
||||
disconnect(Widget::getInstance()->getCore(),0,this,0);
|
||||
progress->hide();
|
||||
|
@ -175,9 +185,12 @@ void FileTransfertWidget::onFileTransferCancelled(int FriendId, int FileNum, Tox
|
|||
whiteText.setColor(QPalette::WindowText, Qt::white);
|
||||
filename->setPalette(whiteText);
|
||||
size->setPalette(whiteText);
|
||||
QPalette toxred;
|
||||
toxred.setColor(QPalette::Window, QColor(200,78,78)); // Tox Red
|
||||
setPalette(toxred);
|
||||
this->setObjectName("error");
|
||||
this->style()->polish(this);
|
||||
|
||||
//Toggle window visibility to fix draw order bug
|
||||
this->hide();
|
||||
this->show();
|
||||
}
|
||||
|
||||
void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
||||
|
@ -191,14 +204,17 @@ void FileTransfertWidget::onFileTransferFinished(ToxFile File)
|
|||
eta->hide();
|
||||
topright->hide();
|
||||
bottomright->hide();
|
||||
buttonLayout->setContentsMargins(0,0,0,0);
|
||||
QPalette whiteText;
|
||||
whiteText.setColor(QPalette::WindowText, Qt::white);
|
||||
filename->setPalette(whiteText);
|
||||
size->setPalette(whiteText);
|
||||
// TODO: Maybe just replace the whole buttonWidget with a single round CSS that shows the accept icon
|
||||
QPalette toxgreen;
|
||||
toxgreen.setColor(QPalette::Window, QColor(107,194,96)); // Tox Green
|
||||
setPalette(toxgreen);
|
||||
this->setObjectName("success");
|
||||
this->style()->polish(this);
|
||||
|
||||
//Toggle window visibility to fix draw order bug
|
||||
this->hide();
|
||||
this->show();
|
||||
|
||||
if (File.direction == ToxFile::RECEIVING)
|
||||
{
|
||||
|
@ -251,3 +267,11 @@ void FileTransfertWidget::pauseResumeSend()
|
|||
{
|
||||
Widget::getInstance()->getCore()->pauseResumeFileSend(friendId, fileNum);
|
||||
}
|
||||
|
||||
void FileTransfertWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ struct ToxFile;
|
|||
class FileTransfertWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileTransfertWidget(ToxFile File);
|
||||
|
||||
|
@ -48,6 +49,7 @@ private:
|
|||
QString savePath;
|
||||
ToxFile::FileDirection direction;
|
||||
QString stopFileButtonStylesheet, pauseFileButtonStylesheet, acceptFileButtonStylesheet;
|
||||
void paintEvent(QPaintEvent *);
|
||||
};
|
||||
|
||||
#endif // FILETRANSFERTWIDGET_H
|
||||
|
|
|
@ -55,11 +55,11 @@ EditableLabelWidget::EditableLabelWidget(QWidget* parent) :
|
|||
lineEdit->setMinimumHeight(label->fontMetrics().lineSpacing() + LINE_SPACING_OFFSET);
|
||||
|
||||
// Set dark background for >windows
|
||||
QColor toxDarkAsMySoul(28,28,28);
|
||||
QPalette darkPal;
|
||||
darkPal.setColor(QPalette::Window, toxDarkAsMySoul);
|
||||
darkPal.setColor(QPalette::Base, toxDarkAsMySoul);
|
||||
lineEdit->setPalette(darkPal);
|
||||
//QColor toxDarkAsMySoul(28,28,28);
|
||||
//QPalette darkPal;
|
||||
//darkPal.setColor(QPalette::Window, toxDarkAsMySoul);
|
||||
//darkPal.setColor(QPalette::Base, toxDarkAsMySoul);
|
||||
//lineEdit->setPalette(darkPal);
|
||||
|
||||
connect(lineEdit, &EscLineEdit::editingFinished, this, &EditableLabelWidget::onLabelChangeSubmited);
|
||||
connect(lineEdit, &EscLineEdit::escPressed, this, &EditableLabelWidget::onLabelChangeCancelled);
|
||||
|
|
|
@ -138,7 +138,6 @@ Widget::Widget(QWidget *parent) :
|
|||
friendListWidget->layout()->setSpacing(0);
|
||||
friendListWidget->layout()->setMargin(0);
|
||||
friendListWidget->setLayoutDirection(Qt::LeftToRight);
|
||||
//friendListWidget->
|
||||
ui->friendList->setWidget(friendListWidget);
|
||||
|
||||
ui->nameLabel->setText(Settings::getInstance().getUsername());
|
||||
|
@ -146,7 +145,6 @@ Widget::Widget(QWidget *parent) :
|
|||
ui->statusLabel->setText(Settings::getInstance().getStatusMessage());
|
||||
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
||||
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
ui->centralWidget->setStyleSheet("QSplitter{background-color: white;}");
|
||||
|
||||
this->setMouseTracking(true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user