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

Merge branch 'pr1500'

This commit is contained in:
tux3 2015-05-07 19:43:20 +02:00
commit 8d91997ae5
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 30 additions and 2 deletions

View File

@ -133,7 +133,10 @@ void Widget::init()
ui->mainHead->layout()->setMargin(0);
ui->mainHead->layout()->setSpacing(0);
ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}"));
ui->addButton->setCheckable(true);
ui->groupButton->setCheckable(false);
ui->transferButton->setCheckable(true);
ui->settingsButton->setCheckable(true);
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
&& Settings::getInstance().getStyle() != "None")
@ -207,6 +210,7 @@ void Widget::init()
addFriendForm->show(*ui);
setWindowTitle(tr("Add friend"));
setActiveToolMenuButton(Widget::AddButton);
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
#if (AUTOUPDATE_ENABLED)
@ -434,6 +438,7 @@ void Widget::onAddClicked()
hideMainForms();
addFriendForm->show(*ui);
setWindowTitle(tr("Add friend"));
setActiveToolMenuButton(Widget::AddButton);
activeChatroomWidget = nullptr;
}
@ -447,6 +452,7 @@ void Widget::onTransferClicked()
hideMainForms();
filesForm->show(*ui);
setWindowTitle(tr("File transfers"));
setActiveToolMenuButton(Widget::TransferButton);
activeChatroomWidget = nullptr;
}
@ -527,6 +533,7 @@ void Widget::onSettingsClicked()
hideMainForms();
settingsWidget->show(*ui);
setWindowTitle(tr("Settings"));
setActiveToolMenuButton(Widget::SettingButton);
activeChatroomWidget = nullptr;
}
@ -729,6 +736,7 @@ void Widget::onFriendUsernameChanged(int friendId, const QString& username)
void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
{
hideMainForms();
setActiveToolMenuButton(Widget::None);
widget->setChatForm(*ui);
if (activeChatroomWidget != nullptr)
activeChatroomWidget->setAsInactiveChatroom();
@ -1277,7 +1285,7 @@ void Widget::clearAllReceipts()
void Widget::reloadTheme()
{
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;}"));
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->statusPanel->setStyleSheet(statusPanelStyle);
ui->statusHead->setStyleSheet(statusPanelStyle);
ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css"));
@ -1358,3 +1366,15 @@ Status Widget::getStatusFromString(QString status)
else
return Status::Offline;
}
void Widget::setActiveToolMenuButton(ActiveToolMenuButton newActiveButton)
{
ui->addButton->setChecked(newActiveButton == Widget::AddButton);
ui->addButton->setDisabled(newActiveButton == Widget::AddButton);
ui->groupButton->setChecked(newActiveButton == Widget::GroupButton);
ui->groupButton->setDisabled(newActiveButton == Widget::GroupButton);
ui->transferButton->setChecked(newActiveButton == Widget::TransferButton);
ui->transferButton->setDisabled(newActiveButton == Widget::TransferButton);
ui->settingsButton->setChecked(newActiveButton == Widget::SettingButton);
ui->settingsButton->setDisabled(newActiveButton == Widget::SettingButton);
}

View File

@ -151,6 +151,14 @@ private slots:
void processOfflineMsgs();
private:
enum ActiveToolMenuButton {
AddButton,
GroupButton,
TransferButton,
SettingButton,
None,
};
void setActiveToolMenuButton(ActiveToolMenuButton newActiveButton);
void hideMainForms();
virtual bool event(QEvent * e);
Group *createGroup(int groupId);