Commit Graph

337 Commits

Author SHA1 Message Date
Laurent Montel
ef1beaab86 Remove unused includes 2019-08-23 08:09:17 +02:00
Mariusz Glebocki
dc29be39a6 Keep perceived contrast in random background color
Summary:
Randomize colors using HSLuv color space instead of HSL. It has
perceptually uniform lightness, which means every color with the same
lightness value is perceived as equally bright by humans. Displays
quality and lack of calibration in most monitors lowers this uniformity,
but even on worst color display it should be better than standard HSL.

More information about HSLuv: http://www.hsluv.org/

Minor changes:

* Random seed takes PID into account to prevent repeated colors in
  separate Konsole processes
* Key names in a config were changed
* Adapted "Black on random light" color scheme

Breeze with random ranges on default bg and fg: hue=360° saturation=100:
{F6754773}

To be done in future:

* Automatically convert color schemes which use old randomization
  method.

Reviewers: #konsole, #vdg

Subscribers: hindenburg, #vdg, #konsole

Tags: #konsole, #vdg

Differential Revision: https://phabricator.kde.org/D20263
2019-08-17 16:00:45 -04:00
Kurt Hindenburg
3824de3e4f Fix dbus newSession() three methods to work
CCBUG: 410469
FIXED-IN: 19.08
2019-08-05 10:12:15 -04:00
Kurt Hindenburg
26fa796074 Use empty() instead of size() for emptiness 2019-07-17 11:07:24 -04:00
Kurt Hindenburg
2043b03e51 Use auto to avoid duplicating the type name 2019-07-17 09:32:16 -04:00
Kurt Hindenburg
ccc4c2eee6 Fix readability-implicit-bool-conversion issues 2019-07-16 20:58:53 -04:00
Kurt Hindenburg
103ba229f8 Use Q_UNUSED() 2019-07-11 21:50:04 -04:00
Tomaz Canabrava
2fd8cef01b Implement Drag & Drop for Tiling Operations
This allows the split views to be dragged around
the current tab by their headers.  It also
implements a toggle button to maximize/restore
each view.
2019-07-02 15:15:52 +00:00
Tomaz Canabrava
fd26be431a Let the move tab enabled even with one tab
nothing will happen but D and C will not be printed on the
terminal
2019-06-24 22:40:40 +02:00
Tomaz Canabrava
22356315c1 Fixes logic for Maximize / Restore terminals 2019-06-13 12:08:22 +02:00
Tomaz Canabrava
e83707fe45 Add a TerminalHeader when using splits
Summary:
The idea is that a SplitterHeaderBar will be added in the
near future so the checks for the parent widget could be
wrong.
If instead of checking for a specific widget we check for
anything and walk to the parent list untill we find
a TerminalWidget seems sane, and safer.

Phabricator messed with this review and send the wrong diff together (because of the same parent)
so I'm rephrasing it.

Reviewers: #konsole, hindenburg, ngraham, #vdg

Subscribers: aaronhoneycutt, kvermette, thsurrel, rizzitello, mart, hindenburg, gennad, fabianr, ndavis, shubham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D21301
2019-06-13 10:42:28 +02:00
Tomaz Canabrava
c9967fb4c2 Use only one accelerator to Maximize / Unmaximize a split view
Reviewers: hindenburg, #konsole

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D21309
2019-06-13 10:42:28 +02:00
Tomaz Canabrava
cb05664071 Toggle all actions when a session restore happens
Summary:
Fixes session restore actions for me.

BUG: 406895

Reviewers: ngraham, hindenburg, #konsole

Reviewed By: ngraham

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D21118
2019-05-11 10:16:06 -04:00
Tomaz Canabrava
71417ac55e Return early if no Splitter
Historically Konsole is a complex software. there are many ways
to close a session, and one of the least used ones is to delete
the View where the session is, and deleting the session later.

Because the session will also try to delete the view when it's
being deleted, this led to a crash in yakuake.
2019-04-30 10:44:37 +02:00
Thomas Surrel
9680e1f5f1 Fix New tab behavior
Summary:
Fix the regression about the placement of a new tab:
it is now added either at the end, or next to the
current tab depending on the setting.

BUG: 406409

Test Plan:
In Konsole settings, select 'Put new tab after the
current tab' for the New tab behavior setting.
Open some new tabs and check they are opened at the
proper position.

Reviewers: #konsole, hindenburg, tcanabrava

Reviewed By: tcanabrava

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D20836
2019-04-26 09:49:53 -04:00
Kurt Hindenburg
a25e50a9f7 Do not shadow variables 2019-04-17 22:26:28 -04:00
Thomas Surrel
e590afb081 Ctrl-Tab should work in "split-only" view as well
Summary:
The Ctrl-Tab and Ctrl-Shift-Tab were working only when multiple
tabs were opened, but it should work as well when only one tab
is opened but multiple splits are created within that tab.

Test Plan:
Open konsole with a single tab, then create several splits.
Use Ctrl-Tab and Ctrl-Shift-Tab to navigate between the splits
in chronological order.

Reviewers: #konsole, hindenburg, tcanabrava

Reviewed By: #konsole, hindenburg

Subscribers: gennad, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D20395
2019-04-17 10:24:19 -04:00
Tomaz Canabrava
c53e8cb17e Re enable move tab left / right via keyboard shortcuts
Summary: Re-enable Move tab to left / right via keyboard shortcuts

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: mschiller, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D20115
2019-04-10 09:50:27 -04:00
Kurt Hindenburg
becc0b4771 With recent code changes, detaching tabs now works on Mac OS 2019-04-09 20:52:00 -04:00
Tomaz Canabrava
8029d74a97 Implement saving sessions recursively
Summary:
Session Save / Restore.
The old session code saved the sessions in random order,  the restore
order was wrong and it ignored the splits (even the old style splits
where ignored, I'm not talking about the new style). This new session
/ restore code ignores nothing: It will save and restore your whole
Terminal Hierarchy, with splits, splits-in-splits, recursing everything
where needed.

bug: unfocused terminal tabs lacks title untill focused. should be
easy to fix and not a blocker.

Test Plan: - Too many Logouts / Logins to test this.

Reviewers: #konsole, hindenburg, ngraham

Reviewed By: ngraham

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D20224
2019-04-09 18:21:41 +02:00
David Hallas
03a78c2a9f Fixes minor memory leaks
Summary:
Fixes a few minor memory leaks found with address sanitizer.
The newTabButton and closeTabButton was not passed a parent and is not
deleted in the destructor of TabbedViewContainer which will cause them
to be leaked when closing a tab. Instead pass the TabbedViewContainer as
the parent.
The same goes for the profileMenu, it was not passed a parent pointer at
contruction and the setMenu function doesn't take ownership of it, so
therefore it was also leaked.

Test Plan:
Compile konsole with address sanitizer.
Open and close konsole.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D19634
2019-03-28 09:14:13 -04:00
Tomaz Canabrava
6e8153a78e Multiple Splits per Tab
Summary:
This is what I envision for the Konsole Tab / Splits
management. One tab contain a QSPlitter that can contain
multiple TerminalDisplays / Splits.

You can test this behavior by hitting ctrl + shift + 9
and ctrl + shift + 0 to activate the splits, and ctrl +
shift + t to activate a new tab.

Old:
{F6484123}

New:
{F6484124}

What works:
- Tab Creation
- Split Creation (Even Recursive splitting)
- Terminal Close will close the Split on last split
- Last last split to close will close the tab
- Last tab to close will close konsole
- Detaching
- Tab Renaming
- Closing splits after detach
- Closing windows after detach
- Detach / Reattach works!

This patch series has the commits of Thomas Surrel, Maciej Niedbdalski and Myself.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: luc4, hallas, anthonyfieroni, gennad, ngraham, thsurrel, maciejn, mglb, hindenburg, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17643
2019-03-26 21:50:18 -04:00
Tomaz Canabrava
392c7d0fcc Remove dead code in TerminalDisplay
Summary:
A lot of methods that no one called, a lot of methods that the
only calee could be removed to a direct call.

Reviewers: #konsole, hindenburg, ngraham

Reviewed By: #konsole, hindenburg

Subscribers: sandsmark, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D18520
2019-02-16 12:21:35 -05:00
Laurent Montel
f46c36bbb5 Const'ify where it's possible found by clazy 2019-01-11 07:29:12 +01:00
Kurt Hindenburg
e97974fa15 Add ability to toggle/jump between two tabs
With this action, two tabs can be jumped back and forth.  This
somewhat abuses the stucture used for the "Last Used Tabs" action.
When the "Last Used Tabs" actions are used, the next "Toggle between
two tabs" will be incorrect for the first time.

Idea from https://phabricator.kde.org/D7068
2018-12-30 23:00:32 -05:00
Patrick José Pereira
8c94b21980 Correct includes
Summary: Remove unneeded includes, add correct includes, move includes h <-> cpp

Reviewers: tcanabrava, hindenburg, #konsole

Reviewed By: hindenburg, #konsole

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17759
2018-12-28 20:47:34 -05:00
Tomaz Canabrava
7aff75b590 Remove parameter from call
Summary:
This parameter is internal from the TerminalDisplay, no need
to extract it to send to another parameter.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17625
2018-12-17 10:34:41 -05:00
Tomaz Canabrava
6406a66a91 Be explicit on what the ViewContainer accepts
Summary:
This is needed to clean up a bit of the code later.
being really explicit here removes the need to handle
QWidget pointers, as that could in theory be anything

Handling only TerminalDisplays* we can remove the
SessionController map from the ViewContainer and
add it to the TerminalDisplay class in the future

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17492
2018-12-12 11:14:28 -05:00
Tomaz Canabrava
7a43e3b2cd Don't duplicate the tabs when Spliting the View
Summary:
Instead of iterating over the sessions to fetch the view and
duplicate the current screen once for each split, ignore all
of them and just create a new terminal view. The only thing
this terminal view shares with the previous current widget
is the profile.

use createView instead of manually trying to create the view

Fixes bug while closing the split

Don't duplicate tabs in the splits

BUG: 385697
BUG: 380455
FIXED-IN: 19.04

Reviewers: thsurrel, hindenburg, gennad, ngraham, #konsole

Reviewed By: thsurrel, hindenburg, ngraham, #konsole

Subscribers: ngraham, hindenburg, gennad, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17267
2018-12-10 10:02:01 -05:00
Kurt Hindenburg
534d070602 Profile::ReverseUrlHints is a bool not an int 2018-12-02 10:39:07 -05:00
Thomas Surrel
0709fdcbb5 Add Ctrl-Tab to switch tabs in chronological order
Summary:
This patch adds the possibility to navigate between the last
accessed tabs with a keyboard shortcut.

Test Plan: Open several tabs, use Ctrl-Tab to switch to the previous used one.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, ngraham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16884
2018-11-30 09:12:41 -05:00
Kurt Hindenburg
f89beff986 Set _navigationMethod in initialization list and set method 2018-10-28 13:47:18 -04:00
Kurt Hindenburg
8f44c36aec modernize use auto 2018-10-27 22:05:38 -04:00
Martin T. H. Sandsmark
25e07b7e20 Add support for dimming the colors when losing focus
Summary:
pretty vital (at least for me) if one doesn't have compositing.

we can't use the normal QPalette::Inactive because of color schemes,
but I made the new scrollbar color code follow the same dimming colors.

Test Plan:
tested with and without compositing, with and without scrollbar,
and dark and light color schemes.

Reviewers: hindenburg, #konsole

Reviewed By: hindenburg, #konsole

Subscribers: anthonyfieroni, konsole-devel, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16198
2018-10-27 16:21:27 -04:00
Lindsay Roberts
f5cc6d6c90 Restore new tab behavior
Summary:
As part of the QTabBar refactoring, honouring of the new tab behaviour
setting was lost. Restore using a simpler implementation that simply
asks QTabWidget for the current index.

BUG: 396701

Reviewers: #konsole, hindenburg, tcanabrava

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15828
2018-10-06 15:56:49 +03:00
Tomaz Canabrava
d77b991f3a Revert "Refactor Profile and ColorScheme"
This commit breaks sessionProfileCommandReceived
causing crashes in programs such as nvim.
I'm reverting it for now while I can't dig deeper.

This reverts commit 99f233b9a1.
2018-09-25 17:22:08 +02:00
Tomaz Canabrava
99f233b9a1 Refactor Profile and ColorScheme
Summary:
There's no point in returning null if we have a default
and we would check for null and query for the default
in all cases that we used it.

Export the private header ColorScheme

It's going to be used from Parts and App

Add ColorScheme() to the Profile

The profile used to hold the ColorScheme name, but if you
want to query for the ColorScheme you had to call ViewManager
but there's a class ColorSchemeManager that ViewManager used to call

Just make things simple:
- Profile has a colorScheme that it queries from the ColorSchemeManager
- Use profile->colorScheme() when you wanna something from the
colorScheme at the profile.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D13854
2018-09-23 19:07:00 +02:00
Kurt Hindenburg
fb6c0eeed1 Add option to reverse URL hint numbering
Summary:
Adds option to reverse the order of URL hints such that the last URL
(the bottom-most one) has the number 1 and the numbers increase from
bottom to top.

This becomes particularly useful when watching a log or buffer, or in terminal
chat applications. Very often, the most useful URL is the most recent one and
if there are many (> 10) URLs on the screen, the desired one will not get a
hint. Reversing the numbering makes the most recent URL hint take the number 1,
while the oldest will have the highest number or no number at all.{F6244152}

{F6244154}

{F6244155}

Reviewers: #konsole, #vdg, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, ngraham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15362
2018-09-18 09:41:14 -04:00
Tomaz Canabrava
6330bb82bb Fixes crashes related to closing tabs with splits
Summary:
If you moved the tabs to splits in a way that you have a different
number of tabs in each split, and started closing it, the count()
of the tabs would be different and we would hit an assert.

The fix is simple: don't separate the logic between tabEmpty and
tabDestroyed, if the tab is empty it will be destroyed but we can
treat everything in the tabEmpty signal, this way we will never hit
a dangling pointer.

Because of that it was possible that a splitView had a invalid
activeWidget for a microsecond, when it's deleting itself, so
instead of asserting if we have no active view, I choose to return
a empty list of properties.

Reviewers: hindenburg, ngraham, sandsmark

Reviewed By: hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15379
2018-09-16 18:28:14 -04:00
Tomaz Canabrava
8fd74e8b74 Fix tab attach/reattach and simplify tab dnd code
Summary:
This continues the patch series of the rewrite
of the Tab handling code to a more modern approach
using QTabWidget.

This fixes the attach and reattach bug on multiple
konsole windows and reworks the drag & drop code
to a more simplified version of it.

Reviewers: hindenburg, ngraham, sandsmark

Reviewed By: hindenburg

Subscribers: lbergdoll, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15377
2018-09-16 12:48:29 -04:00
Kurt Hindenburg
f29ca068d4 move container usage after nullptr check 2018-07-25 10:13:07 -04:00
Tomaz Canabrava
8b377385ab Re-Enable --hide-tabbar and --show-tabbar
Summary:
Show tabbar and hide tabbar got lost in the transition to a modern
QTabBar, this re-enables them.  These options will override the
current settings if you use --hide-tabbar or --show-tabbar.
Changing these options in the settings will change these settings.

To use the current preferences just start konsole without --hide-tabbar
or --show-tabbar

Reviewers: #konsole, sandsmark, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: ngraham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D14294
2018-07-25 09:18:11 -04:00
Tomaz Canabrava
50cbc1d930 Fix option "Expand individual tab to full window"
Reviewers: #konsole, sandsmark, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D14296
2018-07-24 09:47:15 -04:00
Kurt Hindenburg
c5182b5e6f Revert back to using cmake variable ENABLE_DETACHING to fix build
Builds have been failing since this new QTabBar code was committed
since QOperatingSystemVersion::currentType() is Qt5.9+.  We currently
only require Qt5.6 and I don't want to change that just for this.
ENABLE_DETACHING is only set to false for MacOSX/Darwin.
2018-07-23 23:35:34 -04:00
Tomaz Canabrava
59b9fa5107 re-add detachTab 2018-07-17 10:11:48 +02:00
Tomaz Canabrava
93982ded1e Re-Enable detaching actions
(Detaching is still broken atm)
Move out of the CMake the check for crashes in detaching
It's better to check that in the code - I was quite lost
for a while on why there was a DETACHING_ENABLED definition
as it did not made sense
2018-07-17 10:11:48 +02:00
Tomaz Canabrava
b4ef40dfa1 Re enable close tabs, simplify code 2018-07-17 10:11:48 +02:00
Tomaz Canabrava
0e45cf0584 Connect to KonsoleSettings directly
Bypass boilerplate code, no need for that.
2018-07-17 10:11:48 +02:00
Tomaz Canabrava
83ebda5bf4 Use QTabBar: drop tons of code
Summary:
this is a WIP, I don't plan to merge this yet, there are many thigns to solve.

Drop the handmade TabWidget used inside of konsole in favor of Qt's QTabWidget
This drops tons of code we manually did, but it also drops a bit of functionality.

Missing features:
- Close Button
- New Tab on double click
- Drag'n Drop
- Detach

and lots of testing.

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D13882
2018-07-17 10:11:48 +02:00
Kurt Hindenburg
274633a321 Revert "Simplify code dealing with creating new sessions."
This reverts commit e1f7107cc0.

This broke -e <cmd>.  Since this was just to simpify code, reverting
for now

BUG: 395555
2018-06-22 06:40:29 -04:00