Formatter::initUnits ();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
- setAttribute (Qt::AA_UseHighDpiPixmaps);
-#endif
-
#if defined (_WIN32) || defined (__APPLE__)
if (QIcon::themeName ().isEmpty ())
QIcon::setThemeName (QLatin1String ("Faenza"));
#endif
(applicationDirPath () + QLatin1String ("/translations"));
- const QString qtFileName =
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- QLatin1String ("qt");
-#else
- QLatin1String ("qtbase");
-#endif
+ const QString qtFileName = QLatin1String ("qtbase");
const QLocale locale;
const QLocale englishLocale (QLocale::English, QLocale::UnitedStates);
{
InteropHelper::initialize ();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
Application::setAttribute (Qt::AA_EnableHighDpiScaling);
+#endif
+
Application::setAttribute (Qt::AA_UseHighDpiPixmaps);
Application app (argc, argv);
FilterBar.cc
FilterBarComboBox.cc
FilterBarComboBoxDelegate.cc
- FilterBarLineEdit.cc
Filters.cc
Formatter.cc
FreeSpaceLabel.cc
FilterBar.h
FilterBarComboBox.h
FilterBarComboBoxDelegate.h
- FilterBarLineEdit.h
Filters.h
Formatter.h
FreeSpaceLabel.h
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- #include <QDesktopServices>
-#else
- #include <QStandardPaths>
-#endif
+#include <QStandardPaths>
#include "FaviconCache.h"
QString
FaviconCache::getCacheDir ()
{
- const QString base =
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- QDesktopServices::storageLocation (QDesktopServices::CacheLocation);
-#else
- QStandardPaths::writableLocation (QStandardPaths::CacheLocation);
-#endif
+ const QString base = QStandardPaths::writableLocation (QStandardPaths::CacheLocation);
return QDir(base).absoluteFilePath (QLatin1String ("favicons"));
}
#include <QHBoxLayout>
#include <QLabel>
+#include <QLineEdit>
#include <QStandardItemModel>
#include "Application.h"
#include "FilterBar.h"
#include "FilterBarComboBox.h"
#include "FilterBarComboBoxDelegate.h"
-#include "FilterBarLineEdit.h"
#include "Prefs.h"
#include "Torrent.h"
#include "TorrentFilter.h"
h->addStretch ();
- myLineEdit = new FilterBarLineEdit (this);
+ myLineEdit = new QLineEdit (this);
+ myLineEdit->setClearButtonEnabled (true);
+ myLineEdit->setPlaceholderText (tr ("Search..."));
myLineEdit->setMaximumWidth (250);
h->addWidget (myLineEdit, 1);
connect (myLineEdit, SIGNAL (textChanged (QString)), this, SLOT (onTextChanged (QString)));
#include <QWidget>
class QLabel;
+class QLineEdit;
class QStandardItemModel;
class QTimer;
class FilterBarComboBox;
-class FilterBarLineEdit;
class Prefs;
class TorrentFilter;
class TorrentModel;
QStandardItemModel * myTrackerModel;
QTimer * myRecountTimer;
bool myIsBootstrapping;
- FilterBarLineEdit * myLineEdit;
+ QLineEdit * myLineEdit;
};
+++ /dev/null
-/*
- * This file Copyright (C) 2012-2015 Mnemosyne LLC
- *
- * It may be used under the GNU GPL versions 2 or 3
- * or any future license endorsed by Mnemosyne LLC.
- *
- */
-
-#include <QToolButton>
-#include <QStyle>
-
-#include "FilterBarLineEdit.h"
-
-FilterBarLineEdit::FilterBarLineEdit (QWidget * parent):
- QLineEdit (parent),
- myClearButton (nullptr)
-{
-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
- const QIcon icon = QIcon::fromTheme (QLatin1String ("edit-clear"), style ()->standardIcon (QStyle::SP_DialogCloseButton));
- const int iconSize = style ()->pixelMetric (QStyle::PM_SmallIconSize);
-
- myClearButton = new QToolButton (this);
- myClearButton->setStyleSheet (QLatin1String ("QToolButton{border:0;padding:0;margin:0}"));
- myClearButton->setToolButtonStyle (Qt::ToolButtonIconOnly);
- myClearButton->setFocusPolicy (Qt::NoFocus);
- myClearButton->setCursor (Qt::ArrowCursor);
- myClearButton->setIconSize (QSize (iconSize, iconSize));
- myClearButton->setIcon (icon);
- myClearButton->setFixedSize (myClearButton->iconSize () + QSize (2, 2));
- myClearButton->hide ();
-
- const int frameWidth = style ()->pixelMetric (QStyle::PM_DefaultFrameWidth);
- const QSize minSizeHint = minimumSizeHint ();
- const QSize buttonSize = myClearButton->size ();
-
- setStyleSheet (QString::fromLatin1 ("QLineEdit{padding-right:%1px}").arg (buttonSize.width () + frameWidth + 1));
- setMinimumSize (qMax (minSizeHint.width (), buttonSize.width () + frameWidth * 2 + 2),
- qMax (minSizeHint.height (), buttonSize.height () + frameWidth * 2 + 2));
-
- connect (this, SIGNAL (textChanged (QString)), this, SLOT (updateClearButtonVisibility ()));
- connect (myClearButton, SIGNAL (clicked ()), this, SLOT (clear ()));
-#else
- setClearButtonEnabled (true);
-#endif
-
-#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
- setPlaceholderText (tr ("Search..."));
-#endif
-}
-
-void
-FilterBarLineEdit::resizeEvent (QResizeEvent * event)
-{
- QLineEdit::resizeEvent (event);
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
- const int frameWidth = style ()->pixelMetric (QStyle::PM_DefaultFrameWidth);
- const QRect editRect = rect();
- const QSize buttonSize = myClearButton->size ();
-
- myClearButton->move (editRect.right () - frameWidth - buttonSize.width (),
- editRect.top () + (editRect.height () - buttonSize.height ()) / 2);
-#endif
-}
-
-void
-FilterBarLineEdit::updateClearButtonVisibility ()
-{
-#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
- myClearButton->setVisible (!text ().isEmpty ());
-#endif
-}
+++ /dev/null
-/*
- * This file Copyright (C) 2010-2015 Mnemosyne LLC
- *
- * It may be used under the GNU GPL versions 2 or 3
- * or any future license endorsed by Mnemosyne LLC.
- *
- */
-
-#pragma once
-
-#include <QLineEdit>
-
-class QToolButton;
-
-class FilterBarLineEdit: public QLineEdit
-{
- Q_OBJECT
-
- public:
- FilterBarLineEdit (QWidget * parent = nullptr);
-
- protected:
- // QWidget
- virtual void resizeEvent (QResizeEvent * event);
-
- private slots:
- void updateClearButtonVisibility ();
-
- private:
- QToolButton * myClearButton;
-};
-
if (mySession != 0)
return true;
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- if (myUrl.host () == QLatin1String ("127.0.0.1") ||
- myUrl.host ().compare (QLatin1String ("localhost"), Qt::CaseInsensitive) == 0)
- return true;
-#else
if (QHostAddress (myUrl.host ()).isLoopback ())
return true;
-#endif
return false;
}
#include <QHeaderView>
#include <QIcon>
#include <QInputDialog>
+#include <QMimeDatabase>
+#include <QMimeType>
#include <QObject>
#include <QPixmapCache>
#include <QSet>
#include <QStyle>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-#include <QMimeDatabase>
-#include <QMimeType>
-#endif
-
#include <libtransmission/transmission.h>
#include <libtransmission/utils.h> // tr_formatter
****
***/
-#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#if defined(_WIN32)
// Should be in QtWinExtras soon, but for now let's import it manually
extern QPixmap qt_pixmapFromWinHICON(HICON icon);
#endif
{
if (shellFileInfo.hIcon != NULL)
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
pixmap = qt_pixmapFromWinHICON (shellFileInfo.hIcon);
-#else
- pixmap = QPixmap::fromWinHICON (shellFileInfo.hIcon);
-#endif
::DestroyIcon (shellFileInfo.hIcon);
}
}
if (!icon.isNull ())
return icon;
-#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#else
QMimeDatabase mimeDb;
QMimeType mimeType = mimeDb.mimeTypeForFile (filename, QMimeDatabase::MatchExtension);
if (mimeType.isValid ())
return QIcon::fromTheme (mimeType.iconName (), QIcon::fromTheme (mimeType.genericIconName (), fallback));
-#else
-
- enum { DISK, DOCUMENT, PICTURE, VIDEO, ARCHIVE, AUDIO, APP, TYPE_COUNT };
- static QIcon fileIcons[TYPE_COUNT];
- static QSet<QString> suffixes[TYPE_COUNT];
-
- if (fileIcons[0].isNull ())
- {
- suffixes[DISK] << QString::fromLatin1("iso");
- fileIcons[DISK]= QIcon::fromTheme (QString::fromLatin1("media-optical"), fallback);
-
- const char * doc_types[] = {
- "abw", "csv", "doc", "dvi", "htm", "html", "ini", "log", "odp",
- "ods", "odt", "pdf", "ppt", "ps", "rtf", "tex", "txt", "xml" };
- for (const char * t: doc_types)
- suffixes[DOCUMENT] << QString::fromLatin1(t);
- fileIcons[DOCUMENT] = QIcon::fromTheme (QString::fromLatin1("text-x-generic"), fallback);
-
- const char * pic_types[] = {
- "bmp", "gif", "jpg", "jpeg", "pcx", "png", "psd", "ras", "tga", "tiff" };
- for (const char * t: pic_types)
- suffixes[PICTURE] << QString::fromLatin1(t);
- fileIcons[PICTURE] = QIcon::fromTheme (QString::fromLatin1("image-x-generic"), fallback);
-
- const char * vid_types[] = {
- "3gp", "asf", "avi", "mkv", "mov", "mpeg", "mpg", "mp4",
- "ogm", "ogv", "qt", "rm", "wmv" };
- for (const char * t: vid_types)
- suffixes[VIDEO] << QString::fromLatin1(t);
- fileIcons[VIDEO] = QIcon::fromTheme (QString::fromLatin1("video-x-generic"), fallback);
-
- const char * arc_types[] = {
- "7z", "ace", "bz2", "cbz", "gz", "gzip", "lzma", "rar", "sft", "tar", "zip" };
- for (const char * t: arc_types)
- suffixes[ARCHIVE] << QString::fromLatin1(t);
- fileIcons[ARCHIVE] = QIcon::fromTheme (QString::fromLatin1("package-x-generic"), fallback);
-
- const char * aud_types[] = {
- "aac", "ac3", "aiff", "ape", "au", "flac", "m3u", "m4a", "mid", "midi", "mp2",
- "mp3", "mpc", "nsf", "oga", "ogg", "ra", "ram", "shn", "voc", "wav", "wma" };
- for (const char * t: aud_types)
- suffixes[AUDIO] << QString::fromLatin1(t);
- fileIcons[AUDIO] = QIcon::fromTheme (QString::fromLatin1("audio-x-generic"), fallback);
-
- const char * exe_types[] = { "bat", "cmd", "com", "exe" };
- for (const char * t: exe_types)
- suffixes[APP] << QString::fromLatin1(t);
- fileIcons[APP] = QIcon::fromTheme (QString::fromLatin1("application-x-executable"), fallback);
- }
-
- QString suffix (QFileInfo (filename).suffix ().toLower ());
-
- for (int i=0; i<TYPE_COUNT; ++i)
- if (suffixes[i].contains (suffix))
- return fileIcons[i];
-
#endif
return fallback;
FilterBar.cc \
FilterBarComboBox.cc \
FilterBarComboBoxDelegate.cc \
- FilterBarLineEdit.cc \
Filters.cc \
Formatter.cc \
FreeSpaceLabel.cc \