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

Merge pull request #3488

Diadlo (1):
      style(toxid, widgets): Made constructor explicit
This commit is contained in:
Nils Fenner 2016-07-24 09:51:16 +02:00
commit eb1e0091c4
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
6 changed files with 12 additions and 8 deletions

View File

@ -41,9 +41,9 @@ class ToxId
public: public:
ToxId(); ///< The default constructor. Creates an empty Tox ID. ToxId(); ///< The default constructor. Creates an empty Tox ID.
ToxId(const ToxId& other); ///< The copy constructor. ToxId(const ToxId& other); ///< The copy constructor.
ToxId(const QString& id); ///< Create a Tox ID from QString. explicit ToxId(const QString& id); ///< Create a Tox ID from QString.
/// If the given id is not a valid Tox ID, then: /// If the given id is not a valid Tox ID, then:
/// publicKey == id and noSpam == "" == checkSum. /// publicKey == id and noSpam == "" == checkSum.
bool operator==(const ToxId& other) const; ///< Compares only publicKey. bool operator==(const ToxId& other) const; ///< Compares only publicKey.
bool operator!=(const ToxId& other) const; ///< Compares only publicKey. bool operator!=(const ToxId& other) const; ///< Compares only publicKey.

View File

@ -94,7 +94,8 @@ void AboutUser::onSelectDirClicked()
*/ */
void AboutUser::onAcceptedClicked() void AboutUser::onAcceptedClicked()
{ {
Settings::getInstance().setContactNote(ui->publicKey->text(), ui->note->toPlainText()); ToxId toxId = ToxId(ui->publicKey->text());
Settings::getInstance().setContactNote(toxId, ui->note->toPlainText());
Settings::getInstance().saveGlobal(); Settings::getInstance().saveGlobal();
} }

View File

@ -523,7 +523,7 @@ void ProfileForm::onRegisterButtonClicked()
Core* oldCore = Core::getInstance(); Core* oldCore = Core::getInstance();
Toxme::ExecCode code = Toxme::ExecCode::Ok; Toxme::ExecCode code = Toxme::ExecCode::Ok;
QString response = Toxme::createAddress(code, server, id, name, privacy, bio); QString response = Toxme::createAddress(code, server, ToxId(id), name, privacy, bio);
Core* newCore = Core::getInstance(); Core* newCore = Core::getInstance();
// Make sure the user didn't logout (or logout and login) // Make sure the user didn't logout (or logout and login)

View File

@ -62,7 +62,10 @@ void TabCompleter::buildCompletionList()
for (auto name : group->getPeerList()) for (auto name : group->getPeerList())
{ {
if (regex.indexIn(name) > -1) if (regex.indexIn(name) > -1)
completionMap[name.toLower()] = name; {
SortableString lower = SortableString(name.toLower());
completionMap[lower] = name;
}
} }
nextCompletion = completionMap.begin(); nextCompletion = completionMap.begin();

View File

@ -45,7 +45,7 @@ public slots:
private: private:
struct SortableString { struct SortableString {
inline SortableString(const QString &n) : contents{n} {} explicit SortableString(const QString &n) : contents{n} {}
bool operator<(const SortableString &other) const; bool operator<(const SortableString &other) const;
QString contents; QString contents;
}; };

View File

@ -7,7 +7,7 @@
class PasswordEdit : public QLineEdit class PasswordEdit : public QLineEdit
{ {
public: public:
PasswordEdit(QWidget *parent); explicit PasswordEdit(QWidget *parent);
~PasswordEdit(); ~PasswordEdit();
protected: protected: