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)
|
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory)
|
||||||
).toString();
|
).toString();
|
||||||
compactLayout = s.value("compactLayout", false).toBool();
|
compactLayout = s.value("compactLayout", false).toBool();
|
||||||
|
groupchatPosition = s.value("groupchatPosition", true).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Advanced");
|
s.beginGroup("Advanced");
|
||||||
|
@ -383,6 +384,7 @@ void Settings::saveGlobal(QString path)
|
||||||
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
|
||||||
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
||||||
s.setValue("compactLayout", compactLayout);
|
s.setValue("compactLayout", compactLayout);
|
||||||
|
s.setValue("groupchatPosition", groupchatPosition);
|
||||||
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
||||||
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
@ -1162,6 +1164,17 @@ void Settings::setCompactLayout(bool value)
|
||||||
emit compactLayoutChanged();
|
emit compactLayoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getGroupchatPosition() const
|
||||||
|
{
|
||||||
|
return groupchatPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setGroupchatPosition(bool value)
|
||||||
|
{
|
||||||
|
groupchatPosition = value;
|
||||||
|
emit groupchatPositionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
int Settings::getThemeColor() const
|
int Settings::getThemeColor() const
|
||||||
{
|
{
|
||||||
return themeColor;
|
return themeColor;
|
||||||
|
|
|
@ -242,6 +242,9 @@ public:
|
||||||
bool getCompactLayout() const;
|
bool getCompactLayout() const;
|
||||||
void setCompactLayout(bool compact);
|
void setCompactLayout(bool compact);
|
||||||
|
|
||||||
|
bool getGroupchatPosition() const;
|
||||||
|
void setGroupchatPosition(bool value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void save(bool writePersonal = true);
|
void save(bool writePersonal = true);
|
||||||
void save(QString path, bool writePersonal = true);
|
void save(QString path, bool writePersonal = true);
|
||||||
|
@ -269,6 +272,7 @@ private:
|
||||||
|
|
||||||
bool fauxOfflineMessaging;
|
bool fauxOfflineMessaging;
|
||||||
bool compactLayout;
|
bool compactLayout;
|
||||||
|
bool groupchatPosition;
|
||||||
bool enableIPv6;
|
bool enableIPv6;
|
||||||
QString translation;
|
QString translation;
|
||||||
static bool makeToxPortable;
|
static bool makeToxPortable;
|
||||||
|
@ -353,6 +357,7 @@ signals:
|
||||||
void emojiFontChanged();
|
void emojiFontChanged();
|
||||||
void timestampFormatChanged();
|
void timestampFormatChanged();
|
||||||
void compactLayoutChanged();
|
void compactLayoutChanged();
|
||||||
|
void groupchatPositionChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_HPP
|
#endif // SETTINGS_HPP
|
||||||
|
|
|
@ -75,6 +75,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
|
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
|
||||||
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
||||||
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
||||||
|
bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
{
|
{
|
||||||
|
@ -152,6 +153,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
|
connect(bodyUI->reconnectButton, &QPushButton::clicked, this, &GeneralForm::onReconnectClicked);
|
||||||
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
||||||
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
||||||
|
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
||||||
|
|
||||||
#ifndef QTOX_PLATFORM_EXT
|
#ifndef QTOX_PLATFORM_EXT
|
||||||
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
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());
|
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)
|
void GeneralForm::onThemeColorChanged(int)
|
||||||
{
|
{
|
||||||
int index = bodyUI->themeColorCBox->currentIndex();
|
int index = bodyUI->themeColorCBox->currentIndex();
|
||||||
|
|
|
@ -59,6 +59,7 @@ private slots:
|
||||||
void onSetGroupAlwaysNotify();
|
void onSetGroupAlwaysNotify();
|
||||||
void onFauxOfflineMessaging();
|
void onFauxOfflineMessaging();
|
||||||
void onCompactLayout();
|
void onCompactLayout();
|
||||||
|
void onGroupchatPositionChanged();
|
||||||
void onThemeColorChanged(int);
|
void onThemeColorChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -381,6 +381,16 @@ will be sent to them when they will appear online to you.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void setShowSystemTray(bool newValue);
|
void setShowSystemTray(bool newValue);
|
||||||
void compactToggled(bool compact);
|
void compactToggled(bool compact);
|
||||||
|
void groupchatPositionToggled(bool groupchatPosition);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTabChanged(int);
|
void onTabChanged(int);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "src/friendlist.h"
|
#include "src/friendlist.h"
|
||||||
#include "src/widget/friendwidget.h"
|
#include "src/widget/friendwidget.h"
|
||||||
|
|
||||||
FriendListWidget::FriendListWidget(QWidget *parent) :
|
FriendListWidget::FriendListWidget(QWidget *parent, bool groupchatPosition) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
mainLayout = new QGridLayout();
|
mainLayout = new QGridLayout();
|
||||||
|
@ -42,11 +42,16 @@ FriendListWidget::FriendListWidget(QWidget *parent) :
|
||||||
layouts[static_cast<int>(s)] = l;
|
layouts[static_cast<int>(s)] = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(layouts[static_cast<int>(Status::Online)], 0, 0);
|
||||||
mainLayout->addLayout(groupLayout, 1, 0);
|
mainLayout->addLayout(groupLayout, 1, 0);
|
||||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Away)], 2, 0);
|
mainLayout->addLayout(layouts[static_cast<int>(Status::Offline)], 2, 0);
|
||||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Busy)], 3, 0);
|
}
|
||||||
mainLayout->addLayout(layouts[static_cast<int>(Status::Offline)], 4, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout* FriendListWidget::getGroupLayout()
|
QVBoxLayout* FriendListWidget::getGroupLayout()
|
||||||
|
@ -64,6 +69,20 @@ QVBoxLayout* FriendListWidget::getFriendLayout(Status s)
|
||||||
return layouts[static_cast<int>(Status::Online)];
|
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)
|
void FriendListWidget::moveWidget(QWidget *w, Status s, int hasNewEvents)
|
||||||
{
|
{
|
||||||
getFriendLayout(s)->removeWidget(w);
|
getFriendLayout(s)->removeWidget(w);
|
||||||
|
|
|
@ -29,14 +29,14 @@ class FriendListWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit FriendListWidget(QWidget *parent = 0);
|
explicit FriendListWidget(QWidget *parent = 0, bool groupchatPosition = true);
|
||||||
|
|
||||||
QVBoxLayout* getGroupLayout();
|
QVBoxLayout* getGroupLayout();
|
||||||
QVBoxLayout* getFriendLayout(Status s);
|
QVBoxLayout* getFriendLayout(Status s);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void onGroupchatPositionChanged(bool top);
|
||||||
void moveWidget(QWidget *w, Status s, int hasNewEvents);
|
void moveWidget(QWidget *w, Status s, int hasNewEvents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -147,7 +147,7 @@ void Widget::init()
|
||||||
|
|
||||||
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
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->setWidget(contactListWidget);
|
||||||
ui->friendList->setLayoutDirection(Qt::RightToLeft);
|
ui->friendList->setLayoutDirection(Qt::RightToLeft);
|
||||||
|
|
||||||
|
@ -200,6 +200,7 @@ void Widget::init()
|
||||||
|
|
||||||
addFriendForm->show(*ui);
|
addFriendForm->show(*ui);
|
||||||
|
|
||||||
|
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
|
||||||
#if (AUTOUPDATE_ENABLED)
|
#if (AUTOUPDATE_ENABLED)
|
||||||
if (Settings::getInstance().getCheckUpdates())
|
if (Settings::getInstance().getCheckUpdates())
|
||||||
AutoUpdater::checkUpdatesAsyncInteractive();
|
AutoUpdater::checkUpdatesAsyncInteractive();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user