Browse Source

Merge pull request #2144 from sorokin/up-down-scrolling

Speed up scrolling with up/down keys
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
9d770ea48b
  1. 5
      src/misc.cpp
  2. 16
      src/torrentcontentmodel.cpp

5
src/misc.cpp

@ -505,7 +505,8 @@ bool misc::isUrl(const QString &s) @@ -505,7 +505,8 @@ bool misc::isUrl(const QString &s)
QString misc::parseHtmlLinks(const QString &raw_text)
{
QString result = raw_text;
QRegExp reURL("(\\s|^)" //start with whitespace or beginning of line
static QRegExp reURL(
"(\\s|^)" //start with whitespace or beginning of line
"("
"(" //case 1 -- URL with scheme
"(http(s?))\\://" //start with scheme
@ -556,7 +557,7 @@ QString misc::parseHtmlLinks(const QString &raw_text) @@ -556,7 +557,7 @@ QString misc::parseHtmlLinks(const QString &raw_text)
result.replace(reURL, "\\1<a href=\"\\2\">\\2</a>");
// Capture links without scheme
QRegExp reNoScheme("<a\\s+href=\"(?!http(s?))([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">");
static QRegExp reNoScheme("<a\\s+href=\"(?!http(s?))([a-zA-Z0-9\\?%=&/_\\.-:#]+)\\s*\">");
result.replace(reNoScheme, "<a href=\"http://\\1\">");
return result;

16
src/torrentcontentmodel.cpp

@ -37,6 +37,18 @@ @@ -37,6 +37,18 @@
#include "torrentcontentmodelfile.h"
#include <QDir>
namespace {
QIcon get_directory_icon() {
static QIcon cached = IconProvider::instance()->getIcon("inode-directory");
return cached;
}
QIcon get_file_icon() {
static QIcon cached = IconProvider::instance()->getIcon("text-plain");
return cached;
}
}
TorrentContentModel::TorrentContentModel(QObject *parent):
QAbstractItemModel(parent),
m_rootItem(new TorrentContentModelFolder(QList<QVariant>() << tr("Name") << tr("Size")
@ -169,9 +181,9 @@ QVariant TorrentContentModel::data(const QModelIndex& index, int role) const @@ -169,9 +181,9 @@ QVariant TorrentContentModel::data(const QModelIndex& index, int role) const
TorrentContentModelItem* item = static_cast<TorrentContentModelItem*>(index.internalPointer());
if (index.column() == 0 && role == Qt::DecorationRole) {
if (item->itemType() == TorrentContentModelItem::FolderType)
return IconProvider::instance()->getIcon("inode-directory");
return get_directory_icon();
else
return IconProvider::instance()->getIcon("text-plain");
return get_file_icon();
}
if (index.column() == 0 && role == Qt::CheckStateRole) {
if (item->data(TorrentContentModelItem::COL_PRIO).toInt() == prio::IGNORED)

Loading…
Cancel
Save