mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
added a compact layout for the friends list
This commit is contained in:
parent
5cb1b6fe8e
commit
c73b07db72
@ -142,6 +142,7 @@ void Settings::load()
|
|||||||
globalAutoAcceptDir = s.value("globalAutoAcceptDir",
|
globalAutoAcceptDir = s.value("globalAutoAcceptDir",
|
||||||
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory)
|
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory)
|
||||||
).toString();
|
).toString();
|
||||||
|
compactLayout = s.value("compactLayout", false).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Advanced");
|
s.beginGroup("Advanced");
|
||||||
@ -289,6 +290,7 @@ void Settings::save(QString path, bool writeFriends)
|
|||||||
s.setValue("checkUpdates", checkUpdates);
|
s.setValue("checkUpdates", checkUpdates);
|
||||||
s.setValue("showInFront", showInFront);
|
s.setValue("showInFront", showInFront);
|
||||||
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
|
||||||
|
s.setValue("compactLayout", compactLayout);
|
||||||
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
s.setValue("autoSaveEnabled", autoSaveEnabled);
|
||||||
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
@ -958,6 +960,15 @@ void Settings::setFauxOfflineMessaging(bool value)
|
|||||||
fauxOfflineMessaging = value;
|
fauxOfflineMessaging = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getCompactLayout() const {
|
||||||
|
return compactLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setCompactLayout(bool value) {
|
||||||
|
compactLayout = value;
|
||||||
|
emit compactLayoutChanged();
|
||||||
|
}
|
||||||
|
|
||||||
int Settings::getThemeColor() const
|
int Settings::getThemeColor() const
|
||||||
{
|
{
|
||||||
return themeColor;
|
return themeColor;
|
||||||
|
@ -215,6 +215,9 @@ public:
|
|||||||
bool getFauxOfflineMessaging() const;
|
bool getFauxOfflineMessaging() const;
|
||||||
void setFauxOfflineMessaging(bool value);
|
void setFauxOfflineMessaging(bool value);
|
||||||
|
|
||||||
|
bool getCompactLayout() const;
|
||||||
|
void setCompactLayout(bool compact);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void save(bool writeFriends = true);
|
void save(bool writeFriends = true);
|
||||||
void save(QString path, bool writeFriends = true);
|
void save(QString path, bool writeFriends = true);
|
||||||
@ -238,6 +241,7 @@ private:
|
|||||||
bool dontShowDhtDialog;
|
bool dontShowDhtDialog;
|
||||||
|
|
||||||
bool fauxOfflineMessaging;
|
bool fauxOfflineMessaging;
|
||||||
|
bool compactLayout;
|
||||||
bool enableIPv6;
|
bool enableIPv6;
|
||||||
QString translation;
|
QString translation;
|
||||||
static bool makeToxPortable;
|
static bool makeToxPortable;
|
||||||
@ -313,6 +317,7 @@ signals:
|
|||||||
void smileyPackChanged();
|
void smileyPackChanged();
|
||||||
void emojiFontChanged();
|
void emojiFontChanged();
|
||||||
void timestampFormatChanged();
|
void timestampFormatChanged();
|
||||||
|
void compactLayoutChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_HPP
|
#endif // SETTINGS_HPP
|
||||||
|
@ -68,6 +68,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
|
bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
|
||||||
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
|
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
|
||||||
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
|
||||||
|
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
{
|
{
|
||||||
@ -141,6 +142,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
|
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
|
||||||
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);
|
||||||
|
|
||||||
#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,
|
||||||
@ -331,6 +333,11 @@ void GeneralForm::onFauxOfflineMessaging()
|
|||||||
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
|
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onCompactLayout()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setCompactLayout(bodyUI->cbCompactLayout->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void GeneralForm::onThemeColorChanged(int)
|
void GeneralForm::onThemeColorChanged(int)
|
||||||
{
|
{
|
||||||
int index = bodyUI->themeColorCBox->currentIndex();
|
int index = bodyUI->themeColorCBox->currentIndex();
|
||||||
|
@ -55,6 +55,7 @@ private slots:
|
|||||||
void onCheckUpdateChanged();
|
void onCheckUpdateChanged();
|
||||||
void onSetShowInFront();
|
void onSetShowInFront();
|
||||||
void onFauxOfflineMessaging();
|
void onFauxOfflineMessaging();
|
||||||
|
void onCompactLayout();
|
||||||
void onThemeColorChanged(int);
|
void onThemeColorChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -183,6 +183,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbCompactLayout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Compact layout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item alignment="Qt::AlignLeft">
|
<item alignment="Qt::AlignLeft">
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "genericchatroomwidget.h"
|
#include "genericchatroomwidget.h"
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
|
#include "src/misc/settings.h"
|
||||||
#include "maskablepixmapwidget.h"
|
#include "maskablepixmapwidget.h"
|
||||||
#include "croppinglabel.h"
|
#include "croppinglabel.h"
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
@ -24,7 +25,16 @@
|
|||||||
GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
|
GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
|
||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
setFixedHeight(55);
|
setProperty("compact", Settings::getInstance().getCompactLayout());
|
||||||
|
|
||||||
|
if(property("compact").toBool())
|
||||||
|
{
|
||||||
|
setFixedHeight(25);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setFixedHeight(55);
|
||||||
|
}
|
||||||
|
|
||||||
setLayout(&layout);
|
setLayout(&layout);
|
||||||
layout.setSpacing(0);
|
layout.setSpacing(0);
|
||||||
@ -34,7 +44,14 @@ GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
|
|||||||
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft
|
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft
|
||||||
|
|
||||||
// avatar
|
// avatar
|
||||||
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
|
if(property("compact").toBool())
|
||||||
|
{
|
||||||
|
avatar = new MaskablePixmapWidget(this, QSize(20,20), ":/img/avatar_mask.png");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.png");
|
||||||
|
}
|
||||||
|
|
||||||
// status text
|
// status text
|
||||||
statusMessageLabel = new CroppingLabel(this);
|
statusMessageLabel = new CroppingLabel(this);
|
||||||
@ -43,20 +60,35 @@ GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
|
|||||||
// name text
|
// name text
|
||||||
nameLabel = new CroppingLabel(this);
|
nameLabel = new CroppingLabel(this);
|
||||||
nameLabel->setObjectName("name");
|
nameLabel->setObjectName("name");
|
||||||
|
|
||||||
|
if(property("compact").toBool())
|
||||||
|
{
|
||||||
|
layout.addSpacing(18);
|
||||||
|
layout.addWidget(avatar);
|
||||||
|
layout.addSpacing(5);
|
||||||
|
layout.addWidget(nameLabel);
|
||||||
|
layout.addWidget(statusMessageLabel);
|
||||||
|
layout.addSpacing(5);
|
||||||
|
layout.addWidget(&statusPic);
|
||||||
|
layout.addSpacing(5);
|
||||||
|
layout.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textLayout.addStretch();
|
||||||
|
textLayout.addWidget(nameLabel);
|
||||||
|
textLayout.addWidget(statusMessageLabel);
|
||||||
|
textLayout.addStretch();
|
||||||
|
|
||||||
textLayout.addStretch();
|
layout.addSpacing(20);
|
||||||
textLayout.addWidget(nameLabel);
|
layout.addWidget(avatar);
|
||||||
textLayout.addWidget(statusMessageLabel);
|
layout.addSpacing(10);
|
||||||
textLayout.addStretch();
|
layout.addLayout(&textLayout);
|
||||||
|
layout.addSpacing(10);
|
||||||
layout.addSpacing(20);
|
layout.addWidget(&statusPic);
|
||||||
layout.addWidget(avatar);
|
layout.addSpacing(10);
|
||||||
layout.addSpacing(10);
|
layout.activate();
|
||||||
layout.addLayout(&textLayout);
|
}
|
||||||
layout.addSpacing(10);
|
|
||||||
layout.addWidget(&statusPic);
|
|
||||||
layout.addSpacing(10);
|
|
||||||
layout.activate();
|
|
||||||
|
|
||||||
setProperty("active", false);
|
setProperty("active", false);
|
||||||
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
|
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
|
||||||
@ -102,3 +134,13 @@ void GenericChatroomWidget::reloadTheme()
|
|||||||
{
|
{
|
||||||
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
|
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/genericChatroomWidget.css"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GenericChatroomWidget::isCompact() const
|
||||||
|
{
|
||||||
|
return compact;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericChatroomWidget::setCompact(bool compact) {
|
||||||
|
this->compact = compact;
|
||||||
|
Style::repolish(this);
|
||||||
|
}
|
||||||
|
@ -53,6 +53,11 @@ public:
|
|||||||
|
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
|
|
||||||
|
bool isCompact() const;
|
||||||
|
void setCompact(bool compact);
|
||||||
|
|
||||||
|
Q_PROPERTY(bool compact READ isCompact WRITE setCompact)
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void chatroomWidgetClicked(GenericChatroomWidget* widget);
|
void chatroomWidgetClicked(GenericChatroomWidget* widget);
|
||||||
|
|
||||||
@ -65,6 +70,7 @@ protected:
|
|||||||
MaskablePixmapWidget* avatar;
|
MaskablePixmapWidget* avatar;
|
||||||
QLabel statusPic;
|
QLabel statusPic;
|
||||||
CroppingLabel *nameLabel, *statusMessageLabel;
|
CroppingLabel *nameLabel, *statusMessageLabel;
|
||||||
|
bool compact;
|
||||||
|
|
||||||
friend class Style; ///< To update our stylesheets
|
friend class Style; ///< To update our stylesheets
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
GenericChatroomWidget
|
GenericChatroomWidget
|
||||||
{
|
{
|
||||||
background-color: @themeMedium;
|
background-color: @themeMedium;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8,31 +8,55 @@ GenericChatroomWidget[active="true"]
|
|||||||
background-color: @white;
|
background-color: @white;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericChatroomWidget[active="false"]:hover
|
GenericChatroomWidget[active="false"]:hover
|
||||||
{
|
{
|
||||||
background-color: @themeLight;
|
background-color: @themeLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericChatroomWidget[active="true"] > QLabel#status
|
GenericChatroomWidget[active="true"][compact="true"] > QLabel#status
|
||||||
|
{
|
||||||
|
font: @small;
|
||||||
|
color: @mediumGrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericChatroomWidget[active="false"][compact="true"] > QLabel#status
|
||||||
|
{
|
||||||
|
font: @small;
|
||||||
|
color: @lightGrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericChatroomWidget[active="true"][compact="true"] > QLabel#name
|
||||||
|
{
|
||||||
|
font: @medium;
|
||||||
|
color: @darkGrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericChatroomWidget[active="false"][compact="true"] > QLabel#name
|
||||||
|
{
|
||||||
|
font: @medium;
|
||||||
|
color: @white;
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericChatroomWidget[active="true"][compact="false"] > QLabel#status
|
||||||
{
|
{
|
||||||
font: @medium;
|
font: @medium;
|
||||||
color: @mediumGrey;
|
color: @mediumGrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericChatroomWidget[active="false"] > QLabel#status
|
GenericChatroomWidget[active="false"][compact="false"] > QLabel#status
|
||||||
{
|
{
|
||||||
font: @medium;
|
font: @medium;
|
||||||
color: @lightGrey;
|
color: @lightGrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericChatroomWidget[active="true"] > QLabel#name
|
GenericChatroomWidget[active="true"][compact="false"] > QLabel#name
|
||||||
{
|
{
|
||||||
font: @big;
|
font: @big;
|
||||||
color: @darkGrey;
|
color: @darkGrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericChatroomWidget[active="false"] > QLabel#name
|
GenericChatroomWidget[active="false"][compact="false"] > QLabel#name
|
||||||
{
|
{
|
||||||
font: @big;
|
font: @big;
|
||||||
color: @white;
|
color: @white;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user