refactor: new LogDock, handle hiding and float correctly'

This commit is contained in:
sithlord48
2025-09-03 23:22:58 -04:00
committed by Nick Bolton
parent 247d48d318
commit de42f53d68
25 changed files with 350 additions and 39 deletions

View File

@ -11,7 +11,10 @@
<file>icons/deskflow-dark/actions/16/process-stop.svg</file>
<file>icons/deskflow-dark/actions/16/system-run.svg</file>
<file>icons/deskflow-dark/actions/16/tools-report-bug.svg</file>
<file>icons/deskflow-dark/actions/16/view-close.svg</file>
<file>icons/deskflow-dark/actions/16/view-refresh.svg</file>
<file>icons/deskflow-dark/actions/16/window-minimize-pip.svg</file>
<file>icons/deskflow-dark/actions/16/window-restore-pip.svg</file>
<file>icons/deskflow-dark/actions/22/configure.svg</file>
<file>icons/deskflow-dark/actions/22/edit-copy.svg</file>
<file>icons/deskflow-dark/actions/22/document-edit.svg</file>
@ -24,7 +27,10 @@
<file>icons/deskflow-dark/actions/22/process-stop.svg</file>
<file>icons/deskflow-dark/actions/22/system-run.svg</file>
<file>icons/deskflow-dark/actions/22/tools-report-bug.svg</file>
<file>icons/deskflow-dark/actions/22/view-close.svg</file>
<file>icons/deskflow-dark/actions/22/view-refresh.svg</file>
<file>icons/deskflow-dark/actions/22/window-minimize-pip.svg</file>
<file>icons/deskflow-dark/actions/22/window-restore-pip.svg</file>
<file>icons/deskflow-dark/actions/24/configure.svg</file>
<file>icons/deskflow-dark/actions/24/edit-copy.svg</file>
<file>icons/deskflow-dark/actions/24/document-edit.svg</file>
@ -38,7 +44,10 @@
<file>icons/deskflow-dark/actions/24/process-stop.svg</file>
<file>icons/deskflow-dark/actions/24/system-run.svg</file>
<file>icons/deskflow-dark/actions/24/tools-report-bug.svg</file>
<file>icons/deskflow-dark/actions/24/view-close.svg</file>
<file>icons/deskflow-dark/actions/24/view-refresh.svg</file>
<file>icons/deskflow-dark/actions/24/window-minimize-pip.svg</file>
<file>icons/deskflow-dark/actions/24/window-restore-pip.svg</file>
<file>icons/deskflow-dark/actions/32/configure.svg</file>
<file>icons/deskflow-dark/actions/32/application-exit.svg</file>
<file>icons/deskflow-dark/actions/32/dialog-cancel.svg</file>
@ -74,7 +83,10 @@
<file>icons/deskflow-light/actions/16/process-stop.svg</file>
<file>icons/deskflow-light/actions/16/system-run.svg</file>
<file>icons/deskflow-light/actions/16/tools-report-bug.svg</file>
<file>icons/deskflow-light/actions/16/view-close.svg</file>
<file>icons/deskflow-light/actions/16/view-refresh.svg</file>
<file>icons/deskflow-light/actions/16/window-minimize-pip.svg</file>
<file>icons/deskflow-light/actions/16/window-restore-pip.svg</file>
<file>icons/deskflow-light/actions/22/configure.svg</file>
<file>icons/deskflow-light/actions/22/edit-clear-all.svg</file>
<file>icons/deskflow-light/actions/22/edit-copy.svg</file>
@ -88,7 +100,10 @@
<file>icons/deskflow-light/actions/22/process-stop.svg</file>
<file>icons/deskflow-light/actions/22/system-run.svg</file>
<file>icons/deskflow-light/actions/22/tools-report-bug.svg</file>
<file>icons/deskflow-light/actions/22/view-close.svg</file>
<file>icons/deskflow-light/actions/22/view-refresh.svg</file>
<file>icons/deskflow-light/actions/22/window-minimize-pip.svg</file>
<file>icons/deskflow-light/actions/22/window-restore-pip.svg</file>
<file>icons/deskflow-light/actions/24/configure.svg</file>
<file>icons/deskflow-light/actions/24/edit-clear-all.svg</file>
<file>icons/deskflow-light/actions/24/edit-copy.svg</file>
@ -102,7 +117,10 @@
<file>icons/deskflow-light/actions/24/process-stop.svg</file>
<file>icons/deskflow-light/actions/24/system-run.svg</file>
<file>icons/deskflow-light/actions/24/tools-report-bug.svg</file>
<file>icons/deskflow-light/actions/24/view-close.svg</file>
<file>icons/deskflow-light/actions/24/view-refresh.svg</file>
<file>icons/deskflow-light/actions/24/window-minimize-pip.svg</file>
<file>icons/deskflow-light/actions/24/window-restore-pip.svg</file>
<file>icons/deskflow-light/actions/32/configure.svg</file>
<file>icons/deskflow-light/actions/32/application-exit.svg</file>
<file>icons/deskflow-light/actions/32/dialog-cancel.svg</file>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">.ColorScheme-NegativeText { color: #da4453; } .ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="m2 2v12h12v-12h-12m1 2h10v9h-10v-9" class="ColorScheme-Text"/>
<path d="m6.2 6l-.707.707 1.793 1.793-1.793 1.793.707.707 1.793-1.793 1.793 1.793.707-.707-1.793-1.793 1.793-1.793-.707-.707-1.793 1.793" style="fill:currentColor;fill-opacity:1;stroke:none" class="ColorScheme-NegativeText"/>
</svg>

After

Width:  |  Height:  |  Size: 639 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path class="ColorScheme-Text" d="m2 2v12h6v-1h-5v-9h10v4h1v-6zm7 7v6h6v-6zm1 2h4v3h-4z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m7.9999465 5.0002137-0.999893 2e-7v1.3423975l1e-6 0.9501754-2.8926898-2.882958-0.707107 0.7071067 2.8887423 2.8831185-0.9501364-7e-7 -1.3390969 7e-7 4.666e-4 0.9998928h1.3386313l2.6606688 5.32e-5 4.131e-4 -2.6573881z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 641 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path class="ColorScheme-Text" d="m2 2v12h6v-1h-5v-9h10v4h1v-6zm7 7v6h6v-6zm1 2h4v3h-4z" fill="currentColor"/>
<path class="ColorScheme-Text" d="M 4,8.999786 H 4.9999606 V 7.657389 L 4.9999596,6.707213 7.8928452,9.590171 8.6,8.883065 5.7110623,5.999946 l 0.9502006,1e-6 1.3391875,-1e-6 -4.666e-4,-0.999893 H 6.6612619 L 4.0004131,5 4,7.657388 Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 624 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">.ColorScheme-Accent { color: #3daee9; } .ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 3 3 L 3 19 L 19 19 L 19 3 L 3 3 z M 4 7 L 18 7 L 18 18 L 4 18 L 4 7 z " class="ColorScheme-Text"/>
<path style="fill:#da4453;fill-opacity:1;stroke:none" d="M 8.7070312 9 L 8 9.7070312 L 10.292969 12 L 8 14.292969 L 8.7070312 15 L 11 12.707031 L 13.292969 15 L 14 14.292969 L 11.707031 12 L 14 9.7070312 L 13.292969 9 L 11 11.292969 L 8.7070312 9 z "/>
</svg>

After

Width:  |  Height:  |  Size: 698 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path class="ColorScheme-Text" d="m9.93907 8.0718026-0.999892 2e-7v3.2427472l-3.0355875-3.035587-0.707107 0.7071068 3.0355875 3.0355872h-3.2427475v0.999893h4.9497465v-0.292787z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 581 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<path class="ColorScheme-Text" d="M 5,12.949747 H 5.999892 V 9.707 L 9.03548,12.742587 9.7425869,12.03548 6.706999,8.999893 H 9.9497469 V 8 H 5 v 0.292787 z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 561 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">.ColorScheme-Accent { color: #3daee9; } .ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<g transform="translate(1,1)">
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 3 3 L 3 19 L 19 19 L 19 3 L 3 3 z M 4 7 L 18 7 L 18 18 L 4 18 L 4 7 z " class="ColorScheme-Text"/>
<path style="fill:#da4453;fill-opacity:1;stroke:none" d="M 8.7070312 9 L 8 9.7070312 L 10.292969 12 L 8 14.292969 L 8.7070312 15 L 11 12.707031 L 13.292969 15 L 14 14.292969 L 11.707031 12 L 14 9.7070312 L 13.292969 9 L 11 11.292969 L 8.7070312 9 z "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 728 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24" width="24" height="24">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<g transform="translate(1,1)">
<path class="ColorScheme-Text" d="m9.93907 8.0718026-0.999892 2e-7v3.2427472l-3.0355875-3.035587-0.707107 0.7071068 3.0355875 3.0355872h-3.2427475v0.999893h4.9497465v-0.292787z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 597 B

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24" width="24" height="24">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color: #fcfcfc; } </style>
</defs>
<g transform="translate(1,1)">
<path class="ColorScheme-Text" d="M 5,12.949747 H 5.999892 V 9.707 L 9.03548,12.742587 9.7425869,12.03548 6.706999,8.999893 H 9.9497469 V 8 H 5 v 0.292787 z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 577 B

View File

@ -0,0 +1,21 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
.ColorScheme-NegativeText {
color:#da4453;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m2 2v12h12v-12h-12m1 2h10v9h-10v-9"
class="ColorScheme-Text"/>
<path
d="m6.2 6l-.707.707 1.793 1.793-1.793 1.793.707.707 1.793-1.793 1.793 1.793.707-.707-1.793-1.793 1.793-1.793-.707-.707-1.793 1.793"
style="fill:currentColor;fill-opacity:1;stroke:none"
class="ColorScheme-NegativeText"
/>
</svg>

After

Width:  |  Height:  |  Size: 686 B

View File

@ -0,0 +1,9 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<path class="ColorScheme-Text" d="m2 2v12h6v-1h-5v-9h10v4h1v-6zm7 7v6h6v-6zm1 2h4v3h-4z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m7.9999465 5.0002137-0.999893 2e-7v1.3423975l1e-6 0.9501754-2.8926898-2.882958-0.707107 0.7071067 2.8887423 2.8831185-0.9501364-7e-7 -1.3390969 7e-7 4.666e-4 0.9998928h1.3386313l2.6606688 5.32e-5 4.131e-4 -2.6573881z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 614 B

View File

@ -0,0 +1,9 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<path class="ColorScheme-Text" d="m2 2v12h6v-1h-5v-9h10v4h1v-6zm7 7v6h6v-6zm1 2h4v3h-4z" fill="currentColor"/>
<path class="ColorScheme-Text" d="M 4,8.999786 H 4.9999606 V 7.657389 L 4.9999596,6.707213 7.8928452,9.590171 8.6,8.883065 5.7110623,5.999946 l 0.9502006,1e-6 1.3391875,-1e-6 -4.666e-4,-0.999893 H 6.6612619 L 4.0004131,5 4,7.657388 Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 597 B

View File

@ -0,0 +1,21 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
.ColorScheme-Accent {
color:#3daee9;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 3 3 L 3 19 L 19 19 L 19 3 L 3 3 z M 4 7 L 18 7 L 18 18 L 4 18 L 4 7 z "
class="ColorScheme-Text"
/>
<path
style="fill:#da4453;fill-opacity:1;stroke:none"
d="M 8.7070312 9 L 8 9.7070312 L 10.292969 12 L 8 14.292969 L 8.7070312 15 L 11 12.707031 L 13.292969 15 L 14 14.292969 L 11.707031 12 L 14 9.7070312 L 13.292969 9 L 11 11.292969 L 8.7070312 9 z "
/>
</svg>

After

Width:  |  Height:  |  Size: 745 B

View File

@ -0,0 +1,9 @@
<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<path class="ColorScheme-Text" d="m9.93907 8.0718026-0.999892 2e-7v3.2427472l-3.0355875-3.035587-0.707107 0.7071068 3.0355875 3.0355872h-3.2427475v0.999893h4.9497465v-0.292787z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 554 B

View File

@ -0,0 +1,9 @@
<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<path class="ColorScheme-Text" d="M 5,12.949747 H 5.999892 V 9.707 L 9.03548,12.742587 9.7425869,12.03548 6.706999,8.999893 H 9.9497469 V 8 H 5 v 0.292787 z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 534 B

View File

@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
.ColorScheme-Accent {
color:#3daee9;
}
</style>
</defs>
<g transform="translate(1,1)">
<path style="fill:currentColor;fill-opacity:1;stroke:none" d="M 3 3 L 3 19 L 19 19 L 19 3 L 3 3 z M 4 7 L 18 7 L 18 18 L 4 18 L 4 7 z " class="ColorScheme-Text"/>
<path style="fill:#da4453;fill-opacity:1;stroke:none" d="M 8.7070312 9 L 8 9.7070312 L 10.292969 12 L 8 14.292969 L 8.7070312 15 L 11 12.707031 L 13.292969 15 L 14 14.292969 L 11.707031 12 L 14 9.7070312 L 13.292969 9 L 11 11.292969 L 8.7070312 9 z "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 773 B

View File

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24" width="24" height="24">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<g transform="translate(1,1)">
<path class="ColorScheme-Text" d="m9.93907 8.0718026-0.999892 2e-7v3.2427472l-3.0355875-3.035587-0.707107 0.7071068 3.0355875 3.0355872h-3.2427475v0.999893h4.9497465v-0.292787z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 609 B

View File

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24" width="24" height="24">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#232629;
}</style>
</defs>
<g transform="translate(1,1)">
<path class="ColorScheme-Text" d="M 5,12.949747 H 5.999892 V 9.707 L 9.03548,12.742587 9.7425869,12.03548 6.706999,8.999893 H 9.9497469 V 8 H 5 v 0.292787 z" fill="currentColor"/>
<path class="ColorScheme-Text" d="m3 3v16h8v-1h-7v-11h14v4h1v-8h-1zm9 9v4-1 5h8v-8h-3zm1 3h6v4h-6v-5z" fill="currentColor"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 589 B

View File

@ -114,6 +114,8 @@ add_library(${target} STATIC
widgets/FingerprintPreview.h
widgets/KeySequenceWidget.cpp
widgets/KeySequenceWidget.h
widgets/LogDock.cpp
widgets/LogDock.h
widgets/LogWidget.h
widgets/LogWidget.cpp
widgets/NewScreenWidget.cpp

View File

@ -25,7 +25,7 @@
#include "gui/Styles.h"
#include "gui/core/CoreProcess.h"
#include "gui/ipc/DaemonIpcClient.h"
#include "gui/widgets/LogWidget.h"
#include "gui/widgets/LogDock.h"
#include "net/FingerprintDatabase.h"
#include "platform/Wayland.h"
@ -71,7 +71,7 @@ MainWindow::MainWindow()
m_trayIcon{new QSystemTrayIcon(this)},
m_guiDupeChecker{new QLocalServer(this)},
m_daemonIpcClient{new ipc::DaemonIpcClient(this)},
m_logWidget{new LogWidget(this)},
m_logDock{new LogDock(this)},
m_lblSecurityStatus{new QLabel(this)},
m_lblStatus{new QLabel(this)},
m_btnFingerprint{new QToolButton(this)},
@ -92,9 +92,7 @@ MainWindow::MainWindow()
setWindowIcon(QIcon::fromTheme(QStringLiteral("deskflow")));
auto dockLayout = new QVBoxLayout();
dockLayout->addWidget(m_logWidget);
ui->dockLogContents->setLayout(dockLayout);
addDockWidget(Qt::BottomDockWidgetArea, m_logDock);
// Setup Actions
m_actionAbout->setText(tr("About %1...").arg(kAppName));
@ -211,7 +209,7 @@ void MainWindow::setupControls()
}
if (!Settings::value(Settings::Gui::LogExpanded).toBool()) {
ui->dockLog->hide();
m_logDock->hide();
}
ui->serverOptions->setVisible(false);
@ -327,7 +325,7 @@ void MainWindow::connectSlots()
connect(ui->rbModeServer, &QRadioButton::toggled, this, &MainWindow::coreModeToggled);
connect(ui->rbModeClient, &QRadioButton::toggled, this, &MainWindow::coreModeToggled);
connect(ui->dockLog->toggleViewAction(), &QAction::toggled, this, &MainWindow::toggleLogVisible);
connect(m_logDock->toggleViewAction(), &QAction::toggled, this, &MainWindow::toggleLogVisible);
connect(m_btnUpdate, &QPushButton::clicked, this, &MainWindow::openGetNewVersionUrl);
@ -350,11 +348,20 @@ void MainWindow::toggleLogVisible(bool visible)
setFixedSize(16777215, 16777215);
Settings::setValue(Settings::Gui::LogExpanded, visible);
if (visible) {
setGeometry(x(), y(), m_expandedSize.width(), m_expandedSize.height());
if (m_logDock->isFloating()) {
adjustSize();
setFixedSize(size());
} else {
QTimer::singleShot(15, this, [&] { resize(m_expandedSize); });
}
} else {
m_expandedSize = geometry().size();
ui->dockLog->hide();
adjustSize();
if (!m_logDock->isFloating()) {
m_expandedSize = geometry().size();
}
m_logDock->hide();
if (!m_logDock->isFloating()) {
adjustSize();
}
setFixedSize(size());
}
Settings::setValue(Settings::Gui::WindowGeometry, geometry());
@ -705,7 +712,7 @@ void MainWindow::createMenuBar()
menuEdit->addAction(m_actionSettings);
auto menuView = new QMenu(tr("&View"), this);
menuView->addAction(ui->dockLog->toggleViewAction());
menuView->addAction(m_logDock->toggleViewAction());
auto menuHelp = new QMenu(tr("&Help"), this);
menuHelp->addAction(m_actionAbout);
@ -785,7 +792,7 @@ void MainWindow::setIcon()
void MainWindow::handleLogLine(const QString &line)
{
m_logWidget->appendLine(line);
m_logDock->appendLine(line);
updateFromLogLine(line);
}
@ -882,7 +889,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
// any connected dock view acitons will be triggered
// disconnect them before accepting the event
disconnect(ui->dockLog->toggleViewAction(), &QAction::toggled, nullptr, nullptr);
disconnect(m_logDock->toggleViewAction(), &QAction::toggled, nullptr, nullptr);
event->accept();
QApplication::quit();

View File

@ -46,7 +46,7 @@ class QAbstractButton;
class QLocalServer;
class DeskflowApplication;
class LogWidget;
class LogDock;
namespace Ui {
class MainWindow;
@ -185,7 +185,7 @@ private:
QLocalServer *m_guiDupeChecker = nullptr;
deskflow::gui::ipc::DaemonIpcClient *m_daemonIpcClient = nullptr;
LogWidget *m_logWidget = nullptr;
LogDock *m_logDock;
QLabel *m_lblSecurityStatus = nullptr;
QLabel *m_lblStatus = nullptr;
QToolButton *m_btnFingerprint = nullptr;

View File

@ -2,14 +2,6 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>305</height>
</rect>
</property>
<property name="windowTitle">
<string>Deskflow</string>
</property>
@ -468,21 +460,6 @@
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="dockLog">
<property name="features">
<set>QDockWidget::DockWidgetFeature::DockWidgetClosable</set>
</property>
<property name="allowedAreas">
<set>Qt::DockWidgetArea::BottomDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Log</string>
</property>
<attribute name="dockWidgetArea">
<number>8</number>
</attribute>
<widget class="QWidget" name="dockLogContents"/>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -0,0 +1,85 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "LogDock.h"
#include "LogWidget.h"
#include "gui/Styles.h"
#include <QEvent>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QVBoxLayout>
LogDock::LogDock(QWidget *parent)
: QDockWidget(tr("Log"), parent),
m_textLog{new LogWidget(this)},
m_btnClose{new QToolButton(this)},
m_btnFloat{new QToolButton(this)},
m_lblTitle{new QLabel(tr("Log"), this)}
{
const auto iconSize = QSize(fontMetrics().height() - 2, fontMetrics().height() - 2);
m_btnFloat->setStyleSheet(deskflow::gui::kStyleFlatButtonHoverable);
m_btnFloat->setCheckable(true);
m_btnFloat->setIcon(QIcon::fromTheme(QStringLiteral("window-minimize-pip")));
m_btnFloat->setIconSize(iconSize);
m_btnFloat->setToolTip(tr("Detach from window"));
connect(m_btnFloat, &QToolButton::toggled, this, &LogDock::setFloating);
m_btnClose->setStyleSheet(deskflow::gui::kStyleFlatButtonHoverable);
m_btnClose->setIcon(QIcon::fromTheme(QStringLiteral("view-close")));
m_btnClose->setIconSize(iconSize);
m_btnClose->setToolTip(tr("Close Log"));
connect(m_btnClose, &QToolButton::clicked, this, &QDockWidget::hide);
auto titleWidget = new QWidget(this);
titleWidget->installEventFilter(this);
auto titleLayout = new QHBoxLayout(titleWidget);
titleLayout->addWidget(m_lblTitle, Qt::AlignLeft | Qt::AlignVCenter);
titleLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
titleLayout->addWidget(m_btnFloat, Qt::AlignRight | Qt::AlignVCenter);
titleLayout->addWidget(m_btnClose, Qt::AlignRight | Qt::AlignVCenter);
setTitleBarWidget(titleWidget);
auto bodyWidget = new QWidget(this);
auto bodyLayout = new QVBoxLayout(bodyWidget);
bodyLayout->addWidget(m_textLog);
setWidget(bodyWidget);
setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
setAllowedAreas(Qt::BottomDockWidgetArea);
}
void LogDock::appendLine(const QString &msg)
{
m_textLog->appendLine(msg);
}
void LogDock::setFloating(bool floating)
{
if (floating) {
m_btnFloat->setToolTip(tr("Attach to window"));
m_btnFloat->setIcon(QIcon::fromTheme(QStringLiteral("window-restore-pip")));
setWindowFlags(Qt::Dialog);
} else {
m_btnFloat->setToolTip(tr("Detach from window"));
m_btnFloat->setIcon(QIcon::fromTheme(QStringLiteral("window-minimize-pip")));
setWindowFlags(Qt::Widget);
}
m_lblTitle->setVisible(!floating);
m_btnClose->setVisible(!floating);
show();
}
bool LogDock::eventFilter(QObject *watched, QEvent *event)
{
// Filter out doubleclick on the titlebar, we only want the dock to float if the user users the button on the dock
if (watched == titleBarWidget() && event->type() == QEvent::MouseButtonDblClick)
return true;
return false;
}

View File

@ -0,0 +1,31 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
#include <QDockWidget>
class LogWidget;
class QLabel;
class QToolButton;
class LogDock : public QDockWidget
{
Q_OBJECT
public:
explicit LogDock(QWidget *parent = nullptr);
void appendLine(const QString &msg);
void setFloating(bool floating);
protected:
bool eventFilter(QObject *watched, QEvent *event);
private:
LogWidget *m_textLog = nullptr;
QToolButton *m_btnClose = nullptr;
QToolButton *m_btnFloat = nullptr;
QLabel *m_lblTitle = nullptr;
};