mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr2547'
This commit is contained in:
commit
05c02cee5d
9
qtox.pro
9
qtox.pro
@ -35,7 +35,8 @@ FORMS += \
|
|||||||
src/widget/form/settings/avsettings.ui \
|
src/widget/form/settings/avsettings.ui \
|
||||||
src/widget/form/settings/generalsettings.ui \
|
src/widget/form/settings/generalsettings.ui \
|
||||||
src/widget/form/settings/privacysettings.ui \
|
src/widget/form/settings/privacysettings.ui \
|
||||||
src/widget/form/removefrienddialog.ui
|
src/widget/form/removefrienddialog.ui \
|
||||||
|
src/widget/about/aboutuser.ui
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
@ -507,7 +508,8 @@ SOURCES += \
|
|||||||
src/widget/tool/micfeedbackwidget.cpp \
|
src/widget/tool/micfeedbackwidget.cpp \
|
||||||
src/widget/tool/removefrienddialog.cpp \
|
src/widget/tool/removefrienddialog.cpp \
|
||||||
src/video/groupnetcamview.cpp \
|
src/video/groupnetcamview.cpp \
|
||||||
src/core/toxcall.cpp
|
src/core/toxcall.cpp \
|
||||||
|
src/widget/about/aboutuser.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/audio/audio.h \
|
src/audio/audio.h \
|
||||||
@ -560,4 +562,5 @@ HEADERS += \
|
|||||||
src/video/genericnetcamview.h \
|
src/video/genericnetcamview.h \
|
||||||
src/video/groupnetcamview.h \
|
src/video/groupnetcamview.h \
|
||||||
src/core/indexedlist.h \
|
src/core/indexedlist.h \
|
||||||
src/core/toxcall.h
|
src/core/toxcall.h \
|
||||||
|
src/widget/about/aboutuser.h
|
||||||
|
@ -92,10 +92,16 @@ void Friend::setAlias(QString name)
|
|||||||
|
|
||||||
void Friend::setStatusMessage(QString message)
|
void Friend::setStatusMessage(QString message)
|
||||||
{
|
{
|
||||||
|
statusMessage = message;
|
||||||
widget->setStatusMsg(message);
|
widget->setStatusMsg(message);
|
||||||
chatForm->setStatusMessage(message);
|
chatForm->setStatusMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Friend::getStatusMessage()
|
||||||
|
{
|
||||||
|
return statusMessage;
|
||||||
|
}
|
||||||
|
|
||||||
QString Friend::getDisplayedName() const
|
QString Friend::getDisplayedName() const
|
||||||
{
|
{
|
||||||
if (userAlias.size() == 0)
|
if (userAlias.size() == 0)
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
bool hasAlias() const;
|
bool hasAlias() const;
|
||||||
|
|
||||||
void setStatusMessage(QString message);
|
void setStatusMessage(QString message);
|
||||||
|
QString getStatusMessage();
|
||||||
|
|
||||||
void setEventFlag(int f);
|
void setEventFlag(int f);
|
||||||
int getEventFlag() const;
|
int getEventFlag() const;
|
||||||
@ -64,7 +65,7 @@ signals:
|
|||||||
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
|
void displayedNameChanged(FriendWidget* widget, Status s, int hasNewEvents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString userAlias, userName;
|
QString userAlias, userName, statusMessage;
|
||||||
ToxId userID;
|
ToxId userID;
|
||||||
uint32_t friendId;
|
uint32_t friendId;
|
||||||
int hasNewEvents;
|
int hasNewEvents;
|
||||||
|
@ -304,6 +304,7 @@ void Settings::loadPersonnal(Profile* profile)
|
|||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = ps.value("addr").toString();
|
fp.addr = ps.value("addr").toString();
|
||||||
fp.alias = ps.value("alias").toString();
|
fp.alias = ps.value("alias").toString();
|
||||||
|
fp.note = ps.value("note").toString();
|
||||||
fp.autoAcceptDir = ps.value("autoAcceptDir").toString();
|
fp.autoAcceptDir = ps.value("autoAcceptDir").toString();
|
||||||
fp.circleID = ps.value("circle", -1).toInt();
|
fp.circleID = ps.value("circle", -1).toInt();
|
||||||
|
|
||||||
@ -478,6 +479,7 @@ void Settings::savePersonal(QString profileName, QString password)
|
|||||||
ps.setArrayIndex(index);
|
ps.setArrayIndex(index);
|
||||||
ps.setValue("addr", frnd.addr);
|
ps.setValue("addr", frnd.addr);
|
||||||
ps.setValue("alias", frnd.alias);
|
ps.setValue("alias", frnd.alias);
|
||||||
|
ps.setValue("note", frnd.note);
|
||||||
ps.setValue("autoAcceptDir", frnd.autoAcceptDir);
|
ps.setValue("autoAcceptDir", frnd.autoAcceptDir);
|
||||||
ps.setValue("circle", frnd.circleID);
|
ps.setValue("circle", frnd.circleID);
|
||||||
|
|
||||||
@ -913,6 +915,34 @@ void Settings::setAutoAcceptDir(const ToxId &id, const QString& dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Settings::getContactNote(const ToxId &id) const
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
|
||||||
|
auto it = friendLst.find(id.publicKey);
|
||||||
|
if (it != friendLst.end())
|
||||||
|
return it->note;
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setContactNote(const ToxId &id, const QString& note)
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&bigLock};
|
||||||
|
|
||||||
|
auto it = friendLst.find(id.publicKey);
|
||||||
|
if (it != friendLst.end())
|
||||||
|
{
|
||||||
|
qDebug() << note;
|
||||||
|
it->note = note;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateFriendAdress(id.toString());
|
||||||
|
setContactNote(id, note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::getGlobalAutoAcceptDir() const
|
QString Settings::getGlobalAutoAcceptDir() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&bigLock};
|
QMutexLocker locker{&bigLock};
|
||||||
@ -1252,6 +1282,7 @@ void Settings::updateFriendAdress(const QString &newAddr)
|
|||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = newAddr;
|
fp.addr = newAddr;
|
||||||
fp.alias = "";
|
fp.alias = "";
|
||||||
|
fp.note = "";
|
||||||
fp.autoAcceptDir = "";
|
fp.autoAcceptDir = "";
|
||||||
friendLst[newAddr] = fp;
|
friendLst[newAddr] = fp;
|
||||||
}
|
}
|
||||||
@ -1282,6 +1313,7 @@ void Settings::setFriendAlias(const ToxId &id, const QString &alias)
|
|||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = key;
|
fp.addr = key;
|
||||||
fp.alias = alias;
|
fp.alias = alias;
|
||||||
|
fp.note = "";
|
||||||
fp.autoAcceptDir = "";
|
fp.autoAcceptDir = "";
|
||||||
friendLst[key] = fp;
|
friendLst[key] = fp;
|
||||||
}
|
}
|
||||||
@ -1310,6 +1342,7 @@ void Settings::setFriendCircleID(const ToxId &id, int circleID)
|
|||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = key;
|
fp.addr = key;
|
||||||
fp.alias = "";
|
fp.alias = "";
|
||||||
|
fp.note = "";
|
||||||
fp.autoAcceptDir = "";
|
fp.autoAcceptDir = "";
|
||||||
fp.circleID = circleID;
|
fp.circleID = circleID;
|
||||||
friendLst[key] = fp;
|
friendLst[key] = fp;
|
||||||
@ -1339,6 +1372,7 @@ void Settings::setFriendActivity(const ToxId &id, const QDate &activity)
|
|||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = key;
|
fp.addr = key;
|
||||||
fp.alias = "";
|
fp.alias = "";
|
||||||
|
fp.note = "";
|
||||||
fp.autoAcceptDir = "";
|
fp.autoAcceptDir = "";
|
||||||
fp.circleID = -1;
|
fp.circleID = -1;
|
||||||
fp.activity = activity;
|
fp.activity = activity;
|
||||||
|
@ -187,8 +187,11 @@ public:
|
|||||||
int getEmojiFontPointSize() const;
|
int getEmojiFontPointSize() const;
|
||||||
void setEmojiFontPointSize(int value);
|
void setEmojiFontPointSize(int value);
|
||||||
|
|
||||||
|
QString getContactNote(const ToxId& id) const;
|
||||||
|
void setContactNote(const ToxId& id, const QString& note);
|
||||||
|
|
||||||
QString getAutoAcceptDir(const ToxId& id) const;
|
QString getAutoAcceptDir(const ToxId& id) const;
|
||||||
void setAutoAcceptDir(const ToxId&id, const QString& dir);
|
void setAutoAcceptDir(const ToxId& id, const QString& dir);
|
||||||
|
|
||||||
QString getGlobalAutoAcceptDir() const;
|
QString getGlobalAutoAcceptDir() const;
|
||||||
void setGlobalAutoAcceptDir(const QString& dir);
|
void setGlobalAutoAcceptDir(const QString& dir);
|
||||||
@ -394,6 +397,7 @@ private:
|
|||||||
QString alias;
|
QString alias;
|
||||||
QString addr;
|
QString addr;
|
||||||
QString autoAcceptDir;
|
QString autoAcceptDir;
|
||||||
|
QString note;
|
||||||
int circleID = -1;
|
int circleID = -1;
|
||||||
QDate activity = QDate();
|
QDate activity = QDate();
|
||||||
};
|
};
|
||||||
|
109
src/widget/about/aboutuser.cpp
Normal file
109
src/widget/about/aboutuser.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#include "aboutuser.h"
|
||||||
|
#include "ui_aboutuser.h"
|
||||||
|
#include "src/persistence/settings.h"
|
||||||
|
#include "src/persistence/historykeeper.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
AboutUser::AboutUser(ToxId &toxId, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::AboutUser)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->label_4->hide();
|
||||||
|
ui->aliases->hide();
|
||||||
|
|
||||||
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AboutUser::onAcceptedClicked);
|
||||||
|
connect(ui->autoaccept, &QCheckBox::clicked, this, &AboutUser::onAutoAcceptClicked);
|
||||||
|
connect(ui->selectSaveDir, &QPushButton::clicked, this, &AboutUser::onSelectDirClicked);
|
||||||
|
connect(ui->removeHistory, &QPushButton::clicked, this, &AboutUser::onRemoveHistoryClicked);
|
||||||
|
|
||||||
|
this->toxId = toxId;
|
||||||
|
QString dir = Settings::getInstance().getAutoAcceptDir(this->toxId);
|
||||||
|
ui->autoaccept->setChecked(!dir.isEmpty());
|
||||||
|
ui->selectSaveDir->setEnabled(ui->autoaccept->isChecked());
|
||||||
|
|
||||||
|
if(ui->autoaccept->isChecked())
|
||||||
|
ui->selectSaveDir->setText(Settings::getInstance().getAutoAcceptDir(this->toxId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutUser::setFriend(Friend *f)
|
||||||
|
{
|
||||||
|
this->setWindowTitle(f->getDisplayedName());
|
||||||
|
ui->userName->setText(f->getDisplayedName());
|
||||||
|
ui->publicKey->setText(QString(f->getToxId().toString()));
|
||||||
|
ui->publicKey->setCursorPosition(0); //scroll textline to left
|
||||||
|
ui->note->setPlainText(Settings::getInstance().getContactNote(f->getToxId()));
|
||||||
|
|
||||||
|
QPixmap avatar = Settings::getInstance().getSavedAvatar(f->getToxId().toString());
|
||||||
|
ui->statusMessage->setText(f->getStatusMessage());
|
||||||
|
if(!avatar.isNull()) {
|
||||||
|
ui->avatar->setPixmap(avatar);
|
||||||
|
} else {
|
||||||
|
ui->avatar->setPixmap(QPixmap(":/img/contact_dark.svg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutUser::onAutoAcceptClicked()
|
||||||
|
{
|
||||||
|
QString dir;
|
||||||
|
if (!ui->autoaccept->isChecked())
|
||||||
|
{
|
||||||
|
dir = QDir::homePath();
|
||||||
|
ui->autoaccept->setChecked(false);
|
||||||
|
Settings::getInstance().setAutoAcceptDir(this->toxId, "");
|
||||||
|
ui->selectSaveDir->setText(tr("Auto accept for this contact is disabled"));
|
||||||
|
}
|
||||||
|
else if (ui->autoaccept->isChecked())
|
||||||
|
{
|
||||||
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose an auto accept directory",
|
||||||
|
"popup title"), dir);
|
||||||
|
if(dir.isEmpty())
|
||||||
|
{
|
||||||
|
ui->autoaccept->setChecked(false);
|
||||||
|
return; // user canellced
|
||||||
|
}
|
||||||
|
Settings::getInstance().setAutoAcceptDir(this->toxId, dir);
|
||||||
|
ui->selectSaveDir->setText(Settings::getInstance().getAutoAcceptDir(this->toxId));
|
||||||
|
}
|
||||||
|
Settings::getInstance().saveGlobal();
|
||||||
|
ui->selectSaveDir->setEnabled(ui->autoaccept->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutUser::onSelectDirClicked()
|
||||||
|
{
|
||||||
|
QString dir;
|
||||||
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose an auto accept directory",
|
||||||
|
"popup title"), dir);
|
||||||
|
ui->autoaccept->setChecked(true);
|
||||||
|
Settings::getInstance().setAutoAcceptDir(this->toxId, dir);
|
||||||
|
Settings::getInstance().saveGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief AboutUser::onAcceptedClicked When users clicks the bottom OK button,
|
||||||
|
* save all settings
|
||||||
|
*/
|
||||||
|
void AboutUser::onAcceptedClicked()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setContactNote(ui->publicKey->text(), ui->note->toPlainText());
|
||||||
|
Settings::getInstance().saveGlobal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutUser::onRemoveHistoryClicked()
|
||||||
|
{
|
||||||
|
HistoryKeeper::getInstance()->removeFriendHistory(toxId.publicKey);
|
||||||
|
QMessageBox::StandardButton reply;
|
||||||
|
reply = QMessageBox::information(this,
|
||||||
|
tr("History removed"),
|
||||||
|
tr("Chat history with %1 removed!").arg(ui->userName->text().toHtmlEscaped()),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
AboutUser::~AboutUser()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
32
src/widget/about/aboutuser.h
Normal file
32
src/widget/about/aboutuser.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef ABOUTUSER_H
|
||||||
|
#define ABOUTUSER_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "src/friend.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AboutUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AboutUser : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AboutUser(ToxId &toxID, QWidget *parent = 0);
|
||||||
|
~AboutUser();
|
||||||
|
void setFriend(Friend *f);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AboutUser *ui;
|
||||||
|
ToxId toxId;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onAcceptedClicked();
|
||||||
|
void onAutoAcceptClicked();
|
||||||
|
void onSelectDirClicked();
|
||||||
|
void onRemoveHistoryClicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ABOUTUSER_H
|
254
src/widget/about/aboutuser.ui
Normal file
254
src/widget/about/aboutuser.ui
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AboutUser</class>
|
||||||
|
<widget class="QDialog" name="AboutUser">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>465</width>
|
||||||
|
<height>406</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="userName">
|
||||||
|
<property name="text">
|
||||||
|
<string>username</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignBottom">
|
||||||
|
<widget class="QLabel" name="statusMessage">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>status message</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="avatar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>75</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>75</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap>../../../img/contact_dark.svg</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="labelAlignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Public key:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="publicKey">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="cursorPosition">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="cursorMoveStyle">
|
||||||
|
<enum>Qt::LogicalMoveStyle</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Used aliases:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="aliases">
|
||||||
|
<property name="text">
|
||||||
|
<string>HISTORY OF ALIASES</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default directory to save files:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="selectSaveDir">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto accept for this contact is disabled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="autoaccept">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto accept files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeHistory">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove history (operation can not be undone!)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Notes</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="note">
|
||||||
|
<property name="plainText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>You can save comment about this contact here.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>AboutUser</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>AboutUser</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -31,6 +31,7 @@
|
|||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
|
#include "src/widget/about/aboutuser.h"
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
@ -48,8 +49,8 @@ FriendWidget::FriendWidget(int FriendId, QString id)
|
|||||||
, isDefaultAvatar{true}
|
, isDefaultAvatar{true}
|
||||||
, historyLoaded{false}
|
, historyLoaded{false}
|
||||||
{
|
{
|
||||||
avatar->setPixmap(QPixmap(":img/contact.svg"), Qt::transparent);
|
avatar->setPixmap(QPixmap(":/img/contact.svg"), Qt::transparent);
|
||||||
statusPic.setPixmap(QPixmap(":img/status/dot_offline.svg"));
|
statusPic.setPixmap(QPixmap(":/img/status/dot_offline.svg"));
|
||||||
statusPic.setMargin(3);
|
statusPic.setMargin(3);
|
||||||
nameLabel->setText(id);
|
nameLabel->setText(id);
|
||||||
nameLabel->setTextFormat(Qt::PlainText);
|
nameLabel->setTextFormat(Qt::PlainText);
|
||||||
@ -150,6 +151,9 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
if (contentDialog == nullptr || !contentDialog->hasFriendWidget(friendId, this))
|
if (contentDialog == nullptr || !contentDialog->hasFriendWidget(friendId, this))
|
||||||
removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
|
removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
|
||||||
|
|
||||||
|
menu.addSeparator();
|
||||||
|
QAction* aboutWindow = menu.addAction(tr("Show details"));
|
||||||
|
|
||||||
QAction* selectedItem = menu.exec(pos);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
|
|
||||||
removeEventFilter(this);
|
removeEventFilter(this);
|
||||||
@ -188,8 +192,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
autoAccept->setChecked(false);
|
autoAccept->setChecked(false);
|
||||||
Settings::getInstance().setAutoAcceptDir(id, "");
|
Settings::getInstance().setAutoAcceptDir(id, "");
|
||||||
}
|
}
|
||||||
|
else if (autoAccept->isChecked())
|
||||||
if (autoAccept->isChecked())
|
|
||||||
{
|
{
|
||||||
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
|
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
|
||||||
autoAccept->setChecked(true);
|
autoAccept->setChecked(true);
|
||||||
@ -197,6 +200,11 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
Settings::getInstance().setAutoAcceptDir(id, dir);
|
Settings::getInstance().setAutoAcceptDir(id, dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (selectedItem == aboutWindow) {
|
||||||
|
AboutUser *aboutUser = new AboutUser(id, Widget::getInstance());
|
||||||
|
aboutUser->setFriend(FriendList::findFriend(friendId));
|
||||||
|
aboutUser->show();
|
||||||
|
}
|
||||||
else if (selectedItem == newCircleAction)
|
else if (selectedItem == newCircleAction)
|
||||||
{
|
{
|
||||||
if (circleWidget != nullptr)
|
if (circleWidget != nullptr)
|
||||||
@ -368,9 +376,9 @@ void FriendWidget::onAvatarRemoved(int FriendId)
|
|||||||
isDefaultAvatar = true;
|
isDefaultAvatar = true;
|
||||||
|
|
||||||
if (isActive())
|
if (isActive())
|
||||||
avatar->setPixmap(QPixmap(":img/contact_dark.svg"), Qt::transparent);
|
avatar->setPixmap(QPixmap(":/img/contact_dark.svg"), Qt::transparent);
|
||||||
else
|
else
|
||||||
avatar->setPixmap(QPixmap(":img/contact.svg"), Qt::transparent);
|
avatar->setPixmap(QPixmap(":/img/contact.svg"), Qt::transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendWidget::mousePressEvent(QMouseEvent *ev)
|
void FriendWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user