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

style(widget): Style fixes

This commit is contained in:
Diadlo 2016-07-07 12:55:53 +03:00
parent 88eca7e200
commit 76f694fe73
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
23 changed files with 124 additions and 102 deletions

View File

@ -131,5 +131,7 @@
<file>ui/loginScreen/loginScreen.css</file> <file>ui/loginScreen/loginScreen.css</file>
<file>img/others/logout-icon.svg</file> <file>img/others/logout-icon.svg</file>
<file>img/caps_lock.svg</file> <file>img/caps_lock.svg</file>
<file>ui/contentDialog/contentDialog.css</file>
<file>ui/tooliconsZone/tooliconsZone.css</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -254,11 +254,9 @@ void CategoryWidget::onCompactChanged(bool _compact)
topLayout->setSpacing(0); topLayout->setSpacing(0);
topLayout->setMargin(0); topLayout->setMargin(0);
(void)_compact; Q_UNUSED(_compact);
setCompact(true); setCompact(true);
if (true)
{
nameLabel->minimizeMaximumWidth(); nameLabel->minimizeMaximumWidth();
mainLayout = nullptr; mainLayout = nullptr;
@ -275,31 +273,6 @@ void CategoryWidget::onCompactChanged(bool _compact)
topLayout->addWidget(statusLabel); topLayout->addWidget(statusLabel);
topLayout->addSpacing(5); topLayout->addSpacing(5);
topLayout->activate(); topLayout->activate();
}
/*else
{
nameLabel->setMaximumWidth(QWIDGETSIZE_MAX);
mainLayout = new QVBoxLayout();
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(20, 0, 20, 0);
container->setFixedHeight(25);
container->setLayout(mainLayout);
topLayout->addWidget(&statusPic);
topLayout->addSpacing(10);
topLayout->addWidget(nameLabel, 1);
topLayout->addSpacing(5);
topLayout->addWidget(statusLabel);
topLayout->activate();
mainLayout->addStretch();
mainLayout->addLayout(topLayout);
mainLayout->addWidget(lineFrame);
mainLayout->addStretch();
mainLayout->activate();
}*/
Style::repolish(this); Style::repolish(this);
} }

View File

@ -59,7 +59,7 @@ ContentDialog::ContentDialog(SettingsWidget* settingsWidget, QWidget* parent)
boxLayout->setSpacing(0); boxLayout->setSpacing(0);
splitter = new QSplitter(this); splitter = new QSplitter(this);
setStyleSheet("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);}"); setStyleSheet(Style::getStylesheet(":/ui/contentDialog/contentDialog.css"));
splitter->setHandleWidth(6); splitter->setHandleWidth(6);
QWidget *friendWidget = new QWidget(); QWidget *friendWidget = new QWidget();
@ -455,7 +455,7 @@ void ContentDialog::updateTitleAndStatusIcon(const QString& username)
setWindowTitle(displayWidget->getTitle() + QStringLiteral(" - ") + username); setWindowTitle(displayWidget->getTitle() + QStringLiteral(" - ") + username);
// it's null when it's a groupchat // it's null when it's a groupchat
if(displayWidget->getFriend() == nullptr) if (displayWidget->getFriend() == nullptr)
{ {
setWindowIcon(QIcon(":/img/group.svg")); setWindowIcon(QIcon(":/img/group.svg"));
return; return;
@ -611,7 +611,7 @@ void ContentDialog::moveEvent(QMoveEvent* event)
void ContentDialog::keyPressEvent(QKeyEvent* event) void ContentDialog::keyPressEvent(QKeyEvent* event)
{ {
if(event->key() != Qt::Key_Escape) if (event->key() != Qt::Key_Escape)
QDialog::keyPressEvent(event); // Ignore escape keyboard shortcut. QDialog::keyPressEvent(event); // Ignore escape keyboard shortcut.
} }

View File

@ -133,13 +133,12 @@ void AddFriendForm::setMode(Mode mode)
bool AddFriendForm::addFriendRequest(const QString &friendAddress, const QString &message) bool AddFriendForm::addFriendRequest(const QString &friendAddress, const QString &message)
{ {
if(Settings::getInstance().addFriendRequest(friendAddress, message)) if (Settings::getInstance().addFriendRequest(friendAddress, message))
{ {
addFriendRequestWidget(friendAddress, message); addFriendRequestWidget(friendAddress, message);
if(isShown()) if (isShown())
{
onCurrentChanged(tabWidget->currentIndex()); onCurrentChanged(tabWidget->currentIndex());
}
return true; return true;
} }
return false; return false;
@ -197,13 +196,14 @@ void AddFriendForm::onIdChanged(const QString &id)
QString toxIdText(tr("Tox ID", "Tox ID of the person you're sending a friend request to")); QString toxIdText(tr("Tox ID", "Tox ID of the person you're sending a friend request to"));
QString toxIdComment(tr("either 76 hexadecimal characters or name@example.com", "Tox ID format description")); QString toxIdComment(tr("either 76 hexadecimal characters or name@example.com", "Tox ID format description"));
if(isValidId) if (isValidId)
{ {
toxIdLabel.setText(toxIdText + toxIdLabel.setText(toxIdText +
QStringLiteral(" (") + QStringLiteral(" (") +
toxIdComment + toxIdComment +
QStringLiteral(")")); QStringLiteral(")"));
} else }
else
{ {
toxIdLabel.setText(toxIdText + toxIdLabel.setText(toxIdText +
QStringLiteral(" <font color='red'>(") + QStringLiteral(" <font color='red'>(") +

View File

@ -119,7 +119,7 @@ ChatForm::ChatForm(Friend* chatFriend)
connect(this, &ChatForm::chatAreaCleared, getOfflineMsgEngine(), &OfflineMsgEngine::removeAllReceipts); connect(this, &ChatForm::chatAreaCleared, getOfflineMsgEngine(), &OfflineMsgEngine::removeAllReceipts);
connect(statusMessageLabel, &CroppingLabel::customContextMenuRequested, this, [&](const QPoint& pos) connect(statusMessageLabel, &CroppingLabel::customContextMenuRequested, this, [&](const QPoint& pos)
{ {
if(!statusMessageLabel->text().isEmpty()) if (!statusMessageLabel->text().isEmpty())
{ {
QWidget* sender = static_cast<QWidget*>(this->sender()); QWidget* sender = static_cast<QWidget*>(this->sender());
@ -580,7 +580,7 @@ void ChatForm::onEnableCallButtons()
void ChatForm::onMicMuteToggle() void ChatForm::onMicMuteToggle()
{ {
if (audioInputFlag == true) if (audioInputFlag)
{ {
coreav->micMuteToggle(f->getFriendID()); coreav->micMuteToggle(f->getFriendID());
if (micButton->objectName() == "red") if (micButton->objectName() == "red")
@ -600,7 +600,7 @@ void ChatForm::onMicMuteToggle()
void ChatForm::onVolMuteToggle() void ChatForm::onVolMuteToggle()
{ {
if (audioOutputFlag == true) if (audioOutputFlag)
{ {
coreav->volMuteToggle(f->getFriendID()); coreav->volMuteToggle(f->getFriendID());
if (volButton->objectName() == "red") if (volButton->objectName() == "red")

View File

@ -92,6 +92,12 @@ private slots:
private: private:
void retranslateUi(); void retranslateUi();
void showOutgoingCall(bool video); void showOutgoingCall(bool video);
void startCounter();
void stopCounter();
QString secondsToDHMS(quint32 duration);
void enableCallButtons();
void disableCallButtons();
void SendMessageStr(QString msg);
protected: protected:
virtual GenericNetCamView* createNetcam() final override; virtual GenericNetCamView* createNetcam() final override;
@ -117,14 +123,8 @@ private:
ScreenshotGrabber* screenshotGrabber; ScreenshotGrabber* screenshotGrabber;
QHash<uint, FileTransferInstance*> ftransWidgets; QHash<uint, FileTransferInstance*> ftransWidgets;
void startCounter();
void stopCounter();
QString secondsToDHMS(quint32 duration);
CallConfirmWidget *callConfirm; CallConfirmWidget *callConfirm;
void enableCallButtons();
void disableCallButtons();
bool isTyping; bool isTyping;
void SendMessageStr(QString msg);
}; };
#endif // CHATFORM_H #endif // CHATFORM_H

View File

@ -243,7 +243,7 @@ void GenericChatForm::showFileMenu()
void GenericChatForm::hideFileMenu() void GenericChatForm::hideFileMenu()
{ {
if(fileFlyout->isShown() || fileFlyout->isBeingShown()) if (fileFlyout->isShown() || fileFlyout->isBeingShown())
fileFlyout->animateHide(); fileFlyout->animateHide();
} }
@ -470,18 +470,14 @@ QString GenericChatForm::resolveToxId(const ToxId &id)
{ {
Friend *f = FriendList::findFriend(id); Friend *f = FriendList::findFriend(id);
if (f) if (f)
{
return f->getDisplayedName(); return f->getDisplayedName();
}
else for (Group *it : GroupList::getAllGroups())
{
for (auto it : GroupList::getAllGroups())
{ {
QString res = it->resolveToxId(id); QString res = it->resolveToxId(id);
if (res.size()) if (res.size())
return res; return res;
} }
}
return QString(); return QString();
} }

View File

@ -220,7 +220,7 @@ void GroupChatForm::onUserListChanged()
if (peersCount > 1 && group->isAvGroupchat()) if (peersCount > 1 && group->isAvGroupchat())
{ {
// don't set button to green if call running // don't set button to green if call running
if(!inCall) if (!inCall)
{ {
callButton->setEnabled(true); callButton->setEnabled(true);
callButton->setObjectName("green"); callButton->setObjectName("green");
@ -285,7 +285,7 @@ void GroupChatForm::dropEvent(QDropEvent *ev)
void GroupChatForm::onMicMuteToggle() void GroupChatForm::onMicMuteToggle()
{ {
if (audioInputFlag == true) if (audioInputFlag)
{ {
if (micButton->objectName() == "red") if (micButton->objectName() == "red")
{ {
@ -306,7 +306,7 @@ void GroupChatForm::onMicMuteToggle()
void GroupChatForm::onVolMuteToggle() void GroupChatForm::onVolMuteToggle()
{ {
if (audioOutputFlag == true) if (audioOutputFlag)
{ {
if (volButton->objectName() == "red") if (volButton->objectName() == "red")
{ {

View File

@ -186,10 +186,9 @@ void GroupInviteForm::deleteInviteButtons(QWidget* widget)
void GroupInviteForm::retranslateUi() void GroupInviteForm::retranslateUi()
{ {
headLabel->setText(tr("Groups")); headLabel->setText(tr("Groups"));
if(createButton) if (createButton)
{
createButton->setText(tr("Create new group")); createButton->setText(tr("Create new group"));
}
inviteBox->setTitle(tr("Group invites")); inviteBox->setTitle(tr("Group invites"));
for (QPushButton* acceptButton : acceptButtons) for (QPushButton* acceptButton : acceptButtons)

View File

@ -370,11 +370,11 @@ void ProfileForm::onDeleteClicked()
QVector<QString> manualDeleteFiles = nexus.getProfile()->remove(); QVector<QString> manualDeleteFiles = nexus.getProfile()->remove();
if(!manualDeleteFiles.empty()) if (!manualDeleteFiles.empty())
{ {
QString message = tr("The following files could not be deleted:", "deletion failed text part 1") + "\n\n"; QString message = tr("The following files could not be deleted:", "deletion failed text part 1") + "\n\n";
for(auto& file : manualDeleteFiles) for (auto& file : manualDeleteFiles)
{ {
message = message + file + "\n"; message = message + file + "\n";
} }

View File

@ -45,7 +45,10 @@ signals:
void clicked(); void clicked();
protected: protected:
virtual void mouseReleaseEvent(QMouseEvent*) final override {emit clicked();} virtual void mouseReleaseEvent(QMouseEvent*) final override
{
emit clicked();
}
}; };
class ProfileForm : public QWidget class ProfileForm : public QWidget

View File

@ -35,7 +35,10 @@ class AboutForm : public GenericForm
public: public:
AboutForm(); AboutForm();
~AboutForm(); ~AboutForm();
virtual QString getFormName() final override {return tr("About");} virtual QString getFormName() final override
{
return tr("About");
}
protected: protected:

View File

@ -34,7 +34,10 @@ class AdvancedForm : public GenericForm
public: public:
AdvancedForm(); AdvancedForm();
~AdvancedForm(); ~AdvancedForm();
virtual QString getFormName() final override {return tr("Advanced");} virtual QString getFormName() final override
{
return tr("Advanced");
}
protected: protected:
bool eventFilter(QObject *o, QEvent *e) final override; bool eventFilter(QObject *o, QEvent *e) final override;

View File

@ -212,10 +212,10 @@ void AVForm::selectBestModes(QVector<VideoMode> &allVideoModes)
qDebug("width: %d, height: %d, FPS: %f, pixel format: %s", mode.width, mode.height, mode.FPS, pixelFormat.toStdString().c_str()); qDebug("width: %d, height: %d, FPS: %f, pixel format: %s", mode.width, mode.height, mode.FPS, pixelFormat.toStdString().c_str());
// PS3-Cam protection, everything above 60fps makes no sense // PS3-Cam protection, everything above 60fps makes no sense
if(mode.FPS > 60) if (mode.FPS > 60)
continue; continue;
for(auto iter = idealModes.begin(); iter != idealModes.end(); ++iter) for (auto iter = idealModes.begin(); iter != idealModes.end(); ++iter)
{ {
int res = iter->first; int res = iter->first;
VideoMode idealMode = iter->second; VideoMode idealMode = iter->second;

View File

@ -34,7 +34,10 @@ class GeneralForm : public GenericForm
public: public:
explicit GeneralForm(SettingsWidget *parent); explicit GeneralForm(SettingsWidget *parent);
~GeneralForm(); ~GeneralForm();
virtual QString getFormName() final override {return tr("General");} virtual QString getFormName() final override
{
return tr("General");
}
private slots: private slots:
void onEnableIPv6Updated(); void onEnableIPv6Updated();

View File

@ -28,7 +28,10 @@ public:
virtual ~GenericForm() {} virtual ~GenericForm() {}
virtual QString getFormName() = 0; virtual QString getFormName() = 0;
QPixmap getFormIcon() {return formIcon;} QPixmap getFormIcon()
{
return formIcon;
}
protected: protected:
QPixmap formIcon; QPixmap formIcon;

View File

@ -32,7 +32,10 @@ class PrivacyForm : public GenericForm
public: public:
PrivacyForm(); PrivacyForm();
~PrivacyForm(); ~PrivacyForm();
virtual QString getFormName() final override {return tr("Privacy");} virtual QString getFormName() final override
{
return tr("Privacy");
}
private slots: private slots:
void onEnableLoggingUpdated(); void onEnableLoggingUpdated();

View File

@ -183,14 +183,10 @@ void GenericChatroomWidget::reloadTheme()
void GenericChatroomWidget::mouseReleaseEvent(QMouseEvent* event) void GenericChatroomWidget::mouseReleaseEvent(QMouseEvent* event)
{ {
if(event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
{
emit chatroomWidgetClicked(this); emit chatroomWidgetClicked(this);
}
else else
{
event->ignore(); event->ignore();
}
} }
void GenericChatroomWidget::enterEvent(QEvent*) void GenericChatroomWidget::enterEvent(QEvent*)

View File

@ -40,7 +40,7 @@ LoginScreen::LoginScreen(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
// permanently disables maximize button https://github.com/tux3/qTox/issues/1973 // permanently disables maximize button https://github.com/tux3/qTox/issues/1973
this->setWindowFlags(windowFlags() &! Qt::WindowMaximizeButtonHint); this->setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
this->setFixedSize(this->size()); this->setFixedSize(this->size());
connect(&quitShortcut, &QShortcut::activated, this, &LoginScreen::close); connect(&quitShortcut, &QShortcut::activated, this, &LoginScreen::close);
@ -271,9 +271,9 @@ void LoginScreen::retranslateUi()
void LoginScreen::onImportProfile() void LoginScreen::onImportProfile()
{ {
ProfileImporter *pi = new ProfileImporter(this); ProfileImporter *pi = new ProfileImporter(this);
if(pi->importProfile() == true)
{ if (pi->importProfile())
reset(); reset();
}
delete pi; delete pi;
} }

View File

@ -203,9 +203,8 @@ void ScreenGrabberChooserRectItem::mousePressHandle(int x, int y, QGraphicsScene
Q_UNUSED(x); Q_UNUSED(x);
Q_UNUSED(y); Q_UNUSED(y);
if(event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
this->state = HandleResizing; this->state = HandleResizing;
} }
void ScreenGrabberChooserRectItem::mouseMoveHandle(int x, int y, QGraphicsSceneMouseEvent* event) void ScreenGrabberChooserRectItem::mouseMoveHandle(int x, int y, QGraphicsSceneMouseEvent* event)
@ -221,13 +220,13 @@ void ScreenGrabberChooserRectItem::mouseMoveHandle(int x, int y, QGraphicsSceneM
bool increaseX = ((x < 0) == (delta.x() < 0)); bool increaseX = ((x < 0) == (delta.x() < 0));
bool increaseY = ((y < 0) == (delta.y() < 0)); bool increaseY = ((y < 0) == (delta.y() < 0));
if((delta.x() < 0 && increaseX) || (delta.x() >= 0 && !increaseX)) if ((delta.x() < 0 && increaseX) || (delta.x() >= 0 && !increaseX))
{ {
moveBy(delta.x(), 0); moveBy(delta.x(), 0);
delta.rx() *= -1; delta.rx() *= -1;
} }
if((delta.y() < 0 && increaseY) || (delta.y() >= 0 && !increaseY)) if ((delta.y() < 0 && increaseY) || (delta.y() >= 0 && !increaseY))
{ {
moveBy(0, delta.y()); moveBy(0, delta.y());
delta.ry() *= -1; delta.ry() *= -1;

View File

@ -563,7 +563,7 @@ void Widget::moveEvent(QMoveEvent *event)
void Widget::closeEvent(QCloseEvent *event) void Widget::closeEvent(QCloseEvent *event)
{ {
if (Settings::getInstance().getShowSystemTray() && Settings::getInstance().getCloseToTray() == true) if (Settings::getInstance().getShowSystemTray() && Settings::getInstance().getCloseToTray())
{ {
event->ignore(); event->ignore();
this->hide(); this->hide();
@ -1020,7 +1020,7 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
f->setStatus(status); f->setStatus(status);
f->getFriendWidget()->updateStatusLight(); f->getFriendWidget()->updateStatusLight();
if(f->getFriendWidget()->isActive()) if (f->getFriendWidget()->isActive())
setWindowTitle(f->getFriendWidget()->getTitle()); setWindowTitle(f->getFriendWidget()->getTitle());
ContentDialog::updateFriendStatus(friendId); ContentDialog::updateFriendStatus(friendId);
@ -1342,7 +1342,7 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
void Widget::onFriendRequestReceived(const QString& userId, const QString& message) void Widget::onFriendRequestReceived(const QString& userId, const QString& message)
{ {
if(addFriendForm->addFriendRequest(userId, message)) if (addFriendForm->addFriendRequest(userId, message))
{ {
friendRequestsUpdate(); friendRequestsUpdate();
newMessageAlert(window(), isActiveWindow(), true, true); newMessageAlert(window(), isActiveWindow(), true, true);
@ -1981,7 +1981,7 @@ void Widget::clearAllReceipts()
void Widget::reloadTheme() void Widget::reloadTheme()
{ {
QString statusPanelStyle = Style::getStylesheet(":/ui/window/statusPanel.css"); QString statusPanelStyle = Style::getStylesheet(":/ui/window/statusPanel.css");
ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}QPushButton:checked{background-color:@themeMedium;border:none;}QPushButton:pressed{background-color:@themeMediumLight;border:none;}")); ui->tooliconsZone->setStyleSheet(Style::getStylesheet(":/ui/tooliconsZone/tooliconsZone.css"));
ui->statusPanel->setStyleSheet(statusPanelStyle); ui->statusPanel->setStyleSheet(statusPanelStyle);
ui->statusHead->setStyleSheet(statusPanelStyle); ui->statusHead->setStyleSheet(statusPanelStyle);
ui->friendList->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css")); ui->friendList->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css"));

View File

@ -0,0 +1,16 @@
QSplitter
{
color: white;
background-color: white;
alternate-background-color: white;
border-color: white;
gridline-color: white;
selection-color: white;
selection-background-color: white;
}
QSplitter:handle
{
color: white;
background-color: white;
}

View File

@ -0,0 +1,23 @@
QPushButton
{
background-color: @themeDark;
border: none;
}
QPushButton:hover
{
background-color: @themeMediumDark;
border: none;
}
QPushButton:checked
{
background-color: @themeMedium;
border: none;
}
QPushButton:pressed
{
background-color: @themeMediumLight;
border: none;
}