New upstream release 0.7.0

* Added build dependency libqt5svg5-dev
* Bumped build dependency debhelper (>= 10)
* Bumped build dependency libqtxdg-dev (>= 2.0.0)
* Bumped build dependency libqtermwidget5-0-dev (>= 0.7.0)
* Bumped build dependency liblxqt-dev (>= 0.11.0)
* Bumped compat to 10
* Removed --parallel from rules, standard compat 10
debian/0.7.0-1
Alf Gaida 8 years ago
parent 49749ea8b5
commit 689fc10f3e

2
.gitignore vendored

@ -0,0 +1,2 @@
*.pro.user*
src/translations/qterminal

@ -0,0 +1,248 @@
qterminal-0.7.0 / 2016-09-24
============================
* Bump version to 0.7.0 (#262)
* Update README.md
* Collapse splitter hierarchies containing a single terminal (#254)
* Make qterminal.appdata.xml valid (#257)
* Add config option for changing window's title/icon
* Add support for automatic title & icon modification
* Delete Properties instance on exit (#239)
* Fix compilation warning related to QXmlStreamReader (#247)
* Set the desktopFileName property
* Fix typo in the conditional expression
* Add location for custom color schemes (#234)
* CMake Support changes (#237)
* Add keyboard cursor shape setting (#228)
* made the .pro file work on openSUSE; #229 (#232)
* Fix renaming a tab from the menu
* Make the rename current session shortcut work and configurable
* build: Use external translations
* ts-files removal (#222)
* Add pt_BR (Brazilian Portuguese) translation (#215)
* Merge pull request #214 from f2404/212_collapse_segfault_fix
* Remove noisy qDebug()
* Fix jumbled prompt
* Add Greek (el) translation
* Missing equal symbol for xml template
* Delete MainWindow on exit
* Link to the current github projects and trackers
* Apply context menu to the tab that it was opened over
* Close tabs in reverse order
* Eliminate memory leaks by closing tabs on exit
* Russian translation update
* Fix menubar transparency
* Fix default settings width
* Fix bookmarks widget transparency
* Use the same icon for dropdown and regular terminal
* Fix license file
* Improve README and use markdown
* Fixed button focus in close confirmation (resolves #179).
* Updated german translation.
* Fix Simplified Chinese(zh_CN)
* Update japanese translation
* Add Japanese translation to *.desktop
* fixed #174 XDG_CONFIG_DIRS support - read system wide QSettings
* Fix license issues within qterminal
* Add chinese translation
* Require Qt 5.2 or higher
* fix private header dependency for X11 global shortcuts
* fix searching for Qt5 private headers
* make only terminal widget transparent, not the parent window
* Fix japanese translation
* Russian translation update
* Add Japanese translation
* fixed #160 FTBFS as of commit 4967123
* Fixes for Portuguese language
* Fixes missing App Window icon
* Hungarian translation added
* Update qterminal_tr.ts
* Create qterminal_tr.ts
* do not overwrite settings in migrateSettings
* remove fullscreen patch
* migrateSettings add size and pos and rm geometry
* split geometry into size and position
* define saveGeomOnExit in properties.h
* add save geometry on exit
* Add Alt-<letter> shortcuts to all menu items.
* Make sure no settings are overwritten in migrateSettings().
* Update index property of tabs when tabs are moved by drag-and-drop.
* Update german translation.
* Corrected terminology in settings (transparency vs. opacity). Now transparency instead of opacity is used in the whole application consistently.
* Migrate AlwaysShowTabs-setting.
* Move migrateSettings()-method to Properties-class and call it *before* loadSettings().
* Update version number in settings.
* Renamed always show tabs setting.
* Portuguese update
* Add instructions to disable system qxt when building with Qt5.
* Changed position of font button in settings.
* Changed layout of font-setting to better fit to the other settings in the widget.
* Appdata file for QTerminal (resolves #60).
* Add view-menu actions to mainwindow, to make them available when menu bar is hidden.
* Add fullscreen mode.
* Ignore user-specific project files of QtCreator.
* Resolves #115: Store Actions of 'View'-menu in properties too and enable shorctus for them.
* Set shortcuts for 'Preferences...' and 'Quit' from settings on startup.
* Fixed #83: Add menu actions to main window.
* Fixed #93: Add 'Toggle Menu' and 'Preferences...' to context menu.
* Use GNUInstallDirs in CMakeLists.txt to stop hardcoding paths
* Make the left column expandable to get more space for translated text.
* Updated german translation
* Remove empty file
* Remove unnecessarily noisy qDebug calls
* Portuguese update
* Add Portuguese translation
* Update Russian translation
* slightly naive "layout/preset" implementation
* fixed build for Qt4 and Qt5.x < 5.2
* Rework settings window
* Fixed translation (added tr() for some combo boxes in properties dialog).
0.6.0 / 2014-10-21
==================
* Release 0.6.0
* Add an initial CONTRIBUTING document
* Update AUTHORS
* Update README
* Add an INSTALL file
* CMakeLists.txt cleanup
* Russian translation improvements.
* Updated translation.
* Desktop icon theme support Use icons from current desktop theme (Qt functionality) Reformat icons.qrc into theme format and fallback to the provided theme if no system theme present in main.cpp Add more action icons according to the XDG Icon Naming Specification
* fixed translation (some spelling, some inconsistencies, some bad wording) used other applications to determine common practice for some of the terms
* qctions refactored a bit; copy/paste etc. shortcuts work in subterminals finally
* fixed #80 Wronge state on startup
* fix translation of termwidget context menu
* add german translation
* fixed #65 Typo in QTerminal Properties window
* fixed #74 Zoom reset option resets font back to Monospace
* Check Ctrl manually on activateUrl signal
* Fix for #63
* Qt5 additional dependency and version number fix
* estonian translation
* Update termwidget.cpp
* Update termwidget.h
* Add Spanish translation
* Fixed install qterminal incon
* Simple profile support
0.5.0 / 2014-05-27
==================
* basic Qt5 port
* implemented #54 Add option to hide tab bar if only one tab is open
* set focus to current terminal after bookmark command applied
* Update Russian translation
* fixed #51 Shortcuts broken after menu hiding
* fixed #50 Bookmarks panel always shows, even if the bookmarks are disabled
* fixed #49 Only show monospace fonts in the font picker
* save bookmars widget visibility; fix crash in some config circumstances
* Include QApplication where needed. Fixes #47
* removed un-needed file
* changes required for new qtermwidget build/structure; includes fixed for qtermwidget Qt5 port
* bookmarks: key shortcut to open/close bookmarks widget
* bookmarks: saving/loading/editing
* initial support for extended bookmarks (read only for now)
* fixed #31 does not resize itself when screen resolution has changed
* implemented #41 Request: Ctrl+M Disable Menu Bar Option
* fix "save prefs on exit". Thanks Joseph A Philbrook for reporting and support ideas
* improvements for #28 Use system qxt-devel
* fixed #4 Open new tab in same working directory
* fixed #15 "Raw" -e params
* potential fix for height calculation regarding #31 does not resize itself when screen resolution has changed
* potential fix for screen size changed in drop down mode #31 does not resize itself when screen resolution has changed
* fixed #28 Use system qxt-devel
* fixed #37 Configuration AskOnExit should be editable via GUI
* Added Russian translation
* Clean up --help
* Don't forget highlight current terminal option
* fix #27 Ctrl+D on a new window closes all windows
* fix FSF address
* fixed #13 Window action names
* do not use conflicting shortcuts with vim/screen
* Added global tab rename (sessionRename) shortcut
* trivial shortcuts in a terminal-menu are a no-go because they ineterfere with several usual ncurses programs like nano, or weechat, even bash is interfered.
* allow only monospaced fonts in preferences dialog
* remove unused code in FindQTermWidget.cmake
* fixed main window ui file (manually edited probably) to work with designr again. Use "Preferences..." instead of "Configure QTerminal"
* compile also italian translations
* added italian translations
* get rid of contraproductive Ctrl-W to close a tab. Replaced that wieht Ctrl-Shift-W. Use nano in qterminal and try to search. You will see, what i mean ... * it takes a horizontal ruler to tile a terminal vertically and vice versa * make border of active terminal a litte bit thinner 3px -> 2px
* Added new action: "Paste Selection". Fixes #21
* Handle migration "Paste Selection"->"Paste Clipboard" in settings
* Rename PASTE_SELECTION to PASTE_CLIPBOARD which is what it does
* ctrl+n opens new window - reimplemented #19
* Added search functionality
* now with actual changes.
* fixed bad layout
* Reorganize menus (mostly fixes issue 8)
* Correction proposal for previous error
* Add zoom terminal. New option in PropertiesDialog
* return dropdown dsktop file because "desktop actions" are not supported almost anywhere
* Use standard utilities-terminal as default icon as a qterminal icon is not shipped
* Get rid of qterminal_drop.desktop, favouring a Desktop Action
* fixed #5 Tabs on top by default
* final fix for doubleclicks on tabwidget
* fixed #1 lost focus after close tab
* fix for lost custom tab labels when the tab is removed
* clear active terminal implemented
* wrong application domain fixed
* highlight current terminal is optional now
* fixed broken layouting from previous patches
* XDG standardized config place
* desktop files fixes
* install unix icon
* yakuake mode compile fix for X11
* build on mac
* Switch to Qxt global shortcut
* "make lupdate" implemented; do ot delete ts files on "make clean"; fix translator loading
* DropDown mode
* allow translations
* tabs to spaces
* allow moving of tabs
* Added History size properties
* desktop file for XDG
* fixed shortcut defaults as it used wrong int into strings
* reverted misunderstood spaces in keys - it's used in shorcut widget display
* remove ' ' from config keys as it makes config file unreadable
* LIB_SUFFIX autodiscovery
* Added missing translatable string. Shortcut tableview in preferences dialogue now resizes columns to fit contents Disabled verticalHeader on shorcut tableview. Added 'copy' and 'paste' to configurable shortcuts list. Removed '1.0' branding from windowTitle to read only 'QTerminal'.
* qmake pro file (easier to use in creator than cmake, figured i'd share.)
* Support for keyboard shortcuts; free-form text entry style.
* -e|--execute implemented; minor help fixes
* sync from experimental
* sync with experimental "bundle" repository
* standardized icons and keyboard shortcuts
* set minimal window size for initial resizing
* remove annoying "close session?" dialog
* all actions are available from mainwindow's menu
* mac icon fix
* bundle the qtermwidget's kb-layout files too
* initial support for apple bundles
* key shorcut unified for x11/mac
* actions cleanup
* fix for session closing
* fix for sub-terminals switching/focuses (to stay in current window/tab)
* small refactoring of methods duplicities
* transparency and open/save session shortcuts removed
* better highlight of the current subterminal (wide line)
* fixed focus handling again
* implementation of sub-terminal shitch key-shortcut
* highlight current subwindow (work in progress)
* set correct focus when (sub)terminal opens
* patches to build on BSD by Christopher VdoP
* correct closing on linux
* include fixes; editable gui
* split and collapse progress
* case sensitive includes
* sub-terminals splitting and collapsing
* allow to change emulation type
* docs;build fixes
* preferences are split into regular dialog
* termwidget split; properties separated
* actions texts standardized; all Qt styles supported in menu
* font handling fix for macosx
* macosx port; cmake support
* initial import

@ -4,7 +4,7 @@ project(qterminal)
include(GNUInstallDirs)
set(STR_VERSION "0.6.0")
set(STR_VERSION "0.7.0")
# additional cmake files

@ -1,29 +1,25 @@
# QTerminal
The lightweight Qt terminal emulator
## Overview
## Installation
QTerminal is a lightweight Qt terminal emulator based on [QTermWidget](https://github.com/lxde/qtermwidget).
### Requirements
It is maintained by the LXQt project but can be used independently from this desktop environment. The only bonds are [liblxqt](https://github.com/lxde/liblxqt) representing a build dependency and the localization files which were outsourced to LXQt repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n).
* Qt >= 5.2
* CMake >= 2.8
* [qtermwidget](https://github.com/lxde/qtermwidget)
This project is licensed under the terms of the [GPLv2](https://www.gnu.org/licenses/gpl-2.0.en.html) or any later version. See the LICENSE file for the full text of the license.
## Installation
### Building
### Compiling sources
A shadow build (out of source) is strongly recommended
http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees
Runtime dependencies are qtx11extras ≥ 5.2 and [QTermWidget](https://github.com/lxde/qtermwidget).
In order to build CMake ≥ 3.0.2 and [liblxqt](https://github.com/lxde/liblxqt) are needed as well as optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
1. `mkdir -p build && cd build`
2. `cmake <path/to/source>`
3. `make`
4. (to install) `make install`
Code configuration is handled by CMake. Building out of source is strongly recommended. CMake variable `CMAKE_INSTALL_PREFIX` will normally have to be set to `/usr`.
Read cmake docs to fine tune the build process (CMAKE_INSTALL_PREFIX, etc...)
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
## Translations
### Binary packages
* Edit `src/CMakeLists.txt` to add a new ts file.
* `make lupdate` updates ts files to be translated (lrelease is called automatically in make)
QTerminal is provided by all major Linux distributions like Arch Linux ([AUR](https://aur.archlinux.org) only so far), Debian (as of Debian stretch), Fedora and openSUSE (Tumbleweed only so far).
Just use the distributions' package managers to search for string `qterminal`.

13
debian/changelog vendored

@ -1,3 +1,16 @@
qterminal (0.7.0-1) experimental; urgency=medium
* New upstream release 0.7.0
* Added build dependency libqt5svg5-dev
* Bumped build dependency debhelper (>= 10)
* Bumped build dependency libqtxdg-dev (>= 2.0.0)
* Bumped build dependency libqtermwidget5-0-dev (>= 0.7.0)
* Bumped build dependency liblxqt-dev (>= 0.11.0)
* Bumped compat to 10
* Removed --parallel from rules, standard compat 10
-- Alf Gaida <agaida@siduction.org> Mon, 26 Sep 2016 01:22:06 +0200
qterminal (0.6.1~114-ga50f87c-1) experimental; urgency=medium
* Cherry-picking upstream version 0.6.1~114-ga50f87c.

11
debian/control vendored

@ -7,19 +7,18 @@ Section: x11
Priority: optional
Build-Depends: debhelper (>= 10),
cmake (>= 3.0.2),
gcc (>= 4:6),
g++ (>= 4:6),
libkf5windowsystem-dev,
liblxqt0-dev (>= 0.10.96~),
libqtermwidget5-0-dev (>= 0.6.1~),
liblxqt0-dev (>= 0.11.0),
libqtermwidget5-0-dev (>= 0.7.0),
libqt5svg5-dev,
libqt5x11extras5-dev,
libqt5xdg-dev (>= 1.3.1~),
libqt5xdg-dev (>= 2.0.0),
libx11-dev,
qtbase5-private-dev,
qttools5-dev,
qttools5-dev-tools
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/git/pkg-lxqt/qterminal.git/?h=debian/experimental
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/qterminal.git/?h=debian/experimental
Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/qterminal.git -b debian/experimental
Homepage: https://github.com/lxde/qterminal

8
debian/copyright vendored

@ -1,20 +1,20 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qterminal
Source: https://github.com/qterminal/qterminal.git
Source: https://github.com/lxde/qterminal/qterminal.git
Files: *
Copyright: 2010-2015 Petr Vanek <petr@scribus.info>
Copyright: 2010-2016 Petr Vanek <petr@scribus.info>
License: GPL-2+
Files: src/config.h
src/main.cpp
src/mainwindow.*
src/tabwidget.*
Copyright: Copyright (C) 2006 by Vladimir Kuznetsov <vovanec@gmail.com>
Copyright: 2006 Vladimir Kuznetsov <vovanec@gmail.com>
License: GPL-2+
Files: src/third-party/*
Copyright: Copyright (c) 2006 - 2011, the LibQxt project.
Copyright: 2006 - 2011 the LibQxt project.
License: BSD-3-clause
Files: debian/*

3
debian/rules vendored

@ -6,8 +6,7 @@ export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh ${@} --buildsystem cmake\
--parallel
dh ${@} --buildsystem cmake
override_dh_auto_configure:
dh_auto_configure --\

@ -6,8 +6,9 @@
<name>QTerminal</name>
<summary>A lightweight multiplatform terminal emulator.</summary>
<description>
</p>
<p>
QTerminal is a lightweight multiplatform terminal emulator.
</p>
<p>
Its main features are:
</p>

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>715</width>
<height>487</height>
<height>495</height>
</rect>
</property>
<property name="windowTitle">
@ -108,13 +108,16 @@
</property>
</widget>
</item>
<item row="12" column="0">
<item row="14" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Start with preset:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="tabsPos_comboBox"/>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="highlightCurrentCheckBox">
<property name="text">
@ -122,20 +125,17 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="4" column="1">
<widget class="QComboBox" name="scrollBarPos_comboBox"/>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Terminal transparency</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="tabsPos_comboBox"/>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="scrollBarPos_comboBox"/>
</item>
<item row="10" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Application transparency</string>
@ -145,7 +145,7 @@
</property>
</widget>
</item>
<item row="12" column="1">
<item row="14" column="1">
<widget class="QComboBox" name="terminalPresetComboBox">
<item>
<property name="text">
@ -169,7 +169,7 @@
</item>
</widget>
</item>
<item row="10" column="1">
<item row="12" column="1">
<widget class="QSpinBox" name="appTransparencyBox">
<property name="suffix">
<string> %</string>
@ -250,7 +250,10 @@
</property>
</widget>
</item>
<item row="11" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="styleComboBox"/>
</item>
<item row="13" column="1">
<widget class="QSpinBox" name="termTransparencyBox">
<property name="suffix">
<string> %</string>
@ -266,6 +269,9 @@
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="keybCursorShape_comboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
@ -273,10 +279,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="styleComboBox"/>
</item>
<item row="13" column="0" colspan="2">
<item row="15" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -289,9 +292,6 @@
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="keybCursorShape_comboBox"/>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="showMenuCheckBox">
<property name="text">
@ -306,6 +306,20 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="changeWindowTitleCheckBox">
<property name="text">
<string>Change window title based on current terminal</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<widget class="QCheckBox" name="changeWindowIconCheckBox">
<property name="text">
<string>Change window icon based on current terminal</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="historyPage">

@ -88,14 +88,12 @@ MainWindow::MainWindow(const QString& work_dir,
consoleTabulator->setTabPosition((QTabWidget::TabPosition)Properties::Instance()->tabsPos);
//consoleTabulator->setShellProgram(command);
setWindowTitle("QTerminal");
setWindowIcon(QIcon::fromTheme("utilities-terminal"));
setup_FileMenu_Actions();
setup_ActionsMenu_Actions();
setup_ViewMenu_Actions();
setupCustomDirs();
connect(consoleTabulator, &TabWidget::currentTitleChanged, this, &MainWindow::onCurrentTitleChanged);
/* The tab should be added after all changes are made to
the main window; otherwise, the initial prompt might
get jumbled because of changes in internal geometry. */
@ -638,6 +636,8 @@ void MainWindow::propertiesChanged()
qobject_cast<BookmarksWidget*>(m_bookmarksDock->widget())->setup();
}
onCurrentTitleChanged(consoleTabulator->currentIndex());
Properties::Instance()->saveSettings();
realign();
}
@ -740,3 +740,16 @@ void MainWindow::addNewTab()
else
consoleTabulator->addNewTab();
}
void MainWindow::onCurrentTitleChanged(int index)
{
QString title;
QIcon icon;
if (-1 != index)
{
title = consoleTabulator->tabText(index);
icon = consoleTabulator->tabIcon(index);
}
setWindowTitle(title.isEmpty() || !Properties::Instance()->changeWindowTitle ? QStringLiteral("QTerminal") : title);
setWindowIcon(icon.isNull() || !Properties::Instance()->changeWindowIcon ? QIcon::fromTheme("utilities-terminal") : icon);
}

@ -85,5 +85,6 @@ private slots:
void bookmarksDock_visibilityChanged(bool visible);
void addNewTab();
void onCurrentTitleChanged(int index);
};
#endif //MAINWINDOW_H

@ -137,6 +137,9 @@ void Properties::loadSettings()
dropWidht = m_settings->value("Width", 70).toInt();
dropHeight = m_settings->value("Height", 45).toInt();
m_settings->endGroup();
changeWindowTitle = m_settings->value("ChangeWindowTitle", true).toBool();
changeWindowIcon = m_settings->value("ChangeWindowIcon", true).toBool();
}
void Properties::saveSettings()
@ -209,6 +212,8 @@ void Properties::saveSettings()
m_settings->setValue("Height", dropHeight);
m_settings->endGroup();
m_settings->setValue("ChangeWindowTitle", changeWindowTitle);
m_settings->setValue("ChangeWindowIcon", changeWindowIcon);
}
void Properties::migrate_settings()

@ -91,6 +91,9 @@ class Properties
int dropWidht;
int dropHeight;
bool changeWindowTitle;
bool changeWindowIcon;
QMap< QString, QAction * > actions;

@ -125,6 +125,9 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
this, SLOT(bookmarksButton_clicked()));
terminalPresetComboBox->setCurrentIndex(Properties::Instance()->terminalsPreset);
changeWindowTitleCheckBox->setChecked(Properties::Instance()->changeWindowTitle);
changeWindowIconCheckBox->setChecked(Properties::Instance()->changeWindowIcon);
}
@ -188,6 +191,9 @@ void PropertiesDialog::apply()
Properties::Instance()->terminalsPreset = terminalPresetComboBox->currentIndex();
Properties::Instance()->changeWindowTitle = changeWindowTitleCheckBox->isChecked();
Properties::Instance()->changeWindowIcon = changeWindowIconCheckBox->isChecked();
emit propertiesChanged();
}

@ -28,6 +28,7 @@
#define TAB_INDEX_PROPERTY "tab_index"
#define TAB_CUSTOM_NAME_PROPERTY "custom_name"
TabWidget::TabWidget(QWidget* parent) : QTabWidget(parent), tabNumerator(0)
@ -78,10 +79,14 @@ int TabWidget::addNewTab(const QString & shell_program)
}
TermWidgetHolder *console = new TermWidgetHolder(cwd, shell_program, this);
console->setWindowTitle(label);
connect(console, SIGNAL(finished()), SLOT(removeFinished()));
connect(console, SIGNAL(lastTerminalClosed()), this, SLOT(removeFinished()));
connect(console, &TermWidgetHolder::termTitleChanged, this, &TabWidget::onTermTitleChanged);
connect(this, &QTabWidget::currentChanged, this, &TabWidget::currentTitleChanged);
int index = addTab(console, label);
console->setProperty(TAB_CUSTOM_NAME_PROPERTY, false);
updateTabIndices();
setCurrentIndex(index);
console->setInitialFocus();
@ -152,6 +157,21 @@ void TabWidget::updateTabIndices()
widget(i)->setProperty(TAB_INDEX_PROPERTY, i);
}
void TabWidget::onTermTitleChanged(QString title, QString icon)
{
TermWidgetHolder * console = qobject_cast<TermWidgetHolder*>(sender());
const bool custom_name = console->property(TAB_CUSTOM_NAME_PROPERTY).toBool();
if (!custom_name)
{
const int index = console->property(TAB_INDEX_PROPERTY).toInt();
setTabIcon(index, QIcon::fromTheme(icon));
setTabText(index, title);
if (currentIndex() == index)
emit currentTitleChanged(index);
}
}
void TabWidget::renameSession(int index)
{
bool ok = false;
@ -160,7 +180,11 @@ void TabWidget::renameSession(int index)
QString(), &ok);
if(ok && !text.isEmpty())
{
setTabIcon(index, QIcon{});
setTabText(index, text);
widget(index)->setProperty(TAB_CUSTOM_NAME_PROPERTY, true);
if (currentIndex() == index)
emit currentTitleChanged(index);
}
}

@ -82,6 +82,7 @@ public slots:
signals:
void closeTabNotification();
void tabRenameRequested(int);
void currentTitleChanged(int);
protected:
enum Direction{Left = 1, Right};
@ -95,6 +96,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *event);
protected slots:
void updateTabIndices();
void onTermTitleChanged(QString title, QString icon);
private:
int tabNumerator;

@ -189,6 +189,7 @@ TermWidget::TermWidget(const QString & wdir, const QString & shell, QWidget * pa
connect(m_term, SIGNAL(finished()), this, SIGNAL(finished()));
connect(m_term, SIGNAL(termGetFocus()), this, SLOT(term_termGetFocus()));
connect(m_term, SIGNAL(termLostFocus()), this, SLOT(term_termLostFocus()));
connect(m_term, &QTermWidget::titleChanged, this, [this] { emit termTitleChanged(m_term->title(), m_term->icon()); });
}
void TermWidget::propertiesChanged()

@ -74,6 +74,7 @@ class TermWidget : public QWidget
void splitVertical(TermWidget * self);
void splitCollapse(TermWidget * self);
void termGetFocus(TermWidget * self);
void termTitleChanged(QString titleText, QString icon);
public slots:

@ -200,23 +200,43 @@ void TermWidgetHolder::splitCollapse(TermWidget * term)
term->setParent(0);
delete term;
int cnt = parent->findChildren<TermWidget*>().count();
if (cnt == 0)
QWidget *nextFocus = Q_NULLPTR;
// Collapse splitters containing a single element, excluding the top one.
if (parent->count() == 1)
{
parent->setParent(0);
delete parent;
parent = Q_NULLPTR;
QSplitter *uselessSplitterParent = qobject_cast<QSplitter*>(parent->parent());
if (uselessSplitterParent != Q_NULLPTR) {
int idx = uselessSplitterParent->indexOf(parent);
assert(idx != -1);
QWidget *singleHeir = parent->widget(0);
uselessSplitterParent->insertWidget(idx, singleHeir);
if (qobject_cast<TermWidget*>(singleHeir))
{
nextFocus = singleHeir;
}
else
{
nextFocus = singleHeir->findChild<TermWidget*>();
}
parent->setParent(0);
delete parent;
// Make sure there's no access to the removed parent
parent = uselessSplitterParent;
}
}
QList<TermWidget*> tlist = findChildren<TermWidget *>();
int localCnt = tlist.count();
if (localCnt > 0)
if (parent->count() > 0)
{
tlist.at(0)->setFocus(Qt::OtherFocusReason);
update();
if (parent)
parent->update();
if (nextFocus)
{
nextFocus->setFocus(Qt::OtherFocusReason);
}
else
{
parent->widget(0)->setFocus(Qt::OtherFocusReason);
}
parent->update();
}
else
emit finished();
@ -281,13 +301,25 @@ TermWidget *TermWidgetHolder::newTerm(const QString & wdir, const QString & shel
this, SLOT(splitCollapse(TermWidget *)));
connect(w, SIGNAL(termGetFocus(TermWidget *)),
this, SLOT(setCurrentTerminal(TermWidget *)));
connect(w, &TermWidget::termTitleChanged, this, &TermWidgetHolder::onTermTitleChanged);
return w;
}
void TermWidgetHolder::setCurrentTerminal(TermWidget* term)
{
TermWidget * old_current = m_currentTerm;
m_currentTerm = term;
if (old_current != m_currentTerm)
{
if (m_currentTerm->impl()->isTitleChanged())
{
emit termTitleChanged(m_currentTerm->impl()->title(), m_currentTerm->impl()->icon());
} else
{
emit termTitleChanged(windowTitle(), QString{});
}
}
}
void TermWidgetHolder::handle_finished()
@ -300,3 +332,10 @@ void TermWidgetHolder::handle_finished()
}
splitCollapse(w);
}
void TermWidgetHolder::onTermTitleChanged(QString title, QString icon) const
{
TermWidget * term = qobject_cast<TermWidget *>(sender());
if (m_currentTerm == term)
emit termTitleChanged(title, icon);
}

@ -59,11 +59,13 @@ class TermWidgetHolder : public QWidget
void switchNextSubterminal();
void switchPrevSubterminal();
void clearActiveTerminal();
void onTermTitleChanged(QString title, QString icon) const;
signals:
void finished();
void lastTerminalClosed();
void renameSession();
void termTitleChanged(QString title, QString icon) const;
private:
QString m_wdir;

Loading…
Cancel
Save