Changeset View
Changeset View
Standalone View
Standalone View
src/panels/terminal/terminalpanel.h
Show All 39 Lines | |||||
40 | * @brief Shows the terminal which is synchronized with the URL of the | 40 | * @brief Shows the terminal which is synchronized with the URL of the | ||
41 | * active view. | 41 | * active view. | ||
42 | */ | 42 | */ | ||
43 | class TerminalPanel : public Panel | 43 | class TerminalPanel : public Panel | ||
44 | { | 44 | { | ||
45 | Q_OBJECT | 45 | Q_OBJECT | ||
46 | 46 | | |||
47 | public: | 47 | public: | ||
48 | TerminalPanel(QWidget* parent = 0); | 48 | TerminalPanel(QWidget* parent = 0); | ||
elvisangelaccio: Why `public`? This is only used in a private method.
Also, we are using `enum class` for new… | |||||
49 | virtual ~TerminalPanel(); | 49 | virtual ~TerminalPanel(); | ||
I'd use AddToHistory and SkipHistory. elvisangelaccio: I'd use `AddToHistory` and `SkipHistory`.
Not sure about the name of the enum itself, maybe… | |||||
Thanks for the review, I agree and I have updated the requested changes. martonmiklos: Thanks for the review, I agree and I have updated the requested changes. | |||||
50 | 50 | | |||
51 | /** | ||||
52 | * @brief This function is used to set the terminal panels's cwd to | ||||
53 | * home when an unmounting request is receieved. | ||||
54 | */ | ||||
55 | void goHome(); | ||||
56 | QString currentWorkingDirectory(); | ||||
57 | | ||||
51 | public slots: | 58 | public slots: | ||
52 | void terminalExited(); | 59 | void terminalExited(); | ||
53 | void dockVisibilityChanged(); | 60 | void dockVisibilityChanged(); | ||
54 | 61 | | |||
55 | signals: | 62 | signals: | ||
56 | void hideTerminalPanel(); | 63 | void hideTerminalPanel(); | ||
57 | 64 | | |||
58 | /** | 65 | /** | ||
59 | * Is emitted if the an URL change is requested. | 66 | * Is emitted if the an URL change is requested. | ||
60 | */ | 67 | */ | ||
61 | void changeUrl(const QUrl& url); | 68 | void changeUrl(const QUrl& url); | ||
62 | 69 | | |||
63 | protected: | 70 | protected: | ||
64 | virtual bool urlChanged() Q_DECL_OVERRIDE; | 71 | virtual bool urlChanged() Q_DECL_OVERRIDE; | ||
65 | 72 | | |||
66 | virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE; | 73 | virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE; | ||
67 | 74 | | |||
68 | private slots: | 75 | private slots: | ||
69 | void slotMostLocalUrlResult(KJob* job); | 76 | void slotMostLocalUrlResult(KJob* job); | ||
70 | void slotKonsolePartCurrentDirectoryChanged(const QString& dir); | 77 | void slotKonsolePartCurrentDirectoryChanged(const QString& dir); | ||
boolean arguments are a bad practice (bad readability of code), please use an enum instead. elvisangelaccio: boolean arguments are a bad practice (bad readability of code), please use an enum instead. | |||||
71 | 78 | | |||
72 | private: | 79 | private: | ||
80 | enum class HistoryPolicy { | ||||
81 | AddToHistory, | ||||
82 | SkipHistory | ||||
83 | }; | ||||
84 | | ||||
73 | void changeDir(const QUrl& url); | 85 | void changeDir(const QUrl& url); | ||
74 | void sendCdToTerminal(const QString& path); | 86 | void sendCdToTerminal(const QString& path, HistoryPolicy addToHistory = HistoryPolicy::AddToHistory); | ||
75 | 87 | | |||
76 | private: | 88 | private: | ||
77 | bool m_clearTerminal; | 89 | bool m_clearTerminal; | ||
78 | KIO::StatJob* m_mostLocalUrlJob; | 90 | KIO::StatJob* m_mostLocalUrlJob; | ||
79 | 91 | | |||
80 | QVBoxLayout* m_layout; | 92 | QVBoxLayout* m_layout; | ||
81 | TerminalInterface* m_terminal; | 93 | TerminalInterface* m_terminal; | ||
82 | QWidget* m_terminalWidget; | 94 | QWidget* m_terminalWidget; | ||
83 | KParts::ReadOnlyPart* m_konsolePart; | 95 | KParts::ReadOnlyPart* m_konsolePart; | ||
84 | QString m_konsolePartCurrentDirectory; | 96 | QString m_konsolePartCurrentDirectory; | ||
85 | QQueue<QString> m_sendCdToTerminalHistory; | 97 | QQueue<QString> m_sendCdToTerminalHistory; | ||
86 | }; | 98 | }; | ||
87 | 99 | | |||
88 | #endif // TERMINALPANEL_H | 100 | #endif // TERMINALPANEL_H |
Why public? This is only used in a private method.
Also, we are using enum class for new enums, so we should do it also here for consistency.