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

refactor: remove unused includes and format code

This commit is contained in:
sudden6 2018-10-14 16:38:50 +02:00
parent 13b15a87d7
commit 2408e76d0c
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -20,7 +20,6 @@
#include "addfriendform.h" #include "addfriendform.h"
#include "src/core/core.h" #include "src/core/core.h"
#include "src/net/toxme.h" #include "src/net/toxme.h"
#include "src/net/toxme.h"
#include "src/nexus.h" #include "src/nexus.h"
#include "src/persistence/settings.h" #include "src/persistence/settings.h"
#include "src/widget/contentlayout.h" #include "src/widget/contentlayout.h"
@ -30,15 +29,14 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QErrorMessage> #include <QErrorMessage>
#include <QFont>
#include <QFileDialog> #include <QFileDialog>
#include <QFont>
#include <QMessageBox> #include <QMessageBox>
#include <QRegularExpression> #include <QRegularExpression>
#include <QScrollArea> #include <QScrollArea>
#include <QSignalMapper> #include <QSignalMapper>
#include <QTabWidget> #include <QTabWidget>
#include <QWindow> #include <QWindow>
#include <tox/tox.h>
/** /**
* @var QString AddFriendForm::lastUsername * @var QString AddFriendForm::lastUsername
@ -187,8 +185,7 @@ void AddFriendForm::addFriend(const QString& idText)
friendId = Toxme::lookup(idText); // Try Toxme friendId = Toxme::lookup(idText); // Try Toxme
if (!friendId.isValid()) { if (!friendId.isValid()) {
GUI::showWarning(tr("Couldn't add friend"), GUI::showWarning(tr("Couldn't add friend"),
tr("%1 Tox ID is invalid or does not exist", "Toxme error") tr("%1 Tox ID is invalid or does not exist", "Toxme error").arg(idText));
.arg(idText));
return; return;
} }
} }
@ -278,8 +275,8 @@ void AddFriendForm::onIdChanged(const QString& id)
//: Tox ID format description //: Tox ID format description
const QString toxIdComment(tr("either 76 hexadecimal characters or name@example.com")); const QString toxIdComment(tr("either 76 hexadecimal characters or name@example.com"));
const QString labelText = isValidId ? QStringLiteral("%1 (%2)") const QString labelText =
: QStringLiteral("%1 <font color='red'>(%2)</font>"); isValidId ? QStringLiteral("%1 (%2)") : QStringLiteral("%1 <font color='red'>(%2)</font>");
toxIdLabel.setText(labelText.arg(toxIdText, toxIdComment)); toxIdLabel.setText(labelText.arg(toxIdText, toxIdComment));
toxId.setStyleSheet(isValidId ? QStringLiteral("") toxId.setStyleSheet(isValidId ? QStringLiteral("")
: QStringLiteral("QLineEdit { background-color: #FFC1C1; }")); : QStringLiteral("QLineEdit { background-color: #FFC1C1; }"));
@ -359,11 +356,11 @@ void AddFriendForm::retranslateUi()
message.setPlaceholderText(tr("%1 here! Tox me maybe?").arg(lastUsername)); message.setPlaceholderText(tr("%1 here! Tox me maybe?").arg(lastUsername));
importMessage.setPlaceholderText(message.placeholderText()); importMessage.setPlaceholderText(message.placeholderText());
importFileLabel.setText(contactsToImport.isEmpty() importFileLabel.setText(
contactsToImport.isEmpty()
? tr("Import a list of contacts, one Tox ID per line") ? tr("Import a list of contacts, one Tox ID per line")
//: Shows the number of contacts we're about to import from a file (at least one) //: Shows the number of contacts we're about to import from a file (at least one)
: tr("Ready to import %n contact(s), click send to confirm", "", : tr("Ready to import %n contact(s), click send to confirm", "", contactsToImport.size()));
contactsToImport.size()));
onIdChanged(toxId.text()); onIdChanged(toxId.text());