1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #4 from tux3/master

Rebase on upstream
This commit is contained in:
F1ynn 2014-07-04 23:11:34 -07:00
commit 6132c66d77
11 changed files with 341 additions and 24 deletions

View File

@ -334,6 +334,7 @@ void Core::requestFriendship(const QString& friendAddress, const QString& messag
} else {
emit friendAdded(friendId, userId);
}
saveConfiguration();
}
void Core::sendMessage(int friendId, const QString& message)

BIN
debug/filetransfertwidget.o Normal file

Binary file not shown.

View File

@ -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>

View File

@ -4,7 +4,7 @@
#
#-------------------------------------------------
QT += core gui multimedia multimediawidgets
QT += core gui network multimedia multimediawidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = toxgui

View 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
View File

@ -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>

View File

@ -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);
@ -113,7 +120,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
textLayout->addWidget(size);
textLayout->addWidget(speed);
textLayout->addWidget(eta);
textLayout->setMargin(0);
textLayout->setMargin(2);
textLayout->setSpacing(5);
buttonLayout->addWidget(topright);
@ -164,6 +171,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 +183,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 +202,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 +265,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);
}

View File

@ -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

View File

@ -88,7 +88,11 @@ void AddFriendForm::handleDnsLookup()
{
const QString idKeyWord("id=");
if (dns.error() != QDnsLookup::NoError) {
if (dns.error() == QDnsLookup::NotFoundError) {
showWarning(tr("This address does not exist","The DNS gives the Tox ID associated to toxme.se addresses"));
return;
}
else if (dns.error() != QDnsLookup::NoError) {
showWarning(tr("Error while looking up DNS","The DNS gives the Tox ID associated to toxme.se addresses"));
return;
}

View File

@ -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);

View File

@ -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);
@ -214,8 +212,8 @@ Widget::Widget(QWidget *parent) :
connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString)));
connect(ui->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString)));
connect(ui->statImg, SIGNAL(clicked()), this, SLOT(onStatusImgClicked()));
connect(&settingsForm.name, SIGNAL(textChanged(QString)), this, SLOT(onUsernameChanged(QString)));
connect(&settingsForm.statusText, SIGNAL(textChanged(QString)), this, SLOT(onStatusMessageChanged(QString)));
connect(&settingsForm.name, SIGNAL(textEdited(QString)), this, SLOT(onUsernameChanged(QString)));
connect(&settingsForm.statusText, SIGNAL(textEdited(QString)), this, SLOT(onStatusMessageChanged(QString)));
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
coreThread->start();
@ -431,7 +429,6 @@ void Widget::addFriend(int friendId, const QString &userId)
connect(core, &Core::avEnding, newfriend->chatForm, &ChatForm::onAvEnding);
connect(core, &Core::avRequestTimeout, newfriend->chatForm, &ChatForm::onAvRequestTimeout);
connect(core, &Core::avPeerTimeout, newfriend->chatForm, &ChatForm::onAvPeerTimeout);
core->saveConfiguration();
}
void Widget::addFriendFailed(const QString&)