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:
Mike Gelfand
2014-12-31 21:00:34 +00:00
parent c64ca900c2
commit e0d5f8b861
18 changed files with 729 additions and 409 deletions

56
qt/path-button.h Normal file
View 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