Hello community, here is the log from the commit of package qterminal for openSUSE:Factory checked in at 2017-03-13 15:32:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qterminal (Old) and /work/SRC/openSUSE:Factory/.qterminal.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qterminal" Mon Mar 13 15:32:51 2017 rev:4 rq:460525 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/qterminal/qterminal.changes 2016-10-06 12:44:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.qterminal.new/qterminal.changes 2017-03-13 15:33:41.536506027 +0100 @@ -1,0 +2,18 @@ +Sun Feb 26 05:32:26 UTC 2017 - sfal...@opensuse.org + +- Update to 0.7.1: + * Bump patch version (#294) + * Add common shortcuts for switching tabs (#275) + * Fix tabstop order in properties dialog & add buddy relations for labels. (#290) + * Add preferences for background images (#273) + * Disable menu actions that are not applicable currently (#244) + * DEFINES += STR_VERSION=\\\"0.7.0\\\" + * Add context menu actions for URLs and E-Mail addresses (#276) + * Removed minimum size (#265) + * Set maxval of dropdown spinboxen to 100, instead of 99 + * Use the new lxqt-build-tools package + * Fix context menu actions being applied to the window opened last (#235) + * Show exit confirmation dialog when closing the last window tab (#242) + * remove "building with cpack" from CMakeLists.txt - not used anymore Added very basic .gitattributes + +------------------------------------------------------------------- Old: ---- qterminal-0.7.0.tar.xz qterminal-0.7.0.tar.xz.asc New: ---- qterminal-0.7.1.tar.xz qterminal-0.7.1.tar.xz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qterminal.spec ++++++ --- /var/tmp/diff_new_pack.c7GDgR/_old 2017-03-13 15:33:42.048433680 +0100 +++ /var/tmp/diff_new_pack.c7GDgR/_new 2017-03-13 15:33:42.052433115 +0100 @@ -1,7 +1,7 @@ # # spec file for package qterminal # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,18 +17,19 @@ Name: qterminal -Version: 0.7.0 +Version: 0.7.1 Release: 0 Summary: A Qt-based terminal emulator License: GPL-2.0 Group: System/X11/Terminals -Url: http://lxqt.org -Source0: https://downloads.lxqt.org/%{name}/%{version}/%{name}-%{version}.tar.xz -Source1: https://downloads.lxqt.org/%{name}/%{version}/%{name}-%{version}.tar.xz.asc +Url: https://github.com/lxde/qterminal +Source0: https://github.com/lxde/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz +Source1: https://github.com/lxde/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc Source2: %{name}.keyring BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libQt5Gui-private-headers-devel +BuildRequires: lxqt-build-tools-devel BuildRequires: pkgconfig BuildRequires: qtermwidget-qt5-devel >= %{version} BuildRequires: cmake(KF5WindowSystem) ++++++ qterminal-0.7.0.tar.xz -> qterminal-0.7.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/.gitignore new/qterminal-0.7.1/.gitignore --- old/qterminal-0.7.0/.gitignore 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -*.pro.user* -src/translations/qterminal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/CHANGELOG new/qterminal-0.7.1/CHANGELOG --- old/qterminal-0.7.0/CHANGELOG 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/CHANGELOG 2016-12-21 18:51:40.000000000 +0100 @@ -1,7 +1,25 @@ -qterminal-0.7.0 / 2016-09-24 +qterminal-0.7.1 / 2016-12-21 ============================ + * Bump patch version (#294) + * Add common shortcuts for switching tabs (#275) + * Fix tabstop order in properties dialog & add buddy relations for labels. (#290) + * Add preferences for background images (#273) + * Disable menu actions that are not applicable currently (#244) + * DEFINES += STR_VERSION=\\\"0.7.0\\\" + * Add context menu actions for URLs and E-Mail addresses (#276) + * Removed minimum size (#265) + * Set maxval of dropdown spinboxen to 100, instead of 99 + * Use the new lxqt-build-tools package + * Fix context menu actions being applied to the window opened last (#235) + * Show exit confirmation dialog when closing the last window tab (#242) + * remove "building with cpack" from CMakeLists.txt - not used anymore Added very basic .gitattributes + +0.7.0 / 2016-09-24 +================== + + * Release 0.7.0: Add changelog * Bump version to 0.7.0 (#262) * Update README.md * Collapse splitter hierarchies containing a single terminal (#254) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/CMakeLists.txt new/qterminal-0.7.1/CMakeLists.txt --- old/qterminal-0.7.0/CMakeLists.txt 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/CMakeLists.txt 2016-12-21 18:51:40.000000000 +0100 @@ -4,7 +4,8 @@ include(GNUInstallDirs) -set(STR_VERSION "0.7.0") +set(STR_VERSION "0.7.1") +set(LXQTBT_MINIMUM_VERSION "0.3.0") # additional cmake files @@ -35,8 +36,7 @@ find_package(Qt5X11Extras REQUIRED) endif() find_package(QTermWidget5 REQUIRED) -#Note: no run-time dependency on liblxqt, just a build dependency for lxqt_translate_ts/desktop -find_package(lxqt REQUIRED) +find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED) include(LXQtTranslateTs) message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}") @@ -235,14 +235,3 @@ COMMAND ${QT_LUPDATE_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/qterminal.pro" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) - -# make dist custom target -set(CPACK_PACKAGE_NAME "qterminal") -set(CPACK_PACKAGE_VERSION ${STR_VERSION}) -set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") -set(CPACK_IGNORE_FILES "/CVS/;/\\\\.svn/;/\\\\.git/;\\\\.swp$;\\\\.#;/#;\\\\.tar.gz$;/CMakeFiles/;CMakeCache.txt;\\\\.qm$;/build/;\\\\.diff$;.DS_Store'") -set(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES}) -include(CPack) -# simulate autotools' "make dist" -add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/qterminal.pro new/qterminal-0.7.1/qterminal.pro --- old/qterminal-0.7.0/qterminal.pro 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/qterminal.pro 2016-12-21 18:51:40.000000000 +0100 @@ -8,7 +8,7 @@ PKGCONFIG += qtermwidget5 -DEFINES += STR_VERSION=\\\"0.6.0\\\" +DEFINES += STR_VERSION=\\\"0.7.0\\\" SOURCES += $$files(src/*.cpp) HEADERS += $$files(src/*.h) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/config.h new/qterminal-0.7.1/src/config.h --- old/qterminal-0.7.0/src/config.h 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/config.h 2016-12-21 18:51:40.000000000 +0100 @@ -69,8 +69,8 @@ // ACTIONS #define CLEAR_TERMINAL_SHORTCUT "Ctrl+Shift+X" -#define TAB_PREV_SHORTCUT "Shift+Left" -#define TAB_NEXT_SHORTCUT "Shift+Right" +#define TAB_PREV_SHORTCUT "Shift+Left|Ctrl+PgUp|Ctrl+Shift+Tab" +#define TAB_NEXT_SHORTCUT "Shift+Right|Ctrl+PgDown|Ctrl+Tab" #define SUB_PREV_SHORTCUT "Shift+Down" #define SUB_NEXT_SHORTCUT "Shift+Up" @@ -100,8 +100,8 @@ #define ZOOM_OUT_SHORTCUT "Ctrl+-" #define ZOOM_RESET_SHORTCUT "Ctrl+0" -#define MOVE_LEFT_SHORTCUT "Shift+Alt+Left" -#define MOVE_RIGHT_SHORTCUT "Shift+Alt+Right" +#define MOVE_LEFT_SHORTCUT "Shift+Alt+Left|Ctrl+Shift+PgUp" +#define MOVE_RIGHT_SHORTCUT "Shift+Alt+Right|Ctrl+Shift+PgDown" #define RENAME_SESSION_SHORTCUT "Shift+Alt+S" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/forms/propertiesdialog.ui new/qterminal-0.7.1/src/forms/propertiesdialog.ui --- old/qterminal-0.7.0/src/forms/propertiesdialog.ui 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/forms/propertiesdialog.ui 2016-12-21 18:51:40.000000000 +0100 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>715</width> - <height>495</height> + <width>746</width> + <height>634</height> </rect> </property> <property name="windowTitle"> @@ -82,7 +82,7 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="lookAndFeelPage"> + <widget class="QWidget" name="appearancePage"> <layout class="QGridLayout" name="gridLayout_3"> <item row="8" column="0"> <widget class="QCheckBox" name="hideTabBarCheckBox"> @@ -99,6 +99,9 @@ <property name="text"> <string>Color scheme</string> </property> + <property name="buddy"> + <cstring>colorSchemaCombo</cstring> + </property> </widget> </item> <item row="4" column="0"> @@ -106,15 +109,24 @@ <property name="text"> <string>Scrollbar position</string> </property> + <property name="buddy"> + <cstring>scrollBarPos_comboBox</cstring> + </property> </widget> </item> - <item row="14" column="0"> + <item row="16" column="0"> <widget class="QLabel" name="label_9"> <property name="text"> <string>Start with preset:</string> </property> + <property name="buddy"> + <cstring>terminalPresetComboBox</cstring> + </property> </widget> </item> + <item row="4" column="1"> + <widget class="QComboBox" name="scrollBarPos_comboBox"/> + </item> <item row="5" column="1"> <widget class="QComboBox" name="tabsPos_comboBox"/> </item> @@ -125,14 +137,14 @@ </property> </widget> </item> - <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> + <property name="buddy"> + <cstring>termTransparencyBox</cstring> + </property> </widget> </item> <item row="12" column="0"> @@ -145,7 +157,7 @@ </property> </widget> </item> - <item row="14" column="1"> + <item row="16" column="1"> <widget class="QComboBox" name="terminalPresetComboBox"> <item> <property name="text"> @@ -205,6 +217,9 @@ <property name="text"> <string>Font</string> </property> + <property name="buddy"> + <cstring>changeFontButton</cstring> + </property> </widget> </item> <item> @@ -243,15 +258,21 @@ </layout> </widget> </item> + <item row="3" column="1"> + <widget class="QComboBox" name="styleComboBox"/> + </item> <item row="5" column="0"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Tabs position</string> </property> + <property name="buddy"> + <cstring>tabsPos_comboBox</cstring> + </property> </widget> </item> - <item row="3" column="1"> - <widget class="QComboBox" name="styleComboBox"/> + <item row="6" column="1"> + <widget class="QComboBox" name="keybCursorShape_comboBox"/> </item> <item row="13" column="1"> <widget class="QSpinBox" name="termTransparencyBox"> @@ -269,17 +290,17 @@ </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"> <string>Widget style</string> </property> + <property name="buddy"> + <cstring>styleComboBox</cstring> + </property> </widget> </item> - <item row="15" column="0" colspan="2"> + <item row="17" column="0" colspan="2"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -304,6 +325,9 @@ <property name="text"> <string>Keyboard cursor shape</string> </property> + <property name="buddy"> + <cstring>keybCursorShape_comboBox</cstring> + </property> </widget> </item> <item row="10" column="0" colspan="2"> @@ -320,9 +344,30 @@ </property> </widget> </item> + <item row="15" column="0"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Background image:</string> + </property> + </widget> + </item> + <item row="15" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLineEdit" name="backgroundImageLineEdit"/> + </item> + <item> + <widget class="QPushButton" name="chooseBackgroundImageButton"> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> - <widget class="QWidget" name="historyPage"> + <widget class="QWidget" name="behaviorPage"> <layout class="QGridLayout" name="gridLayout_5"> <item row="2" column="0"> <spacer name="verticalSpacer_2"> @@ -373,6 +418,9 @@ <property name="text"> <string>Action after paste</string> </property> + <property name="buddy"> + <cstring>motionAfterPasting_comboBox</cstring> + </property> </widget> </item> <item row="0" column="2"> @@ -470,6 +518,9 @@ <attribute name="horizontalHeaderDefaultSectionSize"> <number>105</number> </attribute> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> <attribute name="verticalHeaderVisible"> <bool>false</bool> </attribute> @@ -487,7 +538,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page"> + <widget class="QWidget" name="dropdownPage"> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QCheckBox" name="dropShowOnStartCheckBox"> @@ -512,6 +563,9 @@ <property name="text"> <string>Height</string> </property> + <property name="buddy"> + <cstring>dropHeightSpinBox</cstring> + </property> </widget> </item> <item row="0" column="1"> @@ -526,6 +580,9 @@ <property name="text"> <string>Width</string> </property> + <property name="buddy"> + <cstring>dropWidthSpinBox</cstring> + </property> </widget> </item> <item row="1" column="1"> @@ -547,6 +604,9 @@ <property name="text"> <string>Shortcut:</string> </property> + <property name="buddy"> + <cstring>dropShortCutEdit</cstring> + </property> </widget> </item> <item row="0" column="1"> @@ -569,7 +629,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_2"> + <widget class="QWidget" name="bookmarksPage"> <layout class="QGridLayout" name="gridLayout_9"> <item row="3" column="0"> <widget class="QGroupBox" name="groupBox_5"> @@ -607,6 +667,9 @@ <property name="text"> <string>Bookmark file</string> </property> + <property name="buddy"> + <cstring>bookmarksLineEdit</cstring> + </property> </widget> </item> <item> @@ -637,6 +700,43 @@ </item> </layout> </widget> + <tabstops> + <tabstop>listWidget</tabstop> + <tabstop>changeFontButton</tabstop> + <tabstop>colorSchemaCombo</tabstop> + <tabstop>styleComboBox</tabstop> + <tabstop>scrollBarPos_comboBox</tabstop> + <tabstop>tabsPos_comboBox</tabstop> + <tabstop>keybCursorShape_comboBox</tabstop> + <tabstop>showMenuCheckBox</tabstop> + <tabstop>hideTabBarCheckBox</tabstop> + <tabstop>highlightCurrentCheckBox</tabstop> + <tabstop>changeWindowTitleCheckBox</tabstop> + <tabstop>changeWindowIconCheckBox</tabstop> + <tabstop>appTransparencyBox</tabstop> + <tabstop>termTransparencyBox</tabstop> + <tabstop>backgroundImageLineEdit</tabstop> + <tabstop>chooseBackgroundImageButton</tabstop> + <tabstop>terminalPresetComboBox</tabstop> + <tabstop>historyLimited</tabstop> + <tabstop>historyLimitedTo</tabstop> + <tabstop>historyUnlimited</tabstop> + <tabstop>motionAfterPasting_comboBox</tabstop> + <tabstop>askOnExitCheckBox</tabstop> + <tabstop>savePosOnExitCheckBox</tabstop> + <tabstop>saveSizeOnExitCheckBox</tabstop> + <tabstop>useCwdCheckBox</tabstop> + <tabstop>emulationComboBox</tabstop> + <tabstop>shortcutsWidget</tabstop> + <tabstop>dropShowOnStartCheckBox</tabstop> + <tabstop>dropHeightSpinBox</tabstop> + <tabstop>dropWidthSpinBox</tabstop> + <tabstop>dropShortCutEdit</tabstop> + <tabstop>useBookmarksCheckBox</tabstop> + <tabstop>bookmarksLineEdit</tabstop> + <tabstop>bookmarksButton</tabstop> + <tabstop>bookmarkPlainEdit</tabstop> + </tabstops> <resources/> <connections> <connection> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/forms/qterminal.ui new/qterminal-0.7.1/src/forms/qterminal.ui --- old/qterminal-0.7.0/src/forms/qterminal.ui 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/forms/qterminal.ui 2016-12-21 18:51:40.000000000 +0100 @@ -32,12 +32,6 @@ </property> <item row="0" column="0"> <widget class="TabWidget" name="consoleTabulator"> - <property name="minimumSize"> - <size> - <width>320</width> - <height>200</height> - </size> - </property> <property name="tabPosition"> <enum>QTabWidget::South</enum> </property> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/mainwindow.cpp new/qterminal-0.7.1/src/mainwindow.cpp --- old/qterminal-0.7.0/src/mainwindow.cpp 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/mainwindow.cpp 2016-12-21 18:51:40.000000000 +0100 @@ -20,6 +20,7 @@ #include <QDesktopWidget> #include <QToolButton> #include <QMessageBox> +#include <functional> #include "mainwindow.h" #include "tabwidget.h" @@ -30,6 +31,9 @@ #include "bookmarkswidget.h" +typedef std::function<bool(MainWindow&)> checkfn; +Q_DECLARE_METATYPE(checkfn) + // TODO/FXIME: probably remove. QSS makes it unusable on mac... #define QSS_DROP "MainWindow {border: 1px solid rgba(0, 0, 0, 50%);}\n" @@ -94,6 +98,8 @@ setupCustomDirs(); connect(consoleTabulator, &TabWidget::currentTitleChanged, this, &MainWindow::onCurrentTitleChanged); + connect(menu_Actions, SIGNAL(aboutToShow()), this, SLOT(aboutToShowActionsMenu())); + /* 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. */ @@ -131,140 +137,102 @@ } } -void MainWindow::setup_ActionsMenu_Actions() +void MainWindow::setup_Action(const char *name, QAction *action, const char *defaultShortcut, const QObject *receiver, + const char *slot, QMenu *menu, const QVariant &data) { QSettings settings; settings.beginGroup("Shortcuts"); - QKeySequence seq; + QList<QKeySequence> shortcuts; + + Properties::Instance()->actions[name] = action; + foreach (const QString &sequenceString, settings.value(name, defaultShortcut).toString().split('|')) + shortcuts.append(QKeySequence::fromString(sequenceString)); + Properties::Instance()->actions[name]->setShortcuts(shortcuts); + + if (receiver) + { + connect(Properties::Instance()->actions[name], SIGNAL(triggered(bool)), receiver, slot); + addAction(Properties::Instance()->actions[name]); + } + + if (menu) + menu->addAction(Properties::Instance()->actions[name]); + + if (!data.isNull()) + Properties::Instance()->actions[name]->setData(data); +} + +void MainWindow::setup_ActionsMenu_Actions() +{ + QVariant data; + + const checkfn checkTabs = &MainWindow::hasMultipleTabs; + const checkfn checkSubterminals = &MainWindow::hasMultipleSubterminals; - Properties::Instance()->actions[CLEAR_TERMINAL] = new QAction(QIcon::fromTheme("edit-clear"), tr("&Clear Current Tab"), this); - seq = QKeySequence::fromString(settings.value(CLEAR_TERMINAL, CLEAR_TERMINAL_SHORTCUT).toString()); - Properties::Instance()->actions[CLEAR_TERMINAL]->setShortcut(seq); - connect(Properties::Instance()->actions[CLEAR_TERMINAL], SIGNAL(triggered()), consoleTabulator, SLOT(clearActiveTerminal())); - menu_Actions->addAction(Properties::Instance()->actions[CLEAR_TERMINAL]); - addAction(Properties::Instance()->actions[CLEAR_TERMINAL]); + setup_Action(CLEAR_TERMINAL, new QAction(QIcon::fromTheme("edit-clear"), tr("&Clear Current Tab"), this), + CLEAR_TERMINAL_SHORTCUT, consoleTabulator, SLOT(clearActiveTerminal()), menu_Actions); menu_Actions->addSeparator(); - Properties::Instance()->actions[TAB_NEXT] = new QAction(QIcon::fromTheme("go-next"), tr("&Next Tab"), this); - seq = QKeySequence::fromString( settings.value(TAB_NEXT, TAB_NEXT_SHORTCUT).toString() ); - Properties::Instance()->actions[TAB_NEXT]->setShortcut(seq); - connect(Properties::Instance()->actions[TAB_NEXT], SIGNAL(triggered()), consoleTabulator, SLOT(switchToRight())); - menu_Actions->addAction(Properties::Instance()->actions[TAB_NEXT]); - addAction(Properties::Instance()->actions[TAB_NEXT]); - - Properties::Instance()->actions[TAB_PREV] = new QAction(QIcon::fromTheme("go-previous"), tr("&Previous Tab"), this); - seq = QKeySequence::fromString( settings.value(TAB_PREV, TAB_PREV_SHORTCUT).toString() ); - Properties::Instance()->actions[TAB_PREV]->setShortcut(seq); - connect(Properties::Instance()->actions[TAB_PREV], SIGNAL(triggered()), consoleTabulator, SLOT(switchToLeft())); - menu_Actions->addAction(Properties::Instance()->actions[TAB_PREV]); - addAction(Properties::Instance()->actions[TAB_PREV]); - - Properties::Instance()->actions[MOVE_LEFT] = new QAction(tr("Move Tab &Left"), this); - seq = QKeySequence::fromString( settings.value(MOVE_LEFT, MOVE_LEFT_SHORTCUT).toString() ); - Properties::Instance()->actions[MOVE_LEFT]->setShortcut(seq); - connect(Properties::Instance()->actions[MOVE_LEFT], SIGNAL(triggered()), consoleTabulator, SLOT(moveLeft())); - menu_Actions->addAction(Properties::Instance()->actions[MOVE_LEFT]); - addAction(Properties::Instance()->actions[MOVE_LEFT]); - - Properties::Instance()->actions[MOVE_RIGHT] = new QAction(tr("Move Tab &Right"), this); - seq = QKeySequence::fromString( settings.value(MOVE_RIGHT, MOVE_RIGHT_SHORTCUT).toString() ); - Properties::Instance()->actions[MOVE_RIGHT]->setShortcut(seq); - connect(Properties::Instance()->actions[MOVE_RIGHT], SIGNAL(triggered()), consoleTabulator, SLOT(moveRight())); - menu_Actions->addAction(Properties::Instance()->actions[MOVE_RIGHT]); - addAction(Properties::Instance()->actions[MOVE_RIGHT]); + data.setValue(checkTabs); + + setup_Action(TAB_NEXT, new QAction(QIcon::fromTheme("go-next"), tr("&Next Tab"), this), + TAB_NEXT_SHORTCUT, consoleTabulator, SLOT(switchToRight()), menu_Actions, data); + + setup_Action(TAB_PREV, new QAction(QIcon::fromTheme("go-previous"), tr("&Previous Tab"), this), + TAB_PREV_SHORTCUT, consoleTabulator, SLOT(switchToLeft()), menu_Actions, data); + + setup_Action(MOVE_LEFT, new QAction(tr("Move Tab &Left"), this), + MOVE_LEFT_SHORTCUT, consoleTabulator, SLOT(moveLeft()), menu_Actions, data); + + setup_Action(MOVE_RIGHT, new QAction(tr("Move Tab &Right"), this), + MOVE_RIGHT_SHORTCUT, consoleTabulator, SLOT(moveRight()), menu_Actions, data); menu_Actions->addSeparator(); - Properties::Instance()->actions[SPLIT_HORIZONTAL] = new QAction(tr("Split Terminal &Horizontally"), this); - seq = QKeySequence::fromString( settings.value(SPLIT_HORIZONTAL).toString() ); - Properties::Instance()->actions[SPLIT_HORIZONTAL]->setShortcut(seq); - connect(Properties::Instance()->actions[SPLIT_HORIZONTAL], SIGNAL(triggered()), consoleTabulator, SLOT(splitHorizontally())); - menu_Actions->addAction(Properties::Instance()->actions[SPLIT_HORIZONTAL]); - addAction(Properties::Instance()->actions[SPLIT_HORIZONTAL]); - - Properties::Instance()->actions[SPLIT_VERTICAL] = new QAction(tr("Split Terminal &Vertically"), this); - seq = QKeySequence::fromString( settings.value(SPLIT_VERTICAL).toString() ); - Properties::Instance()->actions[SPLIT_VERTICAL]->setShortcut(seq); - connect(Properties::Instance()->actions[SPLIT_VERTICAL], SIGNAL(triggered()), consoleTabulator, SLOT(splitVertically())); - menu_Actions->addAction(Properties::Instance()->actions[SPLIT_VERTICAL]); - addAction(Properties::Instance()->actions[SPLIT_VERTICAL]); - - Properties::Instance()->actions[SUB_COLLAPSE] = new QAction(tr("&Collapse Subterminal"), this); - seq = QKeySequence::fromString( settings.value(SUB_COLLAPSE).toString() ); - Properties::Instance()->actions[SUB_COLLAPSE]->setShortcut(seq); - connect(Properties::Instance()->actions[SUB_COLLAPSE], SIGNAL(triggered()), consoleTabulator, SLOT(splitCollapse())); - menu_Actions->addAction(Properties::Instance()->actions[SUB_COLLAPSE]); - addAction(Properties::Instance()->actions[SUB_COLLAPSE]); - - Properties::Instance()->actions[SUB_NEXT] = new QAction(QIcon::fromTheme("go-up"), tr("N&ext Subterminal"), this); - seq = QKeySequence::fromString( settings.value(SUB_NEXT, SUB_NEXT_SHORTCUT).toString() ); - Properties::Instance()->actions[SUB_NEXT]->setShortcut(seq); - connect(Properties::Instance()->actions[SUB_NEXT], SIGNAL(triggered()), consoleTabulator, SLOT(switchNextSubterminal())); - menu_Actions->addAction(Properties::Instance()->actions[SUB_NEXT]); - addAction(Properties::Instance()->actions[SUB_NEXT]); - - Properties::Instance()->actions[SUB_PREV] = new QAction(QIcon::fromTheme("go-down"), tr("P&revious Subterminal"), this); - seq = QKeySequence::fromString( settings.value(SUB_PREV, SUB_PREV_SHORTCUT).toString() ); - Properties::Instance()->actions[SUB_PREV]->setShortcut(seq); - connect(Properties::Instance()->actions[SUB_PREV], SIGNAL(triggered()), consoleTabulator, SLOT(switchPrevSubterminal())); - menu_Actions->addAction(Properties::Instance()->actions[SUB_PREV]); - addAction(Properties::Instance()->actions[SUB_PREV]); + setup_Action(SPLIT_HORIZONTAL, new QAction(tr("Split Terminal &Horizontally"), this), + NULL, consoleTabulator, SLOT(splitHorizontally()), menu_Actions); + + setup_Action(SPLIT_VERTICAL, new QAction(tr("Split Terminal &Vertically"), this), + NULL, consoleTabulator, SLOT(splitVertically()), menu_Actions); + + data.setValue(checkSubterminals); + + setup_Action(SUB_COLLAPSE, new QAction(tr("&Collapse Subterminal"), this), + NULL, consoleTabulator, SLOT(splitCollapse()), menu_Actions, data); + + setup_Action(SUB_NEXT, new QAction(QIcon::fromTheme("go-up"), tr("N&ext Subterminal"), this), + SUB_NEXT_SHORTCUT, consoleTabulator, SLOT(switchNextSubterminal()), menu_Actions, data); + + setup_Action(SUB_PREV, new QAction(QIcon::fromTheme("go-down"), tr("P&revious Subterminal"), this), + SUB_PREV_SHORTCUT, consoleTabulator, SLOT(switchPrevSubterminal()), menu_Actions, data); menu_Actions->addSeparator(); // Copy and Paste are only added to the table for the sake of bindings at the moment; there is no Edit menu, only a context menu. - Properties::Instance()->actions[COPY_SELECTION] = new QAction(QIcon::fromTheme("edit-copy"), tr("Copy &Selection"), this); - seq = QKeySequence::fromString( settings.value(COPY_SELECTION, COPY_SELECTION_SHORTCUT).toString() ); - Properties::Instance()->actions[COPY_SELECTION]->setShortcut(seq); - connect(Properties::Instance()->actions[COPY_SELECTION], SIGNAL(triggered()), consoleTabulator, SLOT(copySelection())); - menu_Edit->addAction(Properties::Instance()->actions[COPY_SELECTION]); - addAction(Properties::Instance()->actions[COPY_SELECTION]); - - Properties::Instance()->actions[PASTE_CLIPBOARD] = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste Clip&board"), this); - seq = QKeySequence::fromString( settings.value(PASTE_CLIPBOARD, PASTE_CLIPBOARD_SHORTCUT).toString() ); - Properties::Instance()->actions[PASTE_CLIPBOARD]->setShortcut(seq); - connect(Properties::Instance()->actions[PASTE_CLIPBOARD], SIGNAL(triggered()), consoleTabulator, SLOT(pasteClipboard())); - menu_Edit->addAction(Properties::Instance()->actions[PASTE_CLIPBOARD]); - addAction(Properties::Instance()->actions[PASTE_CLIPBOARD]); - - Properties::Instance()->actions[PASTE_SELECTION] = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste S&election"), this); - seq = QKeySequence::fromString( settings.value(PASTE_SELECTION, PASTE_SELECTION_SHORTCUT).toString() ); - Properties::Instance()->actions[PASTE_SELECTION]->setShortcut(seq); - connect(Properties::Instance()->actions[PASTE_SELECTION], SIGNAL(triggered()), consoleTabulator, SLOT(pasteSelection())); - menu_Edit->addAction(Properties::Instance()->actions[PASTE_SELECTION]); - addAction(Properties::Instance()->actions[PASTE_SELECTION]); - - Properties::Instance()->actions[ZOOM_IN] = new QAction(QIcon::fromTheme("zoom-in"), tr("Zoom &in"), this); - seq = QKeySequence::fromString( settings.value(ZOOM_IN, ZOOM_IN_SHORTCUT).toString() ); - Properties::Instance()->actions[ZOOM_IN]->setShortcut(seq); - connect(Properties::Instance()->actions[ZOOM_IN], SIGNAL(triggered()), consoleTabulator, SLOT(zoomIn())); - menu_Edit->addAction(Properties::Instance()->actions[ZOOM_IN]); - addAction(Properties::Instance()->actions[ZOOM_IN]); - - Properties::Instance()->actions[ZOOM_OUT] = new QAction(QIcon::fromTheme("zoom-out"), tr("Zoom &out"), this); - seq = QKeySequence::fromString( settings.value(ZOOM_OUT, ZOOM_OUT_SHORTCUT).toString() ); - Properties::Instance()->actions[ZOOM_OUT]->setShortcut(seq); - connect(Properties::Instance()->actions[ZOOM_OUT], SIGNAL(triggered()), consoleTabulator, SLOT(zoomOut())); - menu_Edit->addAction(Properties::Instance()->actions[ZOOM_OUT]); - addAction(Properties::Instance()->actions[ZOOM_OUT]); - - Properties::Instance()->actions[ZOOM_RESET] = new QAction(QIcon::fromTheme("zoom-original"), tr("Zoom rese&t"), this); - seq = QKeySequence::fromString( settings.value(ZOOM_RESET, ZOOM_RESET_SHORTCUT).toString() ); - Properties::Instance()->actions[ZOOM_RESET]->setShortcut(seq); - connect(Properties::Instance()->actions[ZOOM_RESET], SIGNAL(triggered()), consoleTabulator, SLOT(zoomReset())); - menu_Edit->addAction(Properties::Instance()->actions[ZOOM_RESET]); - addAction(Properties::Instance()->actions[ZOOM_RESET]); + setup_Action(COPY_SELECTION, new QAction(QIcon::fromTheme("edit-copy"), tr("Copy &Selection"), this), + COPY_SELECTION_SHORTCUT, consoleTabulator, SLOT(copySelection()), menu_Edit); + + setup_Action(PASTE_CLIPBOARD, new QAction(QIcon::fromTheme("edit-paste"), tr("Paste Clip&board"), this), + PASTE_CLIPBOARD_SHORTCUT, consoleTabulator, SLOT(pasteClipboard()), menu_Edit); + + setup_Action(PASTE_SELECTION, new QAction(QIcon::fromTheme("edit-paste"), tr("Paste S&election"), this), + PASTE_SELECTION_SHORTCUT, consoleTabulator, SLOT(pasteSelection()), menu_Edit); + + setup_Action(ZOOM_IN, new QAction(QIcon::fromTheme("zoom-in"), tr("Zoom &in"), this), + ZOOM_IN_SHORTCUT, consoleTabulator, SLOT(zoomIn()), menu_Edit); + + setup_Action(ZOOM_OUT, new QAction(QIcon::fromTheme("zoom-out"), tr("Zoom &out"), this), + ZOOM_OUT_SHORTCUT, consoleTabulator, SLOT(zoomOut()), menu_Edit); + + setup_Action(ZOOM_RESET, new QAction(QIcon::fromTheme("zoom-original"), tr("Zoom rese&t"), this), + ZOOM_RESET_SHORTCUT, consoleTabulator, SLOT(zoomReset()), menu_Edit); menu_Actions->addSeparator(); - Properties::Instance()->actions[FIND] = new QAction(QIcon::fromTheme("edit-find"), tr("&Find..."), this); - seq = QKeySequence::fromString( settings.value(FIND, FIND_SHORTCUT).toString() ); - Properties::Instance()->actions[FIND]->setShortcut(seq); - connect(Properties::Instance()->actions[FIND], SIGNAL(triggered()), this, SLOT(find())); - menu_Actions->addAction(Properties::Instance()->actions[FIND]); - addAction(Properties::Instance()->actions[FIND]); + setup_Action(FIND, new QAction(QIcon::fromTheme("edit-find"), tr("&Find..."), this), + FIND_SHORTCUT, this, SLOT(find()), menu_Actions); #if 0 act = new QAction(this); @@ -284,39 +252,22 @@ connect(act, SIGNAL(triggered()), consoleTabulator, SLOT(loadSession())); #endif - Properties::Instance()->actions[TOGGLE_MENU] = new QAction(tr("&Toggle Menu"), this); - seq = QKeySequence::fromString( settings.value(TOGGLE_MENU, TOGGLE_MENU_SHORTCUT).toString() ); - Properties::Instance()->actions[TOGGLE_MENU]->setShortcut(seq); - connect(Properties::Instance()->actions[TOGGLE_MENU], SIGNAL(triggered()), this, SLOT(toggleMenu())); - addAction(Properties::Instance()->actions[TOGGLE_MENU]); + setup_Action(TOGGLE_MENU, new QAction(tr("&Toggle Menu"), this), + TOGGLE_MENU_SHORTCUT, this, SLOT(find())); // this is correct - add action to main window - not to menu to keep toggle working // Add global rename current session shortcut - Properties::Instance()->actions[RENAME_SESSION] = new QAction(tr("Rename session"), this); - seq = QKeySequence::fromString(settings.value(RENAME_SESSION, RENAME_SESSION_SHORTCUT).toString()); - Properties::Instance()->actions[RENAME_SESSION]->setShortcut(seq); - connect(Properties::Instance()->actions[RENAME_SESSION], SIGNAL(triggered()), consoleTabulator, SLOT(renameCurrentSession())); - addAction(Properties::Instance()->actions[RENAME_SESSION]); + setup_Action(RENAME_SESSION, new QAction(tr("Rename session"), this), + RENAME_SESSION_SHORTCUT, consoleTabulator, SLOT(renameCurrentSession())); // this is correct - add action to main window - not to menu - settings.endGroup(); - // apply props propertiesChanged(); } void MainWindow::setup_FileMenu_Actions() { - QSettings settings; - settings.beginGroup("Shortcuts"); - - QKeySequence seq; - - Properties::Instance()->actions[ADD_TAB] = new QAction(QIcon::fromTheme("list-add"), tr("&New Tab"), this); - seq = QKeySequence::fromString( settings.value(ADD_TAB, ADD_TAB_SHORTCUT).toString() ); - Properties::Instance()->actions[ADD_TAB]->setShortcut(seq); - connect(Properties::Instance()->actions[ADD_TAB], SIGNAL(triggered()), this, SLOT(addNewTab())); - menu_File->addAction(Properties::Instance()->actions[ADD_TAB]); - addAction(Properties::Instance()->actions[ADD_TAB]); + setup_Action(ADD_TAB, new QAction(QIcon::fromTheme("list-add"), tr("&New Tab"), this), + ADD_TAB_SHORTCUT, this, SLOT(addNewTab()), menu_File); QMenu *presetsMenu = new QMenu(tr("New Tab From &Preset"), this); presetsMenu->addAction(QIcon(), tr("1 &Terminal"), @@ -329,56 +280,28 @@ consoleTabulator, SLOT(preset4Terminals())); menu_File->addMenu(presetsMenu); - Properties::Instance()->actions[CLOSE_TAB] = new QAction(QIcon::fromTheme("list-remove"), tr("&Close Tab"), this); - seq = QKeySequence::fromString( settings.value(CLOSE_TAB, CLOSE_TAB_SHORTCUT).toString() ); - Properties::Instance()->actions[CLOSE_TAB]->setShortcut(seq); - connect(Properties::Instance()->actions[CLOSE_TAB], SIGNAL(triggered()), consoleTabulator, SLOT(removeCurrentTab())); - menu_File->addAction(Properties::Instance()->actions[CLOSE_TAB]); - addAction(Properties::Instance()->actions[CLOSE_TAB]); - - Properties::Instance()->actions[NEW_WINDOW] = new QAction(QIcon::fromTheme("window-new"), tr("&New Window"), this); - seq = QKeySequence::fromString( settings.value(NEW_WINDOW, NEW_WINDOW_SHORTCUT).toString() ); - Properties::Instance()->actions[NEW_WINDOW]->setShortcut(seq); - connect(Properties::Instance()->actions[NEW_WINDOW], SIGNAL(triggered()), this, SLOT(newTerminalWindow())); - menu_File->addAction(Properties::Instance()->actions[NEW_WINDOW]); - addAction(Properties::Instance()->actions[NEW_WINDOW]); + setup_Action(CLOSE_TAB, new QAction(QIcon::fromTheme("list-remove"), tr("&Close Tab"), this), + CLOSE_TAB_SHORTCUT, consoleTabulator, SLOT(removeCurrentTab()), menu_File); + + setup_Action(NEW_WINDOW, new QAction(QIcon::fromTheme("window-new"), tr("&New Window"), this), + NEW_WINDOW_SHORTCUT, this, SLOT(newTerminalWindow()), menu_File); menu_File->addSeparator(); - Properties::Instance()->actions[PREFERENCES] = actProperties; - seq = QKeySequence::fromString( settings.value(PREFERENCES).toString() ); - Properties::Instance()->actions[PREFERENCES]->setShortcut(seq); - connect(actProperties, SIGNAL(triggered()), SLOT(actProperties_triggered())); - menu_File->addAction(Properties::Instance()->actions[PREFERENCES]); - addAction(Properties::Instance()->actions[PREFERENCES]); + setup_Action(PREFERENCES, actProperties, "", this, SLOT(actProperties_triggered()), menu_File); menu_File->addSeparator(); - Properties::Instance()->actions[QUIT] = actQuit; - seq = QKeySequence::fromString( settings.value(QUIT).toString() ); - Properties::Instance()->actions[QUIT]->setShortcut(seq); - connect(actQuit, SIGNAL(triggered()), SLOT(close())); - menu_File->addAction(Properties::Instance()->actions[QUIT]); - addAction(Properties::Instance()->actions[QUIT]); - - settings.endGroup(); + setup_Action(QUIT, actQuit, "", this, SLOT(close()), menu_File); } void MainWindow::setup_ViewMenu_Actions() { - QKeySequence seq; - QSettings settings; - settings.beginGroup("Shortcuts"); - QAction *hideBordersAction = new QAction(tr("&Hide Window Borders"), this); hideBordersAction->setCheckable(true); hideBordersAction->setVisible(!m_dropMode); - seq = QKeySequence::fromString( settings.value(HIDE_WINDOW_BORDERS).toString() ); - hideBordersAction->setShortcut(seq); - connect(hideBordersAction, SIGNAL(triggered()), this, SLOT(toggleBorderless())); - menu_Window->addAction(hideBordersAction); - addAction(hideBordersAction); - Properties::Instance()->actions[HIDE_WINDOW_BORDERS] = hideBordersAction; + setup_Action(HIDE_WINDOW_BORDERS, hideBordersAction, + NULL, this, SLOT(toggleBorderless()), menu_Window); //Properties::Instance()->actions[HIDE_WINDOW_BORDERS]->setObjectName("toggle_Borderless"); // TODO/FIXME: it's broken somehow. When I call toggleBorderless() here the non-responsive window appear // Properties::Instance()->actions[HIDE_WINDOW_BORDERS]->setChecked(Properties::Instance()->borderless); @@ -389,29 +312,18 @@ //toggleTabbar->setObjectName("toggle_TabBar"); showTabBarAction->setCheckable(true); showTabBarAction->setChecked(!Properties::Instance()->tabBarless); - seq = QKeySequence::fromString( settings.value(SHOW_TAB_BAR).toString() ); - showTabBarAction->setShortcut(seq); - menu_Window->addAction(showTabBarAction); - addAction(showTabBarAction); - Properties::Instance()->actions[SHOW_TAB_BAR] = showTabBarAction; + setup_Action(SHOW_TAB_BAR, showTabBarAction, + NULL, this, SLOT(toggleTabBar()), menu_Window); toggleTabBar(); - connect(showTabBarAction, SIGNAL(triggered()), this, SLOT(toggleTabBar())); QAction *toggleFullscreen = new QAction(tr("Fullscreen"), this); toggleFullscreen->setCheckable(true); toggleFullscreen->setChecked(false); - seq = QKeySequence::fromString(settings.value(FULLSCREEN, FULLSCREEN_SHORTCUT).toString()); - toggleFullscreen->setShortcut(seq); - menu_Window->addAction(toggleFullscreen); - addAction(toggleFullscreen); - connect(toggleFullscreen, SIGNAL(triggered(bool)), this, SLOT(showFullscreen(bool))); - Properties::Instance()->actions[FULLSCREEN] = toggleFullscreen; - - Properties::Instance()->actions[TOGGLE_BOOKMARKS] = m_bookmarksDock->toggleViewAction(); - seq = QKeySequence::fromString( settings.value(TOGGLE_BOOKMARKS, TOGGLE_BOOKMARKS_SHORTCUT).toString() ); - Properties::Instance()->actions[TOGGLE_BOOKMARKS]->setShortcut(seq); - menu_Window->addAction(Properties::Instance()->actions[TOGGLE_BOOKMARKS]); - settings.endGroup(); + setup_Action(FULLSCREEN, toggleFullscreen, + FULLSCREEN_SHORTCUT, this, SLOT(showFullscreen(bool)), menu_Window); + + setup_Action(TOGGLE_BOOKMARKS, m_bookmarksDock->toggleViewAction(), + TOGGLE_BOOKMARKS_SHORTCUT, NULL, NULL, menu_Window); menu_Window->addSeparator(); @@ -506,6 +418,25 @@ menu_Window->addMenu(keyboardCursorShapeMenu); } +void MainWindow::setup_ContextMenu_Actions(QMenu* contextMenu) const +{ + contextMenu->addAction(Properties::Instance()->actions[COPY_SELECTION]); + contextMenu->addAction(Properties::Instance()->actions[PASTE_CLIPBOARD]); + contextMenu->addAction(Properties::Instance()->actions[PASTE_SELECTION]); + contextMenu->addAction(Properties::Instance()->actions[ZOOM_IN]); + contextMenu->addAction(Properties::Instance()->actions[ZOOM_OUT]); + contextMenu->addAction(Properties::Instance()->actions[ZOOM_RESET]); + contextMenu->addSeparator(); + contextMenu->addAction(Properties::Instance()->actions[CLEAR_TERMINAL]); + contextMenu->addAction(Properties::Instance()->actions[SPLIT_HORIZONTAL]); + contextMenu->addAction(Properties::Instance()->actions[SPLIT_VERTICAL]); + #warning TODO/FIXME: disable the action when there is only one terminal + contextMenu->addAction(Properties::Instance()->actions[SUB_COLLAPSE]); + contextMenu->addSeparator(); + contextMenu->addAction(Properties::Instance()->actions[TOGGLE_MENU]); + contextMenu->addAction(Properties::Instance()->actions[PREFERENCES]); +} + void MainWindow::setupCustomDirs() { const QSettings settings; @@ -753,3 +684,24 @@ setWindowTitle(title.isEmpty() || !Properties::Instance()->changeWindowTitle ? QStringLiteral("QTerminal") : title); setWindowIcon(icon.isNull() || !Properties::Instance()->changeWindowIcon ? QIcon::fromTheme("utilities-terminal") : icon); } + +bool MainWindow::hasMultipleTabs() +{ + return consoleTabulator->findChildren<TermWidgetHolder*>().count() > 1; +} + +bool MainWindow::hasMultipleSubterminals() +{ + return consoleTabulator->terminalHolder()->findChildren<TermWidget*>().count() > 1; +} + +void MainWindow::aboutToShowActionsMenu() +{ + const QList<QAction*> actions = menu_Actions->actions(); + for (QAction *action : actions) { + if (!action->data().isNull()) { + const checkfn check = action->data().value<checkfn>(); + action->setEnabled(check(*this)); + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/mainwindow.h new/qterminal-0.7.1/src/mainwindow.h --- old/qterminal-0.7.0/src/mainwindow.h 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/mainwindow.h 2016-12-21 18:51:40.000000000 +0100 @@ -36,7 +36,8 @@ QWidget * parent = 0, Qt::WindowFlags f = 0); ~MainWindow(); - bool dropMode() { return m_dropMode; } + bool dropMode() const { return m_dropMode; } + void setup_ContextMenu_Actions(QMenu* contextMenu) const; protected: bool event(QEvent* event); @@ -50,6 +51,8 @@ QDockWidget *m_bookmarksDock; + void setup_Action(const char *name, QAction *action, const char *defaultShortcut, const QObject *receiver, + const char *slot, QMenu *menu = NULL, const QVariant &data = QVariant()); void setup_FileMenu_Actions(); void setup_ActionsMenu_Actions(); void setup_ViewMenu_Actions(); @@ -64,6 +67,9 @@ void realign(); void setDropShortcut(QKeySequence dropShortCut); + bool hasMultipleTabs(); + bool hasMultipleSubterminals(); + private slots: void on_consoleTabulator_currentChanged(int); void propertiesChanged(); @@ -86,5 +92,7 @@ void addNewTab(); void onCurrentTitleChanged(int index); + + void aboutToShowActionsMenu(); }; #endif //MAINWINDOW_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/properties.cpp new/qterminal-0.7.1/src/properties.cpp --- old/qterminal-0.7.0/src/properties.cpp 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/properties.cpp 2016-12-21 18:51:40.000000000 +0100 @@ -104,6 +104,7 @@ appTransparency = m_settings->value("MainWindow/ApplicationTransparency", 0).toInt(); termTransparency = m_settings->value("TerminalTransparency", 0).toInt(); + backgroundImage = m_settings->value("TerminalBackgroundImage", QString()).toString(); /* default to Right. see qtermwidget.h */ scrollBarPos = m_settings->value("ScrollbarPosition", 2).toInt(); @@ -154,8 +155,10 @@ while( it.hasNext() ) { it.next(); - QKeySequence shortcut = it.value()->shortcut(); - m_settings->setValue( it.key(), shortcut.toString() ); + QStringList sequenceStrings; + foreach (QKeySequence shortcut, it.value()->shortcuts()) + sequenceStrings.append(shortcut.toString()); + m_settings->setValue(it.key(), sequenceStrings.join('|')); } m_settings->endGroup(); @@ -184,6 +187,7 @@ m_settings->setValue("MainWindow/ApplicationTransparency", appTransparency); m_settings->setValue("TerminalTransparency", termTransparency); + m_settings->setValue("TerminalBackgroundImage", backgroundImage); m_settings->setValue("ScrollbarPosition", scrollBarPos); m_settings->setValue("TabsPosition", tabsPos); m_settings->setValue("KeyboardCursorShape", keyboardCursorShape); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/properties.h new/qterminal-0.7.1/src/properties.h --- old/qterminal-0.7.0/src/properties.h 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/properties.h 2016-12-21 18:51:40.000000000 +0100 @@ -61,6 +61,7 @@ int appTransparency; int termTransparency; + QString backgroundImage; int scrollBarPos; int tabsPos; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/propertiesdialog.cpp new/qterminal-0.7.1/src/propertiesdialog.cpp --- old/qterminal-0.7.0/src/propertiesdialog.cpp 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/propertiesdialog.cpp 2016-12-21 18:51:40.000000000 +0100 @@ -37,6 +37,8 @@ this, SLOT(apply())); connect(changeFontButton, SIGNAL(clicked()), this, SLOT(changeFontButton_clicked())); + connect(chooseBackgroundImageButton, &QPushButton::clicked, + this, &PropertiesDialog::chooseBackgroundImageButton_clicked); QStringList emulations = QTermWidget::availableKeyBindings(); QStringList colorSchemes = QTermWidget::availableColorSchemes(); @@ -49,6 +51,8 @@ if (csix != -1) colorSchemaCombo->setCurrentIndex(csix); + backgroundImageLineEdit->setText(Properties::Instance()->backgroundImage); + emulationComboBox->addItems(emulations); int eix = emulationComboBox->findText(Properties::Instance()->emulation); emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 ); @@ -114,8 +118,12 @@ historyLimitedTo->setValue(Properties::Instance()->historyLimitedTo); dropShowOnStartCheckBox->setChecked(Properties::Instance()->dropShowOnStart); + dropHeightSpinBox->setValue(Properties::Instance()->dropHeight); + dropHeightSpinBox->setMaximum(100); dropWidthSpinBox->setValue(Properties::Instance()->dropWidht); + dropWidthSpinBox->setMaximum(100); + dropShortCutEdit->setText(Properties::Instance()->dropShortCut.toString()); useBookmarksCheckBox->setChecked(Properties::Instance()->useBookmarks); @@ -158,6 +166,7 @@ Properties::Instance()->termTransparency = termTransparencyBox->value(); Properties::Instance()->highlightCurrentTerminal = highlightCurrentCheckBox->isChecked(); + Properties::Instance()->backgroundImage = backgroundImageLineEdit->text(); Properties::Instance()->askOnExit = askOnExitCheckBox->isChecked(); @@ -214,6 +223,15 @@ setFontSample(f); } +void PropertiesDialog::chooseBackgroundImageButton_clicked() +{ + QString filename = QFileDialog::getOpenFileName( + this, tr("Open or create bookmarks file"), + QString(), tr("Images (*.bmp *.png *.xpm *.jpg)")); + if (!filename.isNull()) + backgroundImageLineEdit->setText(filename); +} + void PropertiesDialog::saveShortcuts() { QList< QString > shortcutKeys = Properties::Instance()->actions.keys(); @@ -230,7 +248,10 @@ QKeySequence sequence = QKeySequence(item->text()); QString sequenceString = sequence.toString(); - keyAction->setShortcut(sequenceString); + QList<QKeySequence> shortcuts; + foreach (sequenceString, item->text().split('|')) + shortcuts.append(QKeySequence(sequenceString)); + keyAction->setShortcuts(shortcuts); } } @@ -245,9 +266,13 @@ { QString keyValue = shortcutKeys.at(x); QAction *keyAction = Properties::Instance()->actions[keyValue]; + QStringList sequenceStrings; + + foreach (QKeySequence shortcut, keyAction->shortcuts()) + sequenceStrings.append(shortcut.toString()); QTableWidgetItem *itemName = new QTableWidgetItem( tr(keyValue.toStdString().c_str()) ); - QTableWidgetItem *itemShortcut = new QTableWidgetItem( keyAction->shortcut().toString() ); + QTableWidgetItem *itemShortcut = new QTableWidgetItem( sequenceStrings.join('|') ); itemName->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/propertiesdialog.h new/qterminal-0.7.1/src/propertiesdialog.h --- old/qterminal-0.7.0/src/propertiesdialog.h 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/propertiesdialog.h 2016-12-21 18:51:40.000000000 +0100 @@ -44,6 +44,7 @@ void accept(); void changeFontButton_clicked(); + void chooseBackgroundImageButton_clicked(); void bookmarksButton_clicked(); protected: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/tabwidget.cpp new/qterminal-0.7.1/src/tabwidget.cpp --- old/qterminal-0.7.0/src/tabwidget.cpp 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/tabwidget.cpp 2016-12-21 18:51:40.000000000 +0100 @@ -253,24 +253,25 @@ void TabWidget::removeTab(int index) { - setUpdatesEnabled(false); + if (count() > 1) { + setUpdatesEnabled(false); - QWidget * w = widget(index); - QTabWidget::removeTab(index); - w->deleteLater(); + QWidget * w = widget(index); + QTabWidget::removeTab(index); + w->deleteLater(); - updateTabIndices(); - int current = currentIndex(); - if (current >= 0 ) - { - qobject_cast<TermWidgetHolder*>(widget(current))->setInitialFocus(); - } -// do not decrease it as renaming is disabled in renameTabsAfterRemove -// tabNumerator--; - setUpdatesEnabled(true); - - if (count() == 0) + updateTabIndices(); + int current = currentIndex(); + if (current >= 0 ) + { + qobject_cast<TermWidgetHolder*>(widget(current))->setInitialFocus(); + } + // do not decrease it as renaming is disabled in renameTabsAfterRemove + // tabNumerator--; + setUpdatesEnabled(true); + } else { emit closeTabNotification(); + } renameTabsAfterRemove(); showHideTabBar(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/termwidget.cpp new/qterminal-0.7.1/src/termwidget.cpp --- old/qterminal-0.7.0/src/termwidget.cpp 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/termwidget.cpp 2016-12-21 18:51:40.000000000 +0100 @@ -24,6 +24,7 @@ #include "termwidget.h" #include "config.h" #include "properties.h" +#include "mainwindow.h" static int TermWidgetCount = 0; @@ -67,7 +68,7 @@ connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuCall(const QPoint &))); - connect(this, SIGNAL(urlActivated(QUrl)), this, SLOT(activateUrl(const QUrl&))); + connect(this, &QTermWidget::urlActivated, this, &TermWidgetImpl::activateUrl); startShellProgram(); } @@ -90,6 +91,7 @@ setKeyBindings(Properties::Instance()->emulation); setTerminalOpacity(1.0 - Properties::Instance()->termTransparency/100.0); + setTerminalBackgroundImage(Properties::Instance()->backgroundImage); /* be consequent with qtermwidget.h here */ switch(Properties::Instance()->scrollBarPos) { @@ -123,23 +125,20 @@ void TermWidgetImpl::customContextMenuCall(const QPoint & pos) { - QMenu menu; - menu.addAction(Properties::Instance()->actions[COPY_SELECTION]); - menu.addAction(Properties::Instance()->actions[PASTE_CLIPBOARD]); - menu.addAction(Properties::Instance()->actions[PASTE_SELECTION]); - menu.addAction(Properties::Instance()->actions[ZOOM_IN]); - menu.addAction(Properties::Instance()->actions[ZOOM_OUT]); - menu.addAction(Properties::Instance()->actions[ZOOM_RESET]); - menu.addSeparator(); - menu.addAction(Properties::Instance()->actions[CLEAR_TERMINAL]); - menu.addAction(Properties::Instance()->actions[SPLIT_HORIZONTAL]); - menu.addAction(Properties::Instance()->actions[SPLIT_VERTICAL]); -#warning TODO/FIXME: disable the action when there is only one terminal - menu.addAction(Properties::Instance()->actions[SUB_COLLAPSE]); - menu.addSeparator(); - menu.addAction(Properties::Instance()->actions[TOGGLE_MENU]); - menu.addAction(Properties::Instance()->actions[PREFERENCES]); - menu.exec(mapToGlobal(pos)); + QMenu* contextMenu = new QMenu(this); + + QList<QAction*> actions = filterActions(pos); + for (auto& action : actions) + { + contextMenu->addAction(action); + } + + contextMenu->addSeparator(); + + const MainWindow *main = qobject_cast<MainWindow*>(window()); + main->setup_ContextMenu_Actions(contextMenu); + + contextMenu->exec(mapToGlobal(pos)); } void TermWidgetImpl::zoomIn() @@ -166,8 +165,8 @@ // Properties::Instance()->saveSettings(); } -void TermWidgetImpl::activateUrl(const QUrl & url) { - if (QApplication::keyboardModifiers() & Qt::ControlModifier) { +void TermWidgetImpl::activateUrl(const QUrl & url, bool fromContextMenu) { + if (QApplication::keyboardModifiers() & Qt::ControlModifier || fromContextMenu) { QDesktopServices::openUrl(url); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qterminal-0.7.0/src/termwidget.h new/qterminal-0.7.1/src/termwidget.h --- old/qterminal-0.7.0/src/termwidget.h 2016-09-24 00:50:45.000000000 +0200 +++ new/qterminal-0.7.1/src/termwidget.h 2016-12-21 18:51:40.000000000 +0100 @@ -46,7 +46,7 @@ private slots: void customContextMenuCall(const QPoint & pos); - void activateUrl(const QUrl& url); + void activateUrl(const QUrl& url, bool fromContextMenu); };