mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
Add new TrPathButton class (Qt client)
Make use of new button class in torrent options dialog. Rework Utils::removeTrailingDirSeparator to return correct value for "/".
This commit is contained in:
56
qt/path-button.h
Normal file
56
qt/path-button.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file Copyright (C) 2014 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_PATH_BUTTON_H
|
||||
#define QTR_PATH_BUTTON_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
class TrPathButton: public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode
|
||||
{
|
||||
DirectoryMode,
|
||||
FileMode
|
||||
};
|
||||
|
||||
public:
|
||||
TrPathButton (QWidget * parent = nullptr);
|
||||
|
||||
void setMode (Mode mode);
|
||||
void setTitle (const QString& title);
|
||||
void setNameFilter (const QString& nameFilter);
|
||||
|
||||
void setPath (const QString& path);
|
||||
const QString& path () const;
|
||||
|
||||
signals:
|
||||
void pathChanged (const QString& path);
|
||||
|
||||
private slots:
|
||||
void onClicked ();
|
||||
void onFileSelected (const QString& path);
|
||||
|
||||
private:
|
||||
void updateAppearance ();
|
||||
|
||||
bool isDirMode () const;
|
||||
QString effectiveTitle () const;
|
||||
|
||||
private:
|
||||
Mode myMode;
|
||||
QString myTitle;
|
||||
QString myNameFilter;
|
||||
QString myPath;
|
||||
};
|
||||
|
||||
#endif // QTR_PATH_BUTTON_H
|
||||
Reference in New Issue
Block a user