mirror of
https://github.com/transmission/transmission
synced 2025-02-22 22:20:39 +00:00
Simplify DND checkboxes drawing, this also fixes incorrect drawing on Mac when file tree widget is inactive. Do better job calculating column widths for file tree to avoid ellipsis. Fix file tree sorting order for size and priority columns. Change key to toggle priorities to Shift+Space instead of Enter/Return to avoid conflicts with name editing and default button handling. Fix selected tracker item background drawing in certain cases.
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
/*
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
|
*
|
|
* It may be used under the GNU GPL versions 2 or 3
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
*
|
|
* $Id$
|
|
*/
|
|
|
|
#ifndef QTR_FILE_TREE_VIEW_H
|
|
#define QTR_FILE_TREE_VIEW_H
|
|
|
|
#include <QSet>
|
|
#include <QTreeView>
|
|
|
|
#include "Torrent.h" // FileList
|
|
|
|
class QSortFilterProxyModel;
|
|
|
|
class FileTreeDelegate;
|
|
class FileTreeModel;
|
|
|
|
class FileTreeView: public QTreeView
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
FileTreeView (QWidget * parent = nullptr, bool editable = true);
|
|
|
|
void clear ();
|
|
void update (const FileList& files, bool updateProperties = true);
|
|
|
|
void setEditable (bool editable);
|
|
|
|
public slots:
|
|
void onClicked (const QModelIndex& index);
|
|
void onDoubleClicked (const QModelIndex& index);
|
|
void onOpenRequested (const QString& path);
|
|
|
|
signals:
|
|
void priorityChanged (const QSet<int>& fileIndices, int priority);
|
|
void wantedChanged (const QSet<int>& fileIndices, bool wanted);
|
|
void pathEdited (const QString& oldpath, const QString& newname);
|
|
void openRequested (const QString& path);
|
|
|
|
protected:
|
|
// QWidget
|
|
virtual void resizeEvent (QResizeEvent * event);
|
|
virtual void keyPressEvent (QKeyEvent * event);
|
|
|
|
private:
|
|
FileTreeModel * myModel;
|
|
QSortFilterProxyModel * myProxy;
|
|
FileTreeDelegate * myDelegate;
|
|
};
|
|
|
|
#endif // QTR_FILE_TREE_VIEW_H
|