Merge pull request #786 from Gelmir/inputDlg_autoexpand

Resize input dialogs to fit contents
This commit is contained in:
sledgehammer999
2013-07-27 12:10:43 -07:00
15 changed files with 338 additions and 40 deletions

View File

@@ -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)) {

View File

@@ -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)) {