mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Adds a configuration option allowing users to choose whether they want
groupchats placed at the top of the friends list, or below the online contacts. -A checkbox was added to generalsettings.ui -FriendListWidget's constructor was changed so that the friends list can be initialized with the appropriate layout arrangement
This commit is contained in:
parent
4a875ce8f5
commit
2d186109c8
|
@ -216,6 +216,7 @@ void Settings::load()
|
|||
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory)
|
||||
).toString();
|
||||
compactLayout = s.value("compactLayout", false).toBool();
|
||||
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("Advanced");
|
||||
|
@ -383,6 +384,7 @@ void Settings::saveGlobal(QString path)
|
|||
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
||||
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
||||
s.setValue("compactLayout", compactLayout);
|
||||
s.setValue("groupchatPosition", groupchatPosition);
|
||||
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
||||
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
||||
s.endGroup();
|
||||
|
@ -1162,6 +1164,17 @@ void Settings::setCompactLayout(bool value)
|
|||
emit compactLayoutChanged();
|
||||
}
|
||||
|
||||
bool Settings::getGroupchatPosition() const
|
||||
{
|
||||
return groupchatPosition;
|
||||
}
|
||||
|
||||
void Settings::setGroupchatPosition(bool value)
|
||||
{
|
||||
groupchatPosition = value;
|
||||
emit groupchatPositionChanged();
|
||||
}
|
||||
|
||||
int Settings::getThemeColor() const
|
||||
{
|
||||
return themeColor;
|
||||
|
|
|
@ -242,6 +242,9 @@ public:
|
|||
bool getCompactLayout() const;
|
||||
void setCompactLayout(bool compact);
|
||||
|
||||
bool getGroupchatPosition() const;
|
||||
void setGroupchatPosition(bool value);
|
||||
|
||||
public:
|
||||
void save(bool writePersonal = true);
|
||||
void save(QString path, bool writePersonal = true);
|
||||
|
@ -269,6 +272,7 @@ private:
|
|||
|
||||
bool fauxOfflineMessaging;
|
||||
bool compactLayout;
|
||||
bool groupchatPosition;
|
||||
bool enableIPv6;
|
||||
QString translation;
|
||||
static bool makeToxPortable;
|
||||
|
@ -353,6 +357,7 @@ signals:
|
|||
void emojiFontChanged();
|
||||
void timestampFormatChanged();
|
||||
void compactLayoutChanged();
|
||||
void groupchatPositionChanged();
|
||||
};
|
||||
|
||||
#endif // SETTINGS_HPP
|
||||
|
|
|
@ -75,6 +75,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
|
||||
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
||||
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
||||
bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());
|
||||
|
||||
for (auto entry : SmileyPack::listSmileyPacks())
|
||||
{
|
||||
|
@ -152,6 +153,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
|
||||
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
||||
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
||||
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
||||
|
||||
#ifndef QTOX_PLATFORM_EXT
|
||||
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
||||
|
@ -364,6 +366,12 @@ void GeneralForm::onCompactLayout()
|
|||
emit parent->compactToggled(bodyUI->cbCompactLayout->isChecked());
|
||||
}
|
||||
|
||||
void GeneralForm::onGroupchatPositionChanged()
|
||||
{
|
||||
Settings::getInstance().setGroupchatPosition(bodyUI->cbGroupchatPosition->isChecked());
|
||||
emit parent->groupchatPositionToggled(bodyUI->cbGroupchatPosition->isChecked());
|
||||
}
|
||||
|
||||
void GeneralForm::onThemeColorChanged(int)
|
||||
{
|
||||
int index = bodyUI->themeColorCBox->currentIndex();
|
||||
|
|
|
@ -59,6 +59,7 @@ private slots:
|
|||
void onSetGroupAlwaysNotify();
|
||||
void onFauxOfflineMessaging();
|
||||
void onCompactLayout();
|
||||
void onGroupchatPositionChanged();
|
||||
void onThemeColorChanged(int);
|
||||
|
||||
private:
|
||||
|
|
|
@ -381,6 +381,16 @@ will be sent to them when they will appear online to you.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbGroupchatPosition">
|
||||
<property name="toolTip">
|
||||
<string comment="toolTip for groupchat positioning">If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed at the bottom.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Place groupchats at top of friend list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
signals:
|
||||
void setShowSystemTray(bool newValue);
|
||||
void compactToggled(bool compact);
|
||||
void groupchatPositionToggled(bool groupchatPosition);
|
||||
|
||||
private slots:
|
||||
void onTabChanged(int);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "src/friendlist.h"
|
||||
#include "src/widget/friendwidget.h"
|
||||
|
||||
FriendListWidget::FriendListWidget(QWidget *parent) :
|
||||
FriendListWidget::FriendListWidget(QWidget *parent, bool groupchatPosition) :
|
||||
QWidget(parent)
|
||||
{
|
||||
mainLayout = new QGridLayout();
|
||||
|
@ -42,11 +42,16 @@ FriendListWidget::FriendListWidget(QWidget *parent) :
|
|||
layouts[static_cast<int>(s)] = l;
|
||||
}
|
||||
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Online)], 0, 0);
|
||||
mainLayout->addLayout(groupLayout, 1, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Away)], 2, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Busy)], 3, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Offline)], 4, 0);
|
||||
if(groupchatPosition){
|
||||
mainLayout->addLayout(groupLayout, 0, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Online)], 1, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Offline)], 2, 0);
|
||||
}
|
||||
else{
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Online)], 0, 0);
|
||||
mainLayout->addLayout(groupLayout, 1, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Offline)], 2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
QVBoxLayout* FriendListWidget::getGroupLayout()
|
||||
|
@ -64,6 +69,20 @@ QVBoxLayout* FriendListWidget::getFriendLayout(Status s)
|
|||
return layouts[static_cast<int>(Status::Online)];
|
||||
}
|
||||
|
||||
void FriendListWidget::onGroupchatPositionChanged(bool top)
|
||||
{
|
||||
mainLayout->removeItem(groupLayout);
|
||||
mainLayout->removeItem(getFriendLayout(Status::Online));
|
||||
if(top){
|
||||
mainLayout->addLayout(groupLayout, 0, 0);
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Online)], 1, 0);
|
||||
}
|
||||
else{
|
||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Online)], 0, 0);
|
||||
mainLayout->addLayout(groupLayout, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void FriendListWidget::moveWidget(QWidget *w, Status s, int hasNewEvents)
|
||||
{
|
||||
getFriendLayout(s)->removeWidget(w);
|
||||
|
|
|
@ -29,14 +29,14 @@ class FriendListWidget : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FriendListWidget(QWidget *parent = 0);
|
||||
|
||||
explicit FriendListWidget(QWidget *parent = 0, bool groupchatPosition = true);
|
||||
QVBoxLayout* getGroupLayout();
|
||||
QVBoxLayout* getFriendLayout(Status s);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void onGroupchatPositionChanged(bool top);
|
||||
void moveWidget(QWidget *w, Status s, int hasNewEvents);
|
||||
|
||||
private:
|
||||
|
|
|
@ -147,7 +147,7 @@ void Widget::init()
|
|||
|
||||
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
||||
|
||||
contactListWidget = new FriendListWidget();
|
||||
contactListWidget = new FriendListWidget(0, Settings::getInstance().getGroupchatPosition());
|
||||
ui->friendList->setWidget(contactListWidget);
|
||||
ui->friendList->setLayoutDirection(Qt::RightToLeft);
|
||||
|
||||
|
@ -200,6 +200,7 @@ void Widget::init()
|
|||
|
||||
addFriendForm->show(*ui);
|
||||
|
||||
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
|
||||
#if (AUTOUPDATE_ENABLED)
|
||||
if (Settings::getInstance().getCheckUpdates())
|
||||
AutoUpdater::checkUpdatesAsyncInteractive();
|
||||
|
|
Loading…
Reference in New Issue
Block a user