diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp index 89120f07d..f2ec2a178 100644 --- a/src/chatlog/chatmessage.cpp +++ b/src/chatlog/chatmessage.cpp @@ -179,8 +179,13 @@ QString ChatMessage::detectAnchors(const QString &str) { QString out = str; - // detect urls - QRegExp exp("(?:\\b)(www\\.|http[s]?:\\/\\/|ftp:\\/\\/|tox:\\/\\/|tox:)\\S+"); + // detect URIs + QRegExp exp("(" + "(?:\\b)(www\\.|http[s]?|ftp)://" // (protocol)://(printable - non-special character) + // http://ONEORMOREALHPA-DIGIT + "\\w+\\S+)" // any other character, lets domains and other + "|(^tox:[@\\w]+$)"); // starts with `tox` then : and only alpha-digits till the end + // also accepts tox:agilob@net as simplified TOX ID int offset = 0; while ((offset = exp.indexIn(out, offset)) != -1) { diff --git a/src/net/toxuri.cpp b/src/net/toxuri.cpp index f5a5436d8..a408a79c7 100644 --- a/src/net/toxuri.cpp +++ b/src/net/toxuri.cpp @@ -57,7 +57,7 @@ bool handleToxURI(const QString &toxURI) qApp->processEvents(); QString toxaddr; - if (toxURI.startsWith("tox://")) + if (toxURI.startsWith("tox:")) toxaddr = toxURI.mid(6); else toxaddr = toxURI.mid(4); @@ -66,11 +66,13 @@ bool handleToxURI(const QString &toxURI) if (toxid.isEmpty()) { - QMessageBox::warning(0, "qTox", toxaddr+" is not a valid Tox address."); + QMessageBox::warning(0, "qTox", toxaddr + " is not a valid Tox address."); } else { - ToxURIDialog dialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?","Default message in Tox URI friend requests. Write something appropriate!").arg(Nexus::getCore()->getUsername())); + ToxURIDialog dialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?", + "Default message in Tox URI friend requests. Write something appropriate!") + .arg(Nexus::getCore()->getUsername())); if (dialog.exec() == QDialog::Accepted) Core::getInstance()->requestFriendship(toxid, dialog.getRequestMessage()); } @@ -81,7 +83,7 @@ ToxURIDialog::ToxURIDialog(QWidget *parent, const QString &userId, const QString QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - setWindowTitle(tr("Add a friend","Title of the window to add a friend through Tox URI")); + setWindowTitle(tr("Add a friend", "Title of the window to add a friend through Tox URI")); QLabel *friendsLabel = new QLabel(tr("Do you want to add %1 as a friend?").arg(userId), this); QLabel *userIdLabel = new QLabel(tr("User ID:"), this); @@ -93,8 +95,8 @@ ToxURIDialog::ToxURIDialog(QWidget *parent, const QString &userId, const QString QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this); - buttonBox->addButton(tr("Send","Send a friend request"), QDialogButtonBox::AcceptRole); - buttonBox->addButton(tr("Cancel","Don't send a friend request"), QDialogButtonBox::RejectRole); + buttonBox->addButton(tr("Send", "Send a friend request"), QDialogButtonBox::AcceptRole); + buttonBox->addButton(tr("Cancel", "Don't send a friend request"), QDialogButtonBox::RejectRole); connect(buttonBox, &QDialogButtonBox::accepted, this, &FriendRequestDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FriendRequestDialog::reject); diff --git a/src/widget/form/settings/aboutform.cpp b/src/widget/form/settings/aboutform.cpp index 2a9e45c90..b8541e446 100644 --- a/src/widget/form/settings/aboutform.cpp +++ b/src/widget/form/settings/aboutform.cpp @@ -21,21 +21,35 @@ #include "aboutform.h" #include "src/widget/translator.h" +#include "tox/tox.h" AboutForm::AboutForm() : GenericForm(QPixmap(":/img/settings/general.png")) { bodyUI = new Ui::AboutSettings; bodyUI->setupUi(this); - //to-do: when we finally have stable releases: build-in a way to tell - //nightly builds from stable releases. - bodyUI->label_4->setText(bodyUI->label_4->text().replace("GIT_VERSION", QString(GIT_VERSION))); + replaceVersions(); + if (QString(GIT_VERSION).indexOf(" ") > -1) - bodyUI->label_4->setOpenExternalLinks(false); + bodyUI->gitVersion->setOpenExternalLinks(false); Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this); } +//to-do: when we finally have stable releases: build-in a way to tell +//nightly builds from stable releases. +void AboutForm::replaceVersions() +{ + bodyUI->gitVersion->setText(bodyUI->gitVersion->text().replace("$GIT_VERSION", QString(GIT_VERSION))); + bodyUI->toxCoreVersion->setText( + bodyUI->toxCoreVersion->text().replace("$TOXCOREVERSION", + QString::number(TOX_VERSION_MAJOR) + "." + + QString::number(TOX_VERSION_MINOR) + "." + + QString::number(TOX_VERSION_PATCH))); + //TODO show when toxcore supports versioning #2086 + bodyUI->toxCoreVersion->hide(); +} + AboutForm::~AboutForm() { Translator::unregister(this); @@ -45,5 +59,5 @@ AboutForm::~AboutForm() void AboutForm::retranslateUi() { bodyUI->retranslateUi(this); - bodyUI->label_4->setText(bodyUI->label_4->text().replace("GIT_VERSION", QString(GIT_VERSION))); + replaceVersions(); } diff --git a/src/widget/form/settings/aboutform.h b/src/widget/form/settings/aboutform.h index 6aa6e8edd..c2845ed4e 100644 --- a/src/widget/form/settings/aboutform.h +++ b/src/widget/form/settings/aboutform.h @@ -42,6 +42,7 @@ private slots: private: void retranslateUi(); + void replaceVersions(); private: Ui::AboutSettings* bodyUI; diff --git a/src/widget/form/settings/aboutsettings.ui b/src/widget/form/settings/aboutsettings.ui index 73936bbbf..99203ff10 100644 --- a/src/widget/form/settings/aboutsettings.ui +++ b/src/widget/form/settings/aboutsettings.ui @@ -29,9 +29,9 @@ 0 - -54 - 492 - 508 + 0 + 494 + 554 @@ -52,9 +52,9 @@ Version - - - + + + 0 @@ -70,7 +70,7 @@ QFrame::NoFrame - <html><head/><body><p>You are using a qTox nightly build.</p><p>Commit hash: <a href="https://github.com/tux3/qTox/commit/GIT_VERSION"><span style=" text-decoration: underline; color:#0000ff;">GIT_VERSION</span></a></p></body></html> + You are using a qTox nightly build. -1 @@ -83,6 +83,57 @@ + + + + + 0 + 0 + + + + + Sans Serif + + + + true + + + Commit hash: <a href="https://github.com/tux3/qTox/commit/$GIT_VERSION">$GIT_VERSION</a> + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + Sans Serif + + + + true + + + ToxCore version: $TOXCOREVERSION + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + @@ -125,12 +176,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright © 2014-2015 by The qTox Project</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">qTox is a Qt-based graphical interface for Tox.</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; font-size:10pt; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu'; font-size:10pt;">.</span></p></body></html> +</style></head><body style=" font-family:'Oxygen-Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; color:#000000;">Copyright © 2014-2015 by The qTox Project</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">qTox is a Qt-based graphical interface for Tox.</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu';">You should have received a copy of the GNU General Public License along with this program. If not, see </span><a href="https://www.gnu.org/copyleft/gpl.html"><span style=" font-family:'Ubuntu'; text-decoration: underline; color:#007af4;">https://www.gnu.org/copyleft/gpl.html</span></a><span style=" font-family:'Ubuntu';">.</span></p></body></html>