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

refactor: Rename AboutUser to AboutFriendForm

This commit is contained in:
Diadlo 2017-08-30 00:46:19 +03:00
parent c6d76da0dd
commit 8368f2413d
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
6 changed files with 33 additions and 34 deletions

View File

@ -89,7 +89,7 @@ qt5_wrap_ui(${PROJECT_NAME}_FORMS
src/chatlog/content/filetransferwidget.ui src/chatlog/content/filetransferwidget.ui
src/loginscreen.ui src/loginscreen.ui
src/mainwindow.ui src/mainwindow.ui
src/widget/about/aboutuser.ui src/widget/about/aboutfriendform.ui
src/widget/form/loadhistorydialog.ui src/widget/form/loadhistorydialog.ui
src/widget/form/profileform.ui src/widget/form/profileform.ui
src/widget/form/removefrienddialog.ui src/widget/form/removefrienddialog.ui
@ -307,8 +307,8 @@ set(${PROJECT_NAME}_SOURCES
src/video/videosource.h src/video/videosource.h
src/video/videosurface.cpp src/video/videosurface.cpp
src/video/videosurface.h src/video/videosurface.h
src/widget/about/aboutuser.cpp src/widget/about/aboutfriendform.cpp
src/widget/about/aboutuser.h src/widget/about/aboutfriendform.h
src/widget/categorywidget.cpp src/widget/categorywidget.cpp
src/widget/categorywidget.h src/widget/categorywidget.h
src/widget/circlewidget.cpp src/widget/circlewidget.cpp

View File

@ -45,7 +45,7 @@ FORMS += \
src/widget/form/settings/advancedsettings.ui \ src/widget/form/settings/advancedsettings.ui \
src/widget/form/settings/aboutsettings.ui \ src/widget/form/settings/aboutsettings.ui \
src/widget/form/removefrienddialog.ui \ src/widget/form/removefrienddialog.ui \
src/widget/about/aboutuser.ui src/widget/about/aboutfriendform.ui
CONFIG += c++11 CONFIG += c++11
CONFIG += warn_on exceptions_off rtti_off CONFIG += warn_on exceptions_off rtti_off
@ -397,7 +397,7 @@ HEADERS += \
src/video/videomode.h \ src/video/videomode.h \
src/video/videosource.h \ src/video/videosource.h \
src/video/videosurface.h \ src/video/videosurface.h \
src/widget/about/aboutuser.h \ src/widget/about/aboutfriendform.h \
src/widget/categorywidget.h \ src/widget/categorywidget.h \
src/widget/circlewidget.h \ src/widget/circlewidget.h \
src/widget/contentdialog.h \ src/widget/contentdialog.h \
@ -520,7 +520,7 @@ SOURCES += \
src/video/videomode.cpp \ src/video/videomode.cpp \
src/video/videosource.cpp \ src/video/videosource.cpp \
src/video/videosurface.cpp \ src/video/videosurface.cpp \
src/widget/about/aboutuser.cpp \ src/widget/about/aboutfriendform.cpp \
src/widget/categorywidget.cpp \ src/widget/categorywidget.cpp \
src/widget/circlewidget.cpp \ src/widget/circlewidget.cpp \
src/widget/contentdialog.cpp \ src/widget/contentdialog.cpp \

View File

@ -1,5 +1,5 @@
#include "aboutuser.h" #include "aboutfriendform.h"
#include "ui_aboutuser.h" #include "ui_aboutfriendform.h"
#include "src/nexus.h" #include "src/nexus.h"
#include "src/persistence/profile.h" #include "src/persistence/profile.h"
#include "src/persistence/settings.h" #include "src/persistence/settings.h"
@ -8,20 +8,20 @@
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
AboutUser::AboutUser(const Friend* f, QWidget* parent) AboutFriendForm::AboutFriendForm(const Friend* f, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::AboutUser) , ui(new Ui::AboutFriendForm)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->label_4->hide(); ui->label_4->hide();
ui->aliases->hide(); ui->aliases->hide();
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AboutUser::onAcceptedClicked); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AboutFriendForm::onAcceptedClicked);
connect(ui->autoacceptfile, &QCheckBox::clicked, this, &AboutUser::onAutoAcceptDirClicked); connect(ui->autoacceptfile, &QCheckBox::clicked, this, &AboutFriendForm::onAutoAcceptDirClicked);
connect(ui->autoacceptcall, SIGNAL(activated(int)), this, SLOT(onAutoAcceptCallClicked(void))); connect(ui->autoacceptcall, SIGNAL(activated(int)), this, SLOT(onAutoAcceptCallClicked(void)));
connect(ui->autogroupinvite, &QCheckBox::clicked, this, &AboutUser::onAutoGroupInvite); connect(ui->autogroupinvite, &QCheckBox::clicked, this, &AboutFriendForm::onAutoGroupInvite);
connect(ui->selectSaveDir, &QPushButton::clicked, this, &AboutUser::onSelectDirClicked); connect(ui->selectSaveDir, &QPushButton::clicked, this, &AboutFriendForm::onSelectDirClicked);
connect(ui->removeHistory, &QPushButton::clicked, this, &AboutUser::onRemoveHistoryClicked); connect(ui->removeHistory, &QPushButton::clicked, this, &AboutFriendForm::onRemoveHistoryClicked);
friendPk = f->getPublicKey(); friendPk = f->getPublicKey();
Settings& s = Settings::getInstance(); Settings& s = Settings::getInstance();
@ -48,7 +48,7 @@ AboutUser::AboutUser(const Friend* f, QWidget* parent)
ui->avatar->setPixmap(avatar.isNull() ? QPixmap(":/img/contact_dark.svg") : avatar); ui->avatar->setPixmap(avatar.isNull() ? QPixmap(":/img/contact_dark.svg") : avatar);
} }
void AboutUser::onAutoAcceptDirClicked() void AboutFriendForm::onAutoAcceptDirClicked()
{ {
if (!ui->autoacceptfile->isChecked()) { if (!ui->autoacceptfile->isChecked()) {
ui->autoacceptfile->setChecked(false); ui->autoacceptfile->setChecked(false);
@ -71,7 +71,7 @@ void AboutUser::onAutoAcceptDirClicked()
ui->selectSaveDir->setEnabled(ui->autoacceptfile->isChecked()); ui->selectSaveDir->setEnabled(ui->autoacceptfile->isChecked());
} }
void AboutUser::onAutoAcceptCallClicked() void AboutFriendForm::onAutoAcceptCallClicked()
{ {
QFlag flag = QFlag(ui->autoacceptcall->currentIndex()); QFlag flag = QFlag(ui->autoacceptcall->currentIndex());
Settings::getInstance().setAutoAcceptCall(friendPk, Settings::AutoAcceptCallFlags(flag)); Settings::getInstance().setAutoAcceptCall(friendPk, Settings::AutoAcceptCallFlags(flag));
@ -81,13 +81,13 @@ void AboutUser::onAutoAcceptCallClicked()
/** /**
* @brief Sets the AutoGroupinvite status and saves the settings. * @brief Sets the AutoGroupinvite status and saves the settings.
*/ */
void AboutUser::onAutoGroupInvite() void AboutFriendForm::onAutoGroupInvite()
{ {
Settings::getInstance().setAutoGroupInvite(friendPk, ui->autogroupinvite->isChecked()); Settings::getInstance().setAutoGroupInvite(friendPk, ui->autogroupinvite->isChecked());
Settings::getInstance().savePersonal(); Settings::getInstance().savePersonal();
} }
void AboutUser::onSelectDirClicked() void AboutFriendForm::onSelectDirClicked()
{ {
QString dir = QFileDialog::getExistingDirectory( QString dir = QFileDialog::getExistingDirectory(
Q_NULLPTR, tr("Choose an auto accept directory", "popup title"), dir); Q_NULLPTR, tr("Choose an auto accept directory", "popup title"), dir);
@ -100,13 +100,13 @@ void AboutUser::onSelectDirClicked()
/** /**
* @brief Called when user clicks the bottom OK button, save all settings * @brief Called when user clicks the bottom OK button, save all settings
*/ */
void AboutUser::onAcceptedClicked() void AboutFriendForm::onAcceptedClicked()
{ {
Settings::getInstance().setContactNote(friendPk, ui->note->toPlainText()); Settings::getInstance().setContactNote(friendPk, ui->note->toPlainText());
Settings::getInstance().saveGlobal(); Settings::getInstance().saveGlobal();
} }
void AboutUser::onRemoveHistoryClicked() void AboutFriendForm::onRemoveHistoryClicked()
{ {
History* history = Nexus::getProfile()->getHistory(); History* history = Nexus::getProfile()->getHistory();
if (history) { if (history) {
@ -117,7 +117,7 @@ void AboutUser::onRemoveHistoryClicked()
.arg(ui->userName->text().toHtmlEscaped()), QMessageBox::Ok); .arg(ui->userName->text().toHtmlEscaped()), QMessageBox::Ok);
} }
AboutUser::~AboutUser() AboutFriendForm::~AboutFriendForm()
{ {
delete ui; delete ui;
} }

View File

@ -1,24 +1,23 @@
#ifndef ABOUTUSER_H #ifndef ABOUT_USER_FORM_H
#define ABOUTUSER_H #define ABOUT_USER_FORM_H
#include "src/model/friend.h" #include "src/model/friend.h"
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
class AboutUser; class AboutFriendForm;
} }
class AboutUser : public QDialog class AboutFriendForm : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AboutUser(const Friend* f, QWidget* parent = 0); explicit AboutFriendForm(const Friend* f, QWidget* parent = 0);
~AboutUser(); ~AboutFriendForm();
private: private:
Ui::AboutUser* ui; Ui::AboutFriendForm* ui;
ToxPk friendPk; ToxPk friendPk;
private slots: private slots:
@ -30,4 +29,4 @@ private slots:
void onRemoveHistoryClicked(); void onRemoveHistoryClicked();
}; };
#endif // ABOUTUSER_H #endif // ABOUT_USER_FORM_H

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AboutUser</class> <class>AboutFriendForm</class>
<widget class="QDialog" name="AboutUser"> <widget class="QDialog" name="AboutUser">
<property name="geometry"> <property name="geometry">
<rect> <rect>

View File

@ -29,7 +29,7 @@
#include "src/model/group.h" #include "src/model/group.h"
#include "src/grouplist.h" #include "src/grouplist.h"
#include "src/persistence/settings.h" #include "src/persistence/settings.h"
#include "src/widget/about/aboutuser.h" #include "src/widget/about/aboutfriendform.h"
#include "src/widget/form/chatform.h" #include "src/widget/form/chatform.h"
#include "src/widget/style.h" #include "src/widget/style.h"
#include "src/widget/tool/croppinglabel.h" #include "src/widget/tool/croppinglabel.h"
@ -229,7 +229,7 @@ void FriendWidget::onContextMenuCalled(QContextMenuEvent* event)
} }
} else if (selectedItem == aboutWindow) { } else if (selectedItem == aboutWindow) {
const Friend* f = FriendList::findFriend(friendId); const Friend* f = FriendList::findFriend(friendId);
AboutUser* aboutUser = new AboutUser(f, Widget::getInstance()); AboutFriendForm* aboutUser = new AboutFriendForm(f, Widget::getInstance());
aboutUser->show(); aboutUser->show();
} else if (selectedItem == newGroupAction) { } else if (selectedItem == newGroupAction) {
const int groupId = Core::getInstance()->createGroup(); const int groupId = Core::getInstance()->createGroup();