mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Added proper status button
Pixels in status image are shifted slightly, but since this involves changing the .ui file it's better to merge sooner rather than later.
This commit is contained in:
parent
d1a3a42d88
commit
a31304d9e2
5
res.qrc
5
res.qrc
@ -103,5 +103,10 @@
|
|||||||
<file>translations/fr.qm</file>
|
<file>translations/fr.qm</file>
|
||||||
<file>translations/ru.qm</file>
|
<file>translations/ru.qm</file>
|
||||||
<file>ui/fileTransferWidget/fileTransferWidget.css</file>
|
<file>ui/fileTransferWidget/fileTransferWidget.css</file>
|
||||||
|
<file>ui/statusButton/dot_away.png</file>
|
||||||
|
<file>ui/statusButton/dot_busy.png</file>
|
||||||
|
<file>ui/statusButton/dot_idle.png</file>
|
||||||
|
<file>ui/statusButton/dot_online.png</file>
|
||||||
|
<file>ui/statusButton/statusButton.css</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
ui/statusButton/dot_away.png
Normal file
BIN
ui/statusButton/dot_away.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
BIN
ui/statusButton/dot_busy.png
Normal file
BIN
ui/statusButton/dot_busy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 292 B |
BIN
ui/statusButton/dot_idle.png
Normal file
BIN
ui/statusButton/dot_idle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 333 B |
BIN
ui/statusButton/dot_online.png
Normal file
BIN
ui/statusButton/dot_online.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 B |
20
ui/statusButton/statusButton.css
Normal file
20
ui/statusButton/statusButton.css
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
background: none;
|
||||||
|
background-color: rgb(65,65,65);
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: rgb(75,75,75);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:pressed
|
||||||
|
{
|
||||||
|
background-color: rgb(55,55,55);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
38
widget.ui
38
widget.ui
@ -2025,32 +2025,30 @@ QSplitter:handle{
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ClickableLabel" name="statImg">
|
<widget class="QPushButton" name="statusButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>21</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="autoFillBackground">
|
||||||
<size>
|
<bool>true</bool>
|
||||||
<width>40</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::LeftToRight</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="icon">
|
||||||
<pixmap resource="res.qrc">:/img/status/dot_away_2x.png</pixmap>
|
<iconset resource="res.qrc">
|
||||||
|
<normaloff>:/ui/statusButton/dot_away.png</normaloff>:/ui/statusButton/dot_away.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="iconSize">
|
||||||
<set>Qt::AlignCenter</set>
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -2077,6 +2075,9 @@ QSplitter:handle{
|
|||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
<enum>Qt::RightToLeft</enum>
|
<enum>Qt::RightToLeft</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -2091,7 +2092,7 @@ QSplitter:handle{
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>256</width>
|
<width>255</width>
|
||||||
<height>199</height>
|
<height>199</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -3280,11 +3281,6 @@ QSplitter:handle{
|
|||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>widget/tool/editablelabelwidget.h</header>
|
<header>widget/tool/editablelabelwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>ClickableLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>widget/tool/clickablelabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="res.qrc"/>
|
<include location="res.qrc"/>
|
||||||
|
@ -125,9 +125,6 @@ Widget::Widget(QWidget *parent) :
|
|||||||
|
|
||||||
isWindowMinimized = 0;
|
isWindowMinimized = 0;
|
||||||
|
|
||||||
//centralLayout = new QSplitter(ui->centralWidget);
|
|
||||||
|
|
||||||
|
|
||||||
ui->mainContent->setLayout(new QVBoxLayout());
|
ui->mainContent->setLayout(new QVBoxLayout());
|
||||||
ui->mainHead->setLayout(new QVBoxLayout());
|
ui->mainHead->setLayout(new QVBoxLayout());
|
||||||
ui->mainHead->layout()->setMargin(0);
|
ui->mainHead->layout()->setMargin(0);
|
||||||
@ -145,6 +142,11 @@ Widget::Widget(QWidget *parent) :
|
|||||||
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
||||||
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
|
QFile f1(":/ui/statusButton/statusButton.css");
|
||||||
|
f1.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
QTextStream statusButtonStylesheetStream(&f1);
|
||||||
|
ui->statusButton->setStyleSheet(statusButtonStylesheetStream.readAll());
|
||||||
|
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
|
|
||||||
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
||||||
@ -210,7 +212,7 @@ Widget::Widget(QWidget *parent) :
|
|||||||
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
||||||
connect(ui->nameLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onUsernameChanged(QString,QString)));
|
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->statusLabel, SIGNAL(textChanged(QString,QString)), this, SLOT(onStatusMessageChanged(QString,QString)));
|
||||||
connect(ui->statImg, SIGNAL(clicked()), this, SLOT(onStatusImgClicked()));
|
connect(ui->statusButton, SIGNAL(clicked()), this, SLOT(statusButtonClicked()));
|
||||||
connect(&settingsForm.name, SIGNAL(textEdited(QString)), this, SLOT(onUsernameChanged(QString)));
|
connect(&settingsForm.name, SIGNAL(textEdited(QString)), this, SLOT(onUsernameChanged(QString)));
|
||||||
connect(&settingsForm.statusText, SIGNAL(textEdited(QString)), this, SLOT(onStatusMessageChanged(QString)));
|
connect(&settingsForm.statusText, SIGNAL(textEdited(QString)), this, SLOT(onStatusMessageChanged(QString)));
|
||||||
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
|
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
|
||||||
@ -303,13 +305,13 @@ void Widget::onFailedToStartCore()
|
|||||||
void Widget::onStatusSet(Status status)
|
void Widget::onStatusSet(Status status)
|
||||||
{
|
{
|
||||||
if (status == Status::Online)
|
if (status == Status::Online)
|
||||||
ui->statImg->setPixmap(QPixmap(":img/status/dot_online_2x.png"));
|
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_online.png"));
|
||||||
else if (status == Status::Away)
|
else if (status == Status::Away)
|
||||||
ui->statImg->setPixmap(QPixmap(":img/status/dot_idle_2x.png"));
|
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
|
||||||
else if (status == Status::Busy)
|
else if (status == Status::Busy)
|
||||||
ui->statImg->setPixmap(QPixmap(":img/status/dot_busy_2x.png"));
|
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
||||||
else if (status == Status::Offline)
|
else if (status == Status::Offline)
|
||||||
ui->statImg->setPixmap(QPixmap(":img/status/dot_away_2x.png"));
|
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_away.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onAddClicked()
|
void Widget::onAddClicked()
|
||||||
@ -1111,15 +1113,19 @@ void Widget::minimizeBtnClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onStatusImgClicked()
|
void Widget::statusButtonClicked()
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'"));
|
QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'"));
|
||||||
|
online->setIcon(QIcon(":ui/statusButton/dot_online.png"));
|
||||||
QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'"));
|
QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'"));
|
||||||
|
away->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
|
||||||
QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
|
QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
|
||||||
|
busy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
||||||
|
|
||||||
QPoint pos = QCursor::pos();
|
ui->statusButton->setMenu(&menu);
|
||||||
QAction* selectedItem = menu.exec(pos);
|
//Ugly hack since QMenu wouldn't show up properly on Win32
|
||||||
|
QAction* selectedItem = ui->statusButton->menu()->exec(ui->statusButton->mapToGlobal(QPoint(0,ui->statusButton->height())));
|
||||||
if (selectedItem == online)
|
if (selectedItem == online)
|
||||||
core->setStatus(Status::Online);
|
core->setStatus(Status::Online);
|
||||||
else if (selectedItem == away)
|
else if (selectedItem == away)
|
||||||
|
@ -92,8 +92,8 @@ private slots:
|
|||||||
void removeFriend(int friendId);
|
void removeFriend(int friendId);
|
||||||
void copyFriendIdToClipboard(int friendId);
|
void copyFriendIdToClipboard(int friendId);
|
||||||
void removeGroup(int groupId);
|
void removeGroup(int groupId);
|
||||||
void onStatusImgClicked();
|
|
||||||
void splitterMoved(int pos, int index);
|
void splitterMoved(int pos, int index);
|
||||||
|
void statusButtonClicked();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void moveWindow(QMouseEvent *e);
|
void moveWindow(QMouseEvent *e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user