mirror of
https://github.com/transmission/transmission
synced 2024-12-31 20:16:57 +00:00
c62cb35fd4
* faster updating of trackers combobox. * generate trackerDisplayNames just once per torrent * refactor: cache torrent delegate's warning emblem * refactor: change mainwin refresh debounce to 200ms * refactor: do not store trackers, hosts in QVariant * refactor: don't use `virtual` when it's not needed * refactor: faster counting torrents-matching-filter * refactor: faster tracker handling in filterbar * refactor: improve json parser's prealloc heuristic * refactor: make Torrent::hasError() faster * refactor: remove redundant speed stats collection * refactor: remove unnecessary tor->isQueued() calls * refactor: use unordered containers where possible * scale favicons only once, when adding to the cache
59 lines
1 KiB
C++
59 lines
1 KiB
C++
/*
|
|
* This file Copyright (C) 2014-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 <QToolButton>
|
|
|
|
class PathButton : public QToolButton
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum Mode
|
|
{
|
|
DirectoryMode,
|
|
FileMode
|
|
};
|
|
|
|
public:
|
|
PathButton(QWidget* parent = nullptr);
|
|
|
|
void setMode(Mode mode);
|
|
void setTitle(QString const& title);
|
|
void setNameFilter(QString const& nameFilter);
|
|
|
|
void setPath(QString const& path);
|
|
QString const& path() const;
|
|
|
|
// QWidget
|
|
QSize sizeHint() const override;
|
|
|
|
signals:
|
|
void pathChanged(QString const& path);
|
|
|
|
protected:
|
|
// QWidget
|
|
void paintEvent(QPaintEvent* event) override;
|
|
|
|
private:
|
|
void updateAppearance();
|
|
|
|
bool isDirMode() const;
|
|
QString effectiveTitle() const;
|
|
|
|
private slots:
|
|
void onClicked();
|
|
void onFileSelected(QString const& path);
|
|
|
|
private:
|
|
Mode myMode;
|
|
QString myTitle;
|
|
QString myNameFilter;
|
|
QString myPath;
|
|
};
|