mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #2137 from agilob:tox_core_version
better, more flexible about page, versions section hide toxcore version fix uri parsing and tox URI detection, closes #2118 fix uri detection, puts dots between toxcore versions
This commit is contained in:
commit
0c6c28bfbb
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ private slots:
|
||||
|
||||
private:
|
||||
void retranslateUi();
|
||||
void replaceVersions();
|
||||
|
||||
private:
|
||||
Ui::AboutSettings* bodyUI;
|
||||
|
@ -29,9 +29,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-54</y>
|
||||
<width>492</width>
|
||||
<height>508</height>
|
||||
<y>0</y>
|
||||
<width>494</width>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
|
||||
@ -52,9 +52,9 @@
|
||||
<property name="title">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="youareusing">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -70,7 +70,7 @@
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
<string>You are using a qTox nightly build.</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
@ -83,6 +83,57 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="gitVersion">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Commit hash: <a href="https://github.com/tux3/qTox/commit/$GIT_VERSION">$GIT_VERSION</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="toxCoreVersion">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ToxCore version: $TOXCOREVERSION</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -125,12 +176,12 @@
|
||||
<string><!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></string>
|
||||
</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></string>
|
||||
</property>
|
||||
<property name="searchPaths">
|
||||
<stringlist/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user