aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
authorLenny McLennington <lennymclennington@protonmail.com>2022-01-26 00:31:08 +0000
committerLenny McLennington <lennymclennington@protonmail.com>2022-01-26 00:34:02 +0000
commit0eff21a4f1ee97e4b0a484c608eac9617897446d (patch)
treee3fb7191ce8e01b23780e545833bcfc6d77b0c46 /launcher/ui
parentaf20b5ee0e09d5c9ec36d54c80ca688c7c67012d (diff)
downloadPrismLauncher-0eff21a4f1ee97e4b0a484c608eac9617897446d.tar.gz
PrismLauncher-0eff21a4f1ee97e4b0a484c608eac9617897446d.tar.bz2
PrismLauncher-0eff21a4f1ee97e4b0a484c608eac9617897446d.zip
Validate Pastebin URL with regex
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/pages/global/PastePage.cpp2
-rw-r--r--launcher/ui/pages/global/PastePage.ui19
2 files changed, 19 insertions, 2 deletions
diff --git a/launcher/ui/pages/global/PastePage.cpp b/launcher/ui/pages/global/PastePage.cpp
index 0965da77..7c69e1a4 100644
--- a/launcher/ui/pages/global/PastePage.cpp
+++ b/launcher/ui/pages/global/PastePage.cpp
@@ -30,7 +30,9 @@ PastePage::PastePage(QWidget *parent) :
QWidget(parent),
ui(new Ui::PastePage)
{
+ static QRegularExpression validUrlRegExp("https?://.+");
ui->setupUi(this);
+ ui->urlChoices->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->urlChoices));
ui->tabWidget->tabBar()->hide();\
loadSettings();
}
diff --git a/launcher/ui/pages/global/PastePage.ui b/launcher/ui/pages/global/PastePage.ui
index fe372540..2d13a765 100644
--- a/launcher/ui/pages/global/PastePage.ui
+++ b/launcher/ui/pages/global/PastePage.ui
@@ -38,7 +38,7 @@
<property name="title">
<string>Pastebin URL</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_10">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="Line" name="line">
<property name="orientation">
@@ -47,6 +47,21 @@
</widget>
</item>
<item>
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Note: only input that starts with &lt;span style=&quot; font-weight:600;&quot;&gt;http://&lt;/span&gt; or &lt;span style=&quot; font-weight:600;&quot;&gt;https://&lt;/span&gt; will be accepted.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QComboBox" name="urlChoices">
<property name="editable">
<bool>true</bool>
@@ -69,7 +84,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Here you can choose from a predefined list, or input the URL of a different paste service, provided that it supports the same protocol as 0x0.st, that is POST a file to the URL and return a link in the response body.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Here you can choose from a predefined list of paste services, or input the URL of a different paste service of your choice, provided it supports the same protocol as 0x0.st, that is POST a file parameter to the URL and return a link in the response body.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>