2015-08-16 00:43:27 +08:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Vladimir Kuznetsov *
|
|
|
|
* vovanec@gmail.com *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
2015-09-06 13:44:10 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2015-08-16 00:43:27 +08:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef TAB_WIDGET
|
|
|
|
#define TAB_WIDGET
|
|
|
|
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
#include "properties.h"
|
|
|
|
|
|
|
|
class TermWidgetHolder;
|
|
|
|
class QAction;
|
|
|
|
class QActionGroup;
|
|
|
|
|
|
|
|
|
|
|
|
class TabWidget : public QTabWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
TabWidget(QWidget* parent = 0);
|
|
|
|
|
|
|
|
TermWidgetHolder * terminalHolder();
|
|
|
|
|
|
|
|
void showHideTabBar();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
int addNewTab(const QString& shell_program = QString());
|
|
|
|
void removeTab(int);
|
|
|
|
void removeCurrentTab();
|
|
|
|
int switchToRight();
|
|
|
|
int switchToLeft();
|
|
|
|
void removeFinished();
|
|
|
|
void moveLeft();
|
|
|
|
void moveRight();
|
2015-12-27 17:57:16 +01:00
|
|
|
void renameSession(int);
|
2016-10-18 20:59:44 +02:00
|
|
|
void renameCurrentSession();
|
2015-08-16 00:43:27 +08:00
|
|
|
void setWorkDirectory(const QString&);
|
|
|
|
|
|
|
|
void switchNextSubterminal();
|
|
|
|
void switchPrevSubterminal();
|
|
|
|
void splitHorizontally();
|
|
|
|
void splitVertically();
|
|
|
|
void splitCollapse();
|
|
|
|
|
|
|
|
void copySelection();
|
|
|
|
void pasteClipboard();
|
|
|
|
void pasteSelection();
|
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
void zoomReset();
|
|
|
|
|
|
|
|
void changeTabPosition(QAction *);
|
|
|
|
void changeScrollPosition(QAction *);
|
2016-10-18 20:59:44 +02:00
|
|
|
void changeKeyboardCursorShape(QAction *);
|
2015-08-16 00:43:27 +08:00
|
|
|
void propertiesChanged();
|
|
|
|
|
|
|
|
void clearActiveTerminal();
|
|
|
|
|
|
|
|
void saveSession();
|
|
|
|
void loadSession();
|
|
|
|
|
2015-09-06 13:44:10 +02:00
|
|
|
void preset2Horizontal();
|
|
|
|
void preset2Vertical();
|
|
|
|
void preset4Terminals();
|
|
|
|
|
2015-08-16 00:43:27 +08:00
|
|
|
signals:
|
|
|
|
void closeTabNotification();
|
2015-12-27 17:57:16 +01:00
|
|
|
void tabRenameRequested(int);
|
2016-10-18 20:59:44 +02:00
|
|
|
void currentTitleChanged(int);
|
2015-08-16 00:43:27 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
enum Direction{Left = 1, Right};
|
|
|
|
void contextMenuEvent(QContextMenuEvent * event);
|
|
|
|
void move(Direction);
|
|
|
|
/*! Event filter for TabWidget's QTabBar. It's installed on tabBar()
|
|
|
|
in the constructor.
|
|
|
|
It's purpose is to handle doubleclicks on QTabBar for session
|
|
|
|
renaming or new tab opening
|
|
|
|
*/
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
2015-09-06 13:44:10 +02:00
|
|
|
protected slots:
|
|
|
|
void updateTabIndices();
|
2016-10-18 20:59:44 +02:00
|
|
|
void onTermTitleChanged(QString title, QString icon);
|
2015-08-16 00:43:27 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
int tabNumerator;
|
|
|
|
QString work_dir;
|
|
|
|
/* re-order naming of the tabs then removeCurrentTab() */
|
|
|
|
void renameTabsAfterRemove();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|