mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Merge pull request #786 from Gelmir/inputDlg_autoexpand
Resize input dialogs to fit contents
This commit is contained in:
commit
4cd4ad457b
@ -39,10 +39,10 @@
|
||||
#include "qbtsession.h"
|
||||
#include "iconprovider.h"
|
||||
#include "fs_utils.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QInputDialog>
|
||||
#include <QUrl>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
@ -399,7 +399,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||
const QModelIndex &index = selectedIndexes.first();
|
||||
// Ask for new name
|
||||
bool ok;
|
||||
const QString new_name_last = QInputDialog::getText(this, tr("Rename the file"),
|
||||
const QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),
|
||||
tr("New name:"), QLineEdit::Normal,
|
||||
index.data().toString(), &ok).trimmed();
|
||||
if (ok && !new_name_last.isEmpty()) {
|
||||
|
121
src/autoexpandabledialog.cpp
Normal file
121
src/autoexpandabledialog.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2013 Nick Tiskov
|
||||
*
|
||||
* This program is free 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : daymansmail@gmail.com
|
||||
*/
|
||||
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "ui_autoexpandabledialog.h"
|
||||
|
||||
AutoExpandableDialog::AutoExpandableDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AutoExpandableDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
AutoExpandableDialog::~AutoExpandableDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString AutoExpandableDialog::getText(QWidget *parent, const QString &title, const QString &label,
|
||||
QLineEdit::EchoMode mode, const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints) {
|
||||
|
||||
AutoExpandableDialog d(parent);
|
||||
d.setWindowTitle(title);
|
||||
d.ui->textLabel->setText(label);
|
||||
d.ui->textEdit->setText(text);
|
||||
d.ui->textEdit->setEchoMode(mode);
|
||||
d.ui->textEdit->setInputMethodHints(inputMethodHints);
|
||||
|
||||
bool res = d.exec();
|
||||
if (ok)
|
||||
*ok = res;
|
||||
|
||||
if (!res)
|
||||
return QString();
|
||||
|
||||
return d.ui->textEdit->text();
|
||||
}
|
||||
|
||||
void AutoExpandableDialog::showEvent(QShowEvent *e) {
|
||||
// Overriding showEvent is required for consistent UI with fixed size under custom DPI
|
||||
// Show dialog
|
||||
QDialog::showEvent(e);
|
||||
// and resize textbox to fit the text
|
||||
|
||||
// NOTE: For some strange reason QFontMetrics gets more accurate
|
||||
// when called from showEvent. Only 6 symbols off instead of 11 symbols off.
|
||||
int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4;
|
||||
int screenW = QApplication::desktop()->width() / 4;
|
||||
int wd = textW;
|
||||
|
||||
if (!windowTitle().isEmpty()) {
|
||||
int _w = fontMetrics().width(windowTitle());
|
||||
if (_w > wd)
|
||||
wd = _w;
|
||||
}
|
||||
|
||||
if (!ui->textLabel->text().isEmpty()) {
|
||||
int _w = ui->textLabel->fontMetrics().width(ui->textLabel->text());
|
||||
if (_w > wd)
|
||||
wd = _w;
|
||||
}
|
||||
|
||||
|
||||
// Now resize the dialog to fit the contents
|
||||
// Maximum value is whichever is smaller:
|
||||
// 1. screen width / 4
|
||||
// 2. max width of text from either of: label, title, textedit
|
||||
// If the value is less than dialog default size default size is used
|
||||
wd = textW < screenW ? textW : screenW;
|
||||
if (wd > width())
|
||||
resize(width() - ui->horizontalLayout->sizeHint().width() + wd, height());
|
||||
|
||||
// Use old dialog behavior: prohibit resizing the dialog
|
||||
setFixedHeight(height());
|
||||
|
||||
// Update geometry: center on screen
|
||||
QDesktopWidget *desk = QApplication::desktop();
|
||||
MainWindow *wnd = qobject_cast<MainWindow*>(QApplication::activeWindow());
|
||||
QPoint p = QCursor::pos();
|
||||
|
||||
int screenNum = 0;
|
||||
if (wnd == 0)
|
||||
screenNum = desk->screenNumber(p);
|
||||
else if (!wnd->isHidden())
|
||||
screenNum = desk->screenNumber(wnd);
|
||||
else
|
||||
screenNum = desk->screenNumber(p);
|
||||
|
||||
QRect screenRes = desk->screenGeometry(screenNum);
|
||||
|
||||
QRect geom = geometry();
|
||||
geom.moveCenter(QPoint(screenRes.width() / 2, screenRes.height() / 2));
|
||||
setGeometry(geom);
|
||||
}
|
60
src/autoexpandabledialog.h
Normal file
60
src/autoexpandabledialog.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2013 Nick Tiskov
|
||||
*
|
||||
* This program is free 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : daymansmail@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef AUTOEXPANDABLEDIALOG_H
|
||||
#define AUTOEXPANDABLEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
|
||||
namespace Ui {
|
||||
class AutoExpandableDialog;
|
||||
}
|
||||
|
||||
class AutoExpandableDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutoExpandableDialog(QWidget *parent = 0);
|
||||
~AutoExpandableDialog();
|
||||
|
||||
static QString getText(QWidget *parent, const QString& title, const QString& label,
|
||||
QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(),
|
||||
bool * ok = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *e);
|
||||
|
||||
private:
|
||||
Ui::AutoExpandableDialog *ui;
|
||||
};
|
||||
|
||||
#endif // AUTOEXPANDABLEDIALOG_H
|
120
src/autoexpandabledialog.ui
Normal file
120
src/autoexpandabledialog.ui
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AutoExpandableDialog</class>
|
||||
<widget class="QDialog" name="AutoExpandableDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>222</width>
|
||||
<height>94</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel">
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textEdit">
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AutoExpandableDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AutoExpandableDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -72,6 +72,9 @@
|
||||
#include "torrentmodel.h"
|
||||
#include "executionlog.h"
|
||||
#include "iconprovider.h"
|
||||
#ifndef DISABLE_GUI
|
||||
#include "autoexpandabledialog.h"
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
#include "qmacapplication.h"
|
||||
void qt_mac_set_dock_menu(QMenu *menu);
|
||||
@ -397,7 +400,7 @@ void MainWindow::defineUILockPassword() {
|
||||
QString old_pass_md5 = Preferences().getUILockPasswordMD5();
|
||||
if (old_pass_md5.isNull()) old_pass_md5 = "";
|
||||
bool ok = false;
|
||||
QString new_clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, old_pass_md5, &ok);
|
||||
QString new_clear_password = AutoExpandableDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, old_pass_md5, &ok);
|
||||
if (ok) {
|
||||
new_clear_password = new_clear_password.trimmed();
|
||||
if (new_clear_password.size() < 3) {
|
||||
@ -417,7 +420,7 @@ void MainWindow::on_actionLock_qBittorrent_triggered() {
|
||||
if (pref.getUILockPasswordMD5().isEmpty()) {
|
||||
// Ask for a password
|
||||
bool ok = false;
|
||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
QString clear_password = AutoExpandableDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
if (!ok) return;
|
||||
pref.setUILockPassword(clear_password);
|
||||
}
|
||||
@ -682,7 +685,7 @@ void MainWindow::setTabText(int index, QString text) const {
|
||||
|
||||
bool MainWindow::unlockUI() {
|
||||
bool ok = false;
|
||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
QString clear_password = AutoExpandableDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
if (!ok) return false;
|
||||
Preferences pref;
|
||||
QString real_pass_md5 = pref.getUILockPasswordMD5();
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <QTextStream>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <QMenu>
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopServices>
|
||||
#include <QInputDialog>
|
||||
#include <libtorrent/version.hpp>
|
||||
#include "propertieswidget.h"
|
||||
#include "transferlistwidget.h"
|
||||
@ -58,6 +57,7 @@
|
||||
#include "iconprovider.h"
|
||||
#include "lineedit.h"
|
||||
#include "fs_utils.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
@ -534,7 +534,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||
const QModelIndex index = selectedIndexes.first();
|
||||
// Ask for new name
|
||||
bool ok;
|
||||
QString new_name_last = QInputDialog::getText(this, tr("Rename the file"),
|
||||
QString new_name_last = AutoExpandableDialog::getText(this, tr("Rename the file"),
|
||||
tr("New name:"), QLineEdit::Normal,
|
||||
index.data().toString(), &ok).trimmed();
|
||||
if (ok && !new_name_last.isEmpty()) {
|
||||
@ -647,7 +647,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||
void PropertiesWidget::askWebSeed() {
|
||||
bool ok;
|
||||
// Ask user for a new url seed
|
||||
const QString url_seed = QInputDialog::getText(this, tr("New url seed", "New HTTP source"),
|
||||
const QString url_seed = AutoExpandableDialog::getText(this, tr("New url seed", "New HTTP source"),
|
||||
tr("New url seed:"), QLineEdit::Normal,
|
||||
QString::fromUtf8("http://www."), &ok);
|
||||
if (!ok) return;
|
||||
@ -702,7 +702,7 @@ void PropertiesWidget::editWebSeed() {
|
||||
const QListWidgetItem *selected_item = selected_items.last();
|
||||
const QString old_seed = selected_item->text();
|
||||
bool result;
|
||||
const QString new_seed = QInputDialog::getText(this, tr("Web seed editing"),
|
||||
const QString new_seed = AutoExpandableDialog::getText(this, tr("Web seed editing"),
|
||||
tr("Web seed URL:"), QLineEdit::Normal,
|
||||
old_seed, &result);
|
||||
if (!result)
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include <QAction>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QInputDialog>
|
||||
#include <QUrl>
|
||||
#include <libtorrent/version.hpp>
|
||||
#include <libtorrent/peer_info.hpp>
|
||||
@ -46,6 +45,7 @@
|
||||
#include "qbtsession.h"
|
||||
#include "qinisettings.h"
|
||||
#include "misc.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
@ -360,19 +360,12 @@ void TrackerList::editSelectedTracker() {
|
||||
// During multi-select only process item selected last
|
||||
QUrl tracker_url = selected_items.last()->text(COL_URL);
|
||||
|
||||
QInputDialog editDlg(this);
|
||||
editDlg.setInputMode(QInputDialog::TextInput);
|
||||
editDlg.setLabelText(tr("Tracker URL:"));
|
||||
editDlg.setWindowTitle(tr("Tracker editing"));
|
||||
editDlg.setTextValue(tracker_url.toString());
|
||||
QSize dlgSize = editDlg.size();
|
||||
dlgSize.setWidth(350);
|
||||
editDlg.resize(dlgSize);
|
||||
|
||||
if(!editDlg.exec())
|
||||
bool ok;
|
||||
QUrl new_tracker_url = AutoExpandableDialog::getText(this, tr("Tracker editing"), tr("Tracker URL:"),
|
||||
QLineEdit::Normal, tracker_url.toString(), &ok).trimmed();
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
QUrl new_tracker_url = editDlg.textValue().trimmed();
|
||||
if (!new_tracker_url.isValid()) {
|
||||
QMessageBox::warning(this, tr("Tracker editing failed"), tr("The tracker URL entered is invalid."));
|
||||
return;
|
||||
|
@ -28,7 +28,6 @@
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QDebug>
|
||||
@ -44,6 +43,7 @@
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
#include "iconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@ -319,7 +319,7 @@ void AutomatedRssDownloader::saveEditedRule()
|
||||
void AutomatedRssDownloader::on_addRuleBtn_clicked()
|
||||
{
|
||||
// Ask for a rule name
|
||||
const QString rule_name = QInputDialog::getText(this, tr("New rule name"), tr("Please type the name of the new download rule."));
|
||||
const QString rule_name = AutoExpandableDialog::getText(this, tr("New rule name"), tr("Please type the name of the new download rule."));
|
||||
if (rule_name.isEmpty()) return;
|
||||
// Check if this rule name already exists
|
||||
if (m_editableRuleList->getRule(rule_name)) {
|
||||
@ -437,7 +437,7 @@ void AutomatedRssDownloader::renameSelectedRule()
|
||||
|
||||
QListWidgetItem *item = selection.first();
|
||||
forever {
|
||||
QString new_name = QInputDialog::getText(this, tr("Rule renaming"), tr("Please type the new rule name"), QLineEdit::Normal, item->text());
|
||||
QString new_name = AutoExpandableDialog::getText(this, tr("Rule renaming"), tr("Please type the new rule name"), QLineEdit::Normal, item->text());
|
||||
new_name = new_name.trimmed();
|
||||
if (new_name.isEmpty()) return;
|
||||
if (m_editableRuleList->ruleNames().contains(new_name, Qt::CaseInsensitive)) {
|
||||
|
@ -29,7 +29,6 @@
|
||||
*/
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMessageBox>
|
||||
@ -51,6 +50,7 @@
|
||||
#include "rsssettings.h"
|
||||
#include "automatedrssdownloader.h"
|
||||
#include "iconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
namespace Article {
|
||||
enum ArticleRoles {
|
||||
@ -150,7 +150,7 @@ void RSSImp::askNewFolder()
|
||||
rss_parent = m_rssManager;
|
||||
}
|
||||
bool ok;
|
||||
QString new_name = QInputDialog::getText(this, tr("Please choose a folder name"), tr("Folder name:"), QLineEdit::Normal, tr("New folder"), &ok);
|
||||
QString new_name = AutoExpandableDialog::getText(this, tr("Please choose a folder name"), tr("Folder name:"), QLineEdit::Normal, tr("New folder"), &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
@ -197,7 +197,7 @@ void RSSImp::on_newFeedButton_clicked()
|
||||
if (clip_txt.startsWith("http://", Qt::CaseInsensitive) || clip_txt.startsWith("https://", Qt::CaseInsensitive) || clip_txt.startsWith("ftp://", Qt::CaseInsensitive))
|
||||
default_url = clip_txt;
|
||||
|
||||
QString newUrl = QInputDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok);
|
||||
QString newUrl = AutoExpandableDialog::getText(this, tr("Please type a rss stream url"), tr("Stream URL:"), QLineEdit::Normal, default_url, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
@ -380,7 +380,7 @@ void RSSImp::renameSelectedRssFile()
|
||||
bool ok;
|
||||
QString newName;
|
||||
do {
|
||||
newName = QInputDialog::getText(this, tr("Please choose a new name for this RSS feed"), tr("New feed name:"), QLineEdit::Normal, m_feedList->getRSSItem(item)->displayName(), &ok);
|
||||
newName = AutoExpandableDialog::getText(this, tr("Please choose a new name for this RSS feed"), tr("New feed name:"), QLineEdit::Normal, m_feedList->getRSSItem(item)->displayName(), &ok);
|
||||
// Check if name is already taken
|
||||
if (ok) {
|
||||
if (rss_item->parent()->hasChild(newName)) {
|
||||
|
@ -36,13 +36,13 @@
|
||||
#include "searchengine.h"
|
||||
#include "pluginsource.h"
|
||||
#include "iconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include <QProcess>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QDropEvent>
|
||||
#include <QInputDialog>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
enum EngineColumns {ENGINE_NAME, ENGINE_URL, ENGINE_STATE, ENGINE_ID};
|
||||
@ -327,7 +327,7 @@ void engineSelectDlg::on_installButton_clicked() {
|
||||
|
||||
void engineSelectDlg::askForPluginUrl() {
|
||||
bool ok;
|
||||
QString url = QInputDialog::getText(this, tr("New search engine plugin URL"),
|
||||
QString url = AutoExpandableDialog::getText(this, tr("New search engine plugin URL"),
|
||||
tr("URL:"), QLineEdit::Normal,
|
||||
"http://", &ok);
|
||||
if (ok && !url.isEmpty()) {
|
||||
|
@ -148,7 +148,8 @@ nox {
|
||||
iconprovider.h \
|
||||
updownratiodlg.h \
|
||||
loglistwidget.h \
|
||||
addnewtorrentdialog.h
|
||||
addnewtorrentdialog.h \
|
||||
autoexpandabledialog.h
|
||||
|
||||
SOURCES += mainwindow.cpp \
|
||||
ico.cpp \
|
||||
@ -165,7 +166,8 @@ nox {
|
||||
iconprovider.cpp \
|
||||
updownratiodlg.cpp \
|
||||
loglistwidget.cpp \
|
||||
addnewtorrentdialog.cpp
|
||||
addnewtorrentdialog.cpp \
|
||||
autoexpandabledialog.cpp
|
||||
|
||||
win32 {
|
||||
HEADERS += programupdater.h
|
||||
@ -190,7 +192,8 @@ nox {
|
||||
confirmdeletiondlg.ui \
|
||||
torrentimportdlg.ui \
|
||||
executionlog.ui \
|
||||
addnewtorrentdialog.ui
|
||||
addnewtorrentdialog.ui \
|
||||
autoexpandabledialog.ui
|
||||
}
|
||||
|
||||
DESTDIR = .
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "torrentpersistentdata.h"
|
||||
#include "torrentcreatordlg.h"
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <QIcon>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QInputDialog>
|
||||
#include <QDragMoveEvent>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMessageBox>
|
||||
@ -51,6 +50,7 @@
|
||||
#include "torrentmodel.h"
|
||||
#include "iconprovider.h"
|
||||
#include "fs_utils.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
class LabelFiltersList: public QListWidget {
|
||||
Q_OBJECT
|
||||
@ -368,7 +368,7 @@ protected slots:
|
||||
bool invalid;
|
||||
do {
|
||||
invalid = false;
|
||||
label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, label, &ok);
|
||||
label = AutoExpandableDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, label, &ok);
|
||||
if (ok && !label.isEmpty()) {
|
||||
if (fsutils::isValidFileSystemName(label)) {
|
||||
addLabel(label);
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QInputDialog>
|
||||
#include <QColor>
|
||||
#include <QUrl>
|
||||
#include <QMenu>
|
||||
@ -61,6 +60,7 @@
|
||||
#include "qinisettings.h"
|
||||
#include "iconprovider.h"
|
||||
#include "fs_utils.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
@ -607,7 +607,7 @@ void TransferListWidget::askNewLabelForSelection() {
|
||||
bool invalid;
|
||||
do {
|
||||
invalid = false;
|
||||
const QString label = QInputDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, "", &ok).trimmed();
|
||||
const QString label = AutoExpandableDialog::getText(this, tr("New Label"), tr("Label:"), QLineEdit::Normal, "", &ok).trimmed();
|
||||
if (ok && !label.isEmpty()) {
|
||||
if (fsutils::isValidFileSystemName(label)) {
|
||||
setSelectionLabel(label);
|
||||
@ -629,7 +629,7 @@ void TransferListWidget::renameSelectedTorrent() {
|
||||
if (!h.is_valid()) return;
|
||||
// Ask for a new Name
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(this, tr("Rename"), tr("New name:"), QLineEdit::Normal, h.name(), &ok);
|
||||
QString name = AutoExpandableDialog::getText(this, tr("Rename"), tr("New name:"), QLineEdit::Normal, h.name(), &ok);
|
||||
if (ok && !name.isEmpty()) {
|
||||
name.replace(QRegExp("\r?\n|\r"), " ");
|
||||
// Rename the torrent
|
||||
|
Loading…
Reference in New Issue
Block a user