Miam-Player  0.8.0
A nice music player
addressbar.h
Go to the documentation of this file.
1 #ifndef ADDRESSBAR_H
2 #define ADDRESSBAR_H
3 
4 #include <QDir>
5 #include <QHBoxLayout>
6 #include <QMenu>
7 #include <QWidget>
8 
9 #include "addressbarbutton.h"
10 #include "addressbarlineedit.h"
11 #include "addressbarmenu.h"
12 
13 #include <QStack>
14 
16 
26 class MIAMTABPLAYLISTS_LIBRARY AddressBar : public QWidget
27 {
28  Q_OBJECT
29 private:
30  QHBoxLayout *_hBoxLayout;
31  AddressBarMenu *_menu;
32  QStack<QDir> _hiddenFolders;
33  AddressBarButton *_lastHighlightedButton;
34  AddressBarLineEdit *_lineEdit;
35  bool _isDown;
36  QDir _currentDir;
37 
38 public:
39  explicit AddressBar(QWidget *parent = nullptr);
40 
41  static QString getVolumeInfo(const QString &drive);
42 
44  void findAndHighlightButton(const QPoint &p);
45 
46  inline QDir currentDir() const { return _currentDir; }
47 
48  inline bool isDown() const { return _isDown; }
49  inline void setDown(bool down) { _isDown = down; }
50 
51  inline bool hasHiddenFolders() const { return !_hiddenFolders.isEmpty(); }
52 
53 protected:
54  virtual void mousePressEvent(QMouseEvent *) override;
55 
56  virtual void paintEvent(QPaintEvent *) override;
57 
58  virtual void resizeEvent(QResizeEvent *event) override;
59 
60 private:
62  void clear();
63 
65  void createRoot();
66 
68  int createSubDirButtons(const QDir &path);
69 
70 public slots:
72  void init(const QDir &initDir);
73 
74 private slots:
75  void feedLineEdit();
76 
78  void showDrivesAndPreviousFolders();
79 
81  void showSubDirMenu(AddressBarButton *button);
82 
83 signals:
84  void aboutToChangePath(const QDir &);
85 };
86 
87 #endif // ADDRESSBAR_H
bool hasHiddenFolders() const
Definition: addressbar.h:51
void setDown(bool down)
Definition: addressbar.h:49
QDir currentDir() const
Definition: addressbar.h:46
The AddressBar class is the place where subfolders (instance of AddressBarButton) will be appended...
Definition: addressbar.h:26
The AddressBarLineEdit class.
Definition: addressbarlineedit.h:18
bool isDown() const
Definition: addressbar.h:48
The AddressBarButton class represents a part of a long path.
Definition: addressbarbutton.h:18
#define MIAMTABPLAYLISTS_LIBRARY
Definition: miamtabplaylists_global.hpp:8
The AddressBarMenu class is like a popup menu which displays subdirectories.
Definition: addressbarmenu.h:22