Repository: theCheeseboard/thedesk
Branch: master
Commit: 5c8c5d85e967
Files: 1428
Total size: 16.4 MB
Directory structure:
gitextract_ocparz4t/
├── .gitignore
├── .parlance.json
├── CMakeLists.txt
├── LICENSE
├── README.md
├── desktop/
│ ├── CMakeLists.txt
│ ├── acknowledgements.html
│ ├── background/
│ │ ├── background.cpp
│ │ ├── background.h
│ │ └── background.ui
│ ├── bar/
│ │ ├── barwindow.cpp
│ │ ├── barwindow.h
│ │ ├── barwindow.ui
│ │ ├── chunkcontainer.cpp
│ │ ├── chunkcontainer.h
│ │ ├── chunkcontainer.ui
│ │ ├── currentappwidget.cpp
│ │ ├── currentappwidget.h
│ │ ├── currentappwidget.ui
│ │ ├── currentappwidgetmenu.cpp
│ │ ├── currentappwidgetmenu.h
│ │ ├── currentappwidgetmenu.ui
│ │ ├── mainbarwidget.cpp
│ │ ├── mainbarwidget.h
│ │ ├── mainbarwidget.ui
│ │ ├── taskbarapplicationwidget.cpp
│ │ ├── taskbarapplicationwidget.h
│ │ ├── taskbardesktopwidget.cpp
│ │ ├── taskbardesktopwidget.h
│ │ ├── taskbardesktopwidget.ui
│ │ ├── taskbarwidget.cpp
│ │ ├── taskbarwidget.h
│ │ └── taskbarwidget.ui
│ ├── cli/
│ │ ├── commandline.cpp
│ │ └── commandline.h
│ ├── common/
│ │ ├── common.cpp
│ │ └── common.h
│ ├── crash/
│ │ ├── crashhandling.cpp
│ │ └── crashhandling.h
│ ├── desktop.pro
│ ├── gateway/
│ │ ├── appsearchprovider.cpp
│ │ ├── appsearchprovider.h
│ │ ├── appselectionmodel.cpp
│ │ ├── appselectionmodel.h
│ │ ├── appselectionmodellistdelegate.cpp
│ │ ├── appselectionmodellistdelegate.h
│ │ ├── gateway.cpp
│ │ ├── gateway.h
│ │ ├── gateway.ui
│ │ ├── gatewaysearchmodel.cpp
│ │ ├── gatewaysearchmodel.h
│ │ ├── gatewaysearchmodeldelegate.cpp
│ │ ├── gatewaysearchmodeldelegate.h
│ │ ├── maingatewaywidget.cpp
│ │ ├── maingatewaywidget.h
│ │ ├── maingatewaywidget.ui
│ │ ├── searchresultswidget.cpp
│ │ ├── searchresultswidget.h
│ │ └── searchresultswidget.ui
│ ├── main.cpp
│ ├── media/
│ │ ├── intro.ogg
│ │ ├── loop.ogg
│ │ ├── welcome1.webm
│ │ ├── welcome2.webm
│ │ └── welcome3.webm
│ ├── resources.qrc
│ ├── run/
│ │ ├── rundialog.cpp
│ │ ├── rundialog.h
│ │ └── rundialog.ui
│ ├── session/
│ │ ├── endsession.cpp
│ │ ├── endsession.h
│ │ ├── endsession.ui
│ │ ├── endsessionbutton.cpp
│ │ └── endsessionbutton.h
│ ├── statuscenter/
│ │ ├── leftpanedelegate.cpp
│ │ ├── leftpanedelegate.h
│ │ ├── statuscenter.cpp
│ │ ├── statuscenter.h
│ │ ├── statuscenter.ui
│ │ ├── statuscenterleftpane.cpp
│ │ ├── statuscenterleftpane.h
│ │ ├── statuscenterleftpane.ui
│ │ ├── statuscenterquickswitch.cpp
│ │ ├── statuscenterquickswitch.h
│ │ └── statuscenterquickswitch.ui
│ ├── systemsettings/
│ │ ├── about/
│ │ │ ├── about.cpp
│ │ │ ├── about.h
│ │ │ ├── about.ui
│ │ │ ├── acknowledgements.cpp
│ │ │ ├── acknowledgements.h
│ │ │ ├── acknowledgements.ui
│ │ │ ├── changehostnamepopover.cpp
│ │ │ ├── changehostnamepopover.h
│ │ │ └── changehostnamepopover.ui
│ │ ├── pluginmanagement/
│ │ │ ├── managepluginpopover.cpp
│ │ │ ├── managepluginpopover.h
│ │ │ ├── managepluginpopover.ui
│ │ │ ├── pluginitemdelegate.cpp
│ │ │ ├── pluginitemdelegate.h
│ │ │ ├── pluginmanagement.cpp
│ │ │ ├── pluginmanagement.h
│ │ │ ├── pluginmanagement.ui
│ │ │ ├── pluginmodel.cpp
│ │ │ └── pluginmodel.h
│ │ ├── recovery/
│ │ │ ├── recovery.cpp
│ │ │ ├── recovery.h
│ │ │ └── recovery.ui
│ │ ├── systemsettings.cpp
│ │ ├── systemsettings.h
│ │ ├── systemsettings.ui
│ │ ├── systemsettingsleftpane.cpp
│ │ ├── systemsettingsleftpane.h
│ │ └── systemsettingsleftpane.ui
│ ├── thedesk.conf
│ └── translations/
│ ├── ar_SA.ts
│ ├── au_AU.qm
│ ├── au_AU.ts
│ ├── cy.qm
│ ├── cy.ts
│ ├── da.qm
│ ├── da.ts
│ ├── de.qm
│ ├── de.ts
│ ├── en_AU.qm
│ ├── en_AU.ts
│ ├── en_CA.qm
│ ├── en_CA.ts
│ ├── en_GB.qm
│ ├── en_GB.ts
│ ├── en_NZ.qm
│ ├── en_NZ.ts
│ ├── en_US.qm
│ ├── en_US.ts
│ ├── es.ts
│ ├── es_VE.ts
│ ├── fr_FR.qm
│ ├── fr_FR.ts
│ ├── id_ID.qm
│ ├── id_ID.ts
│ ├── ja.qm
│ ├── ja.ts
│ ├── nl.qm
│ ├── nl.ts
│ ├── pl_PL.qm
│ ├── pl_PL.ts
│ ├── pt_BR.qm
│ ├── pt_BR.ts
│ ├── ro_RO.qm
│ ├── ro_RO.ts
│ ├── sv.qm
│ ├── sv.ts
│ ├── tr_TR.qm
│ ├── tr_TR.ts
│ ├── vi_VN.qm
│ ├── vi_VN.ts
│ ├── zh_CN.qm
│ └── zh_CN.ts
├── desktop-portal/
│ ├── CMakeLists.txt
│ ├── backend/
│ │ ├── abstractportalbackend.cpp
│ │ ├── abstractportalbackend.h
│ │ ├── private/
│ │ │ ├── waylandportalscreencopyframe.cpp
│ │ │ └── waylandportalscreencopyframe.h
│ │ ├── waylandportalbackend.cpp
│ │ ├── waylandportalbackend.h
│ │ ├── wlr-screencopy-unstable-v1.xml
│ │ ├── x11portalbackend.cpp
│ │ └── x11portalbackend.h
│ ├── desktop-portal.pro
│ ├── dialogs/
│ │ ├── accessdialog.cpp
│ │ ├── accessdialog.h
│ │ ├── accessdialog.ui
│ │ ├── accountdialog.cpp
│ │ ├── accountdialog.h
│ │ ├── accountdialog.ui
│ │ ├── filedialog.cpp
│ │ ├── filedialog.h
│ │ ├── filedialog.ui
│ │ ├── penbutton.cpp
│ │ ├── penbutton.h
│ │ ├── screenshotwindow.cpp
│ │ ├── screenshotwindow.h
│ │ └── screenshotwindow.ui
│ ├── interfaces/
│ │ ├── accessinterface.cpp
│ │ ├── accessinterface.h
│ │ ├── accountinterface.cpp
│ │ ├── accountinterface.h
│ │ ├── filechooserinterface.cpp
│ │ ├── filechooserinterface.h
│ │ ├── notificationinterface.cpp
│ │ ├── notificationinterface.h
│ │ ├── screenshotinterface.cpp
│ │ ├── screenshotinterface.h
│ │ ├── settingsinterface.cpp
│ │ └── settingsinterface.h
│ ├── main.cpp
│ ├── org.freedesktop.impl.portal.desktop.thedesk.service.in
│ ├── portalcommon.cpp
│ ├── portalcommon.h
│ ├── portalhandle.cpp
│ ├── portalhandle.h
│ ├── screenshot_resources.qrc
│ ├── screenshotmanager.cpp
│ ├── screenshotmanager.h
│ ├── thedesk-portals.conf
│ ├── thedesk.portal
│ ├── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── vi.qm
│ │ └── vi.ts
│ └── xdg-desktop-portal-thedesk.service.in
├── dist/
│ ├── thedesk-blueprint.spec
│ └── thedesk.spec
├── libthedesk/
│ ├── CMakeLists.txt
│ ├── actionquickwidget.cpp
│ ├── actionquickwidget.h
│ ├── actionquickwidget.ui
│ ├── barmanager.cpp
│ ├── barmanager.h
│ ├── chunk.cpp
│ ├── chunk.h
│ ├── common.cpp
│ ├── common.h
│ ├── gatewaymanager.cpp
│ ├── gatewaymanager.h
│ ├── gatewaysearchprovider.cpp
│ ├── gatewaysearchprovider.h
│ ├── hudmanager.cpp
│ ├── hudmanager.h
│ ├── icontextchunk.cpp
│ ├── icontextchunk.h
│ ├── icontextchunk.ui
│ ├── keygrab.cpp
│ ├── keygrab.h
│ ├── libthedesk.pro
│ ├── libthedeskConfig.cmake.in
│ ├── libthedesk_global.h
│ ├── libthedesk_resources.qrc
│ ├── localemanager.cpp
│ ├── localemanager.h
│ ├── onboarding/
│ │ ├── OnboardingVideoForm.qml
│ │ ├── onboarding.cpp
│ │ ├── onboarding.h
│ │ ├── onboarding.ui
│ │ ├── onboardingbar.cpp
│ │ ├── onboardingbar.h
│ │ ├── onboardingbar.ui
│ │ ├── onboardingbetathankyou.cpp
│ │ ├── onboardingbetathankyou.h
│ │ ├── onboardingbetathankyou.ui
│ │ ├── onboardingcontroller.cpp
│ │ ├── onboardingcontroller.h
│ │ ├── onboardingfinal.cpp
│ │ ├── onboardingfinal.h
│ │ ├── onboardingfinal.ui
│ │ ├── onboardingstepper.cpp
│ │ ├── onboardingstepper.h
│ │ ├── onboardingvideo.cpp
│ │ ├── onboardingvideo.h
│ │ ├── onboardingvideo.ui
│ │ ├── onboardingwelcome.cpp
│ │ ├── onboardingwelcome.h
│ │ └── onboardingwelcome.ui
│ ├── onboardingmanager.cpp
│ ├── onboardingmanager.h
│ ├── onboardingpage.cpp
│ ├── onboardingpage.h
│ ├── plugins/
│ │ ├── plugininterface.h
│ │ ├── pluginmanager.cpp
│ │ └── pluginmanager.h
│ ├── powermanager.cpp
│ ├── powermanager.h
│ ├── private/
│ │ ├── keyboardlayoutmodel.cpp
│ │ ├── keyboardlayoutmodel.h
│ │ ├── keyboardlayoutselector.cpp
│ │ ├── keyboardlayoutselector.h
│ │ ├── keyboardlayoutselector.ui
│ │ ├── localeselector.cpp
│ │ ├── localeselector.h
│ │ ├── localeselector.ui
│ │ ├── onboardingmanager_p.h
│ │ ├── quickwidgetcontainer.cpp
│ │ ├── quickwidgetcontainer.h
│ │ └── quickwidgetcontainer.ui
│ ├── quickswitch.cpp
│ ├── quickswitch.h
│ ├── quietmodemanager.cpp
│ ├── quietmodemanager.h
│ ├── server/
│ │ ├── sessionserver.cpp
│ │ └── sessionserver.h
│ ├── statemanager.cpp
│ ├── statemanager.h
│ ├── statuscentermanager.cpp
│ ├── statuscentermanager.h
│ ├── statuscenterpane.cpp
│ ├── statuscenterpane.h
│ ├── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cs_CZ.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pl_PL.qm
│ │ ├── pl_PL.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sl_SI.qm
│ │ ├── sl_SI.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── transparentdialog.cpp
│ ├── transparentdialog.h
│ └── transparentdialog.ui
├── locker/
│ ├── CMakeLists.txt
│ ├── locker-checker/
│ │ ├── CMakeLists.txt
│ │ └── main.cpp
│ ├── locker-common/
│ │ ├── CMakeLists.txt
│ │ ├── lockergrabs.cpp
│ │ └── lockergrabs.h
│ └── locker-ui/
│ ├── CMakeLists.txt
│ ├── lockmanager.cpp
│ ├── lockmanager.h
│ ├── main.cpp
│ ├── mainwindow.cpp
│ ├── mainwindow.h
│ ├── mainwindow.ui
│ ├── translations/
│ │ └── en_US.ts
│ ├── underlineanimation.cpp
│ └── underlineanimation.h
├── platform/
│ ├── CMakeLists.txt
│ ├── cursorhandler.cpp
│ ├── cursorhandler.h
│ ├── fontformat.cpp
│ ├── fontformat.h
│ ├── iconloaderengine.cpp
│ ├── iconloaderengine.h
│ ├── messagedialog/
│ │ ├── messagedialog.cpp
│ │ ├── messagedialog.h
│ │ ├── messagedialog.ui
│ │ ├── messagedialogcontroller.cpp
│ │ ├── messagedialogcontroller.h
│ │ ├── messagedialoghelper.cpp
│ │ └── messagedialoghelper.h
│ ├── paletteformat.cpp
│ ├── paletteformat.h
│ ├── palettes.json
│ ├── platform.pro
│ ├── platformtheme.cpp
│ ├── platformtheme.h
│ ├── plugin.cpp
│ ├── plugin.h
│ ├── plugin.json
│ ├── psAMLQ.json
│ ├── thedesk-platform-resources.qrc
│ ├── thedesk-platform.conf
│ └── translations/
│ ├── ar_SA.ts
│ ├── au_AU.qm
│ ├── au_AU.ts
│ ├── cy.qm
│ ├── cy.ts
│ ├── da.qm
│ ├── da.ts
│ ├── de.qm
│ ├── de.ts
│ ├── en_GB.qm
│ ├── en_GB.ts
│ ├── en_US.qm
│ ├── en_US.ts
│ ├── es.ts
│ ├── es_VE.ts
│ ├── id.ts
│ ├── nl.qm
│ ├── nl.ts
│ ├── pt_BR.qm
│ ├── pt_BR.ts
│ ├── ro_RO.qm
│ ├── ro_RO.ts
│ ├── sv.qm
│ ├── sv.ts
│ ├── tr_TR.qm
│ ├── tr_TR.ts
│ ├── vi.qm
│ ├── vi.ts
│ └── vi_VN.ts
├── plugins/
│ ├── AccessibilityPlugin/
│ │ ├── AccessibilityPlugin.pro
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── accessibilitydaemon.cpp
│ │ ├── accessibilitydaemon.h
│ │ ├── chunks/
│ │ │ ├── stickykeyschunk.cpp
│ │ │ └── stickykeyschunk.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── accessibilitysettingspane.cpp
│ │ │ ├── accessibilitysettingspane.h
│ │ │ └── accessibilitysettingspane.ui
│ │ ├── thedesk-accessibility.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── ja.qm
│ │ ├── ja.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr.qm
│ │ ├── tr.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ └── vi_VN.ts
│ ├── AudioPlugin/
│ │ ├── AudioPlugin.pro
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── audiochunk.cpp
│ │ ├── audiochunk.h
│ │ ├── audioquickwidget.cpp
│ │ ├── audioquickwidget.h
│ │ ├── audioquickwidget.ui
│ │ ├── common.cpp
│ │ ├── common.h
│ │ ├── eventhandler.cpp
│ │ ├── eventhandler.h
│ │ ├── micchunk.cpp
│ │ ├── micchunk.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── quickwidgetsink.cpp
│ │ ├── quickwidgetsink.h
│ │ ├── quickwidgetsink.ui
│ │ ├── quickwidgetsinkinput.cpp
│ │ ├── quickwidgetsinkinput.h
│ │ ├── quickwidgetsinkinput.ui
│ │ ├── thedesk-audio.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── ja.qm
│ │ ├── ja.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ ├── zh_CN.ts
│ │ ├── zu_ZA.qm
│ │ └── zu_ZA.ts
│ ├── BluetoothPlugin/
│ │ ├── BluetoothPlugin.pro
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── bluetoothplugincommon.cpp
│ │ ├── bluetoothplugincommon.h
│ │ ├── btagent.cpp
│ │ ├── btagent.h
│ │ ├── btobex.cpp
│ │ ├── btobex.h
│ │ ├── chunk/
│ │ │ ├── bluetoothchunk.cpp
│ │ │ └── bluetoothchunk.h
│ │ ├── defaults.json
│ │ ├── devicedelegate.cpp
│ │ ├── devicedelegate.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── bluetoothsettingspane.cpp
│ │ │ ├── bluetoothsettingspane.h
│ │ │ ├── bluetoothsettingspane.ui
│ │ │ ├── devicepopover.cpp
│ │ │ ├── devicepopover.h
│ │ │ ├── devicepopover.ui
│ │ │ ├── pairpopover.cpp
│ │ │ ├── pairpopover.h
│ │ │ └── pairpopover.ui
│ │ ├── thedesk-bluetooth.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr.qm
│ │ ├── tr.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ └── vi_VN.ts
│ ├── BrightnessPlugin/
│ │ ├── BrightnessPlugin.pro
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── screenbrightnesschunk.cpp
│ │ ├── screenbrightnesschunk.h
│ │ ├── screenbrightnesschunk.ui
│ │ ├── thedesk-brightness.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id_ID.qm
│ │ ├── id_ID.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pl_PL.qm
│ │ ├── pl_PL.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sk_SK.qm
│ │ ├── sk_SK.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ ├── zh_CN.ts
│ │ ├── zh_SG.qm
│ │ ├── zh_SG.ts
│ │ ├── zu_ZA.qm
│ │ └── zu_ZA.ts
│ ├── CMakeLists.txt
│ ├── DefaultsPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── DefaultsPlugin.pro
│ │ ├── Plugin.json
│ │ ├── defaultspane.cpp
│ │ ├── defaultspane.h
│ │ ├── defaultspane.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── thedesk-defaults.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr.qm
│ │ ├── tr.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ └── vi_VN.ts
│ ├── DisplayPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── DisplayPlugin.pro
│ │ ├── Plugin.json
│ │ ├── arrange/
│ │ │ ├── arrangecontroller.cpp
│ │ │ ├── arrangecontroller.h
│ │ │ ├── arrangewidget.cpp
│ │ │ ├── arrangewidget.h
│ │ │ ├── arrangewidget.ui
│ │ │ ├── overlaywindow.cpp
│ │ │ ├── overlaywindow.h
│ │ │ ├── overlaywindow.ui
│ │ │ ├── screenarranger.cpp
│ │ │ └── screenarranger.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── redshift/
│ │ │ ├── colorramp.cpp
│ │ │ ├── colorramp.h
│ │ │ ├── redshiftdaemon.cpp
│ │ │ └── redshiftdaemon.h
│ │ ├── settings/
│ │ │ ├── displaysettings.cpp
│ │ │ ├── displaysettings.h
│ │ │ └── displaysettings.ui
│ │ ├── thedesk-display.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── InputPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── InputPlugin.pro
│ │ ├── Plugin.json
│ │ ├── backends/
│ │ │ ├── settingsbackend.cpp
│ │ │ ├── settingsbackend.h
│ │ │ ├── xinputbackend.cpp
│ │ │ └── xinputbackend.h
│ │ ├── chunks/
│ │ │ ├── keyboardlayoutchunk.cpp
│ │ │ ├── keyboardlayoutchunk.h
│ │ │ └── keyboardlayoutchunk.ui
│ │ ├── daemons/
│ │ │ ├── keyboarddaemon.cpp
│ │ │ └── keyboarddaemon.h
│ │ ├── models/
│ │ │ ├── selectedkeyboardlayoutsmodel.cpp
│ │ │ └── selectedkeyboardlayoutsmodel.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── inputsettingsleftpane.cpp
│ │ │ ├── inputsettingsleftpane.h
│ │ │ ├── inputsettingsleftpane.ui
│ │ │ ├── inputsettingspane.cpp
│ │ │ ├── inputsettingspane.h
│ │ │ ├── inputsettingspane.ui
│ │ │ ├── keyboardsettings.cpp
│ │ │ ├── keyboardsettings.h
│ │ │ ├── keyboardsettings.ui
│ │ │ ├── mousesettings.cpp
│ │ │ ├── mousesettings.h
│ │ │ └── mousesettings.ui
│ │ ├── thedesk-input.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr.qm
│ │ ├── tr.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ └── vi_VN.ts
│ ├── LocalePlugin/
│ │ ├── CMakeLists.txt
│ │ ├── LocalePlugin.pro
│ │ ├── Plugin.json
│ │ ├── localeplugincommon.cpp
│ │ ├── localeplugincommon.h
│ │ ├── onboarding/
│ │ │ ├── onboardingregion.cpp
│ │ │ ├── onboardingregion.h
│ │ │ └── onboardingregion.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── localesettingspane.cpp
│ │ │ ├── localesettingspane.h
│ │ │ └── localesettingspane.ui
│ │ ├── thedesk-locale.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ ├── zh_CN.ts
│ │ ├── zu_ZA.qm
│ │ └── zu_ZA.ts
│ ├── NetworkPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── NetworkPlugin.pro
│ │ ├── Plugin.json
│ │ ├── chunk/
│ │ │ ├── chunkupdater.cpp
│ │ │ ├── chunkupdater.h
│ │ │ ├── genericchunkupdater.cpp
│ │ │ ├── genericchunkupdater.h
│ │ │ ├── networkchunk.cpp
│ │ │ ├── networkchunk.h
│ │ │ ├── wiredchunkupdater.cpp
│ │ │ ├── wiredchunkupdater.h
│ │ │ ├── wirelesschunkupdater.cpp
│ │ │ └── wirelesschunkupdater.h
│ │ ├── models/
│ │ │ ├── deviceconnectionlistmodel.cpp
│ │ │ ├── deviceconnectionlistmodel.h
│ │ │ ├── wirelessaccesspointsmodel.cpp
│ │ │ ├── wirelessaccesspointsmodel.h
│ │ │ ├── wirelessconnectionlistmodel.cpp
│ │ │ ├── wirelessconnectionlistmodel.h
│ │ │ ├── wirelessnetworklistdelegate.cpp
│ │ │ └── wirelessnetworklistdelegate.h
│ │ ├── networkplugincommon.cpp
│ │ ├── networkplugincommon.h
│ │ ├── onboarding/
│ │ │ ├── onboardingnetwork.cpp
│ │ │ ├── onboardingnetwork.h
│ │ │ ├── onboardingnetwork.ui
│ │ │ ├── wiredonboardingsetup.cpp
│ │ │ ├── wiredonboardingsetup.h
│ │ │ ├── wiredonboardingsetup.ui
│ │ │ ├── wirelessonboardingsetup.cpp
│ │ │ ├── wirelessonboardingsetup.h
│ │ │ └── wirelessonboardingsetup.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── statusCenter/
│ │ │ ├── connectionEditor/
│ │ │ │ ├── connectioneditorpane.cpp
│ │ │ │ ├── connectioneditorpane.h
│ │ │ │ ├── ipv4connectioneditorpane.cpp
│ │ │ │ ├── ipv4connectioneditorpane.h
│ │ │ │ ├── ipv4connectioneditorpane.ui
│ │ │ │ ├── networkconnectioneditor.cpp
│ │ │ │ ├── networkconnectioneditor.h
│ │ │ │ ├── networkconnectioneditor.ui
│ │ │ │ ├── wificonnectioneditorpane.cpp
│ │ │ │ ├── wificonnectioneditorpane.h
│ │ │ │ └── wificonnectioneditorpane.ui
│ │ │ ├── devicePanes/
│ │ │ │ ├── abstractdevicepane.cpp
│ │ │ │ ├── abstractdevicepane.h
│ │ │ │ ├── cellularpane.cpp
│ │ │ │ ├── cellularpane.h
│ │ │ │ ├── cellularpane.ui
│ │ │ │ ├── devicepane.cpp
│ │ │ │ ├── devicepane.h
│ │ │ │ ├── devicepane.ui
│ │ │ │ ├── wifidevicepane.cpp
│ │ │ │ ├── wifidevicepane.h
│ │ │ │ ├── wifidevicepane.ui
│ │ │ │ ├── wireddevicepane.cpp
│ │ │ │ ├── wireddevicepane.h
│ │ │ │ └── wireddevicepane.ui
│ │ │ ├── eap/
│ │ │ │ ├── securityeap.cpp
│ │ │ │ ├── securityeap.h
│ │ │ │ ├── securityeappeap.cpp
│ │ │ │ ├── securityeappeap.h
│ │ │ │ ├── securityeappeap.ui
│ │ │ │ ├── securityeapunsupported.cpp
│ │ │ │ ├── securityeapunsupported.h
│ │ │ │ └── securityeapunsupported.ui
│ │ │ ├── networkstatuscenterleftpane.cpp
│ │ │ ├── networkstatuscenterleftpane.h
│ │ │ ├── networkstatuscenterleftpane.ui
│ │ │ ├── networkstatuscenterpane.cpp
│ │ │ ├── networkstatuscenterpane.h
│ │ │ ├── networkstatuscenterpane.ui
│ │ │ └── popovers/
│ │ │ ├── connectionselectionpopover.cpp
│ │ │ ├── connectionselectionpopover.h
│ │ │ ├── connectionselectionpopover.ui
│ │ │ ├── simsettingspopover.cpp
│ │ │ ├── simsettingspopover.h
│ │ │ ├── simsettingspopover.ui
│ │ │ ├── tetheringsettingspopover.cpp
│ │ │ ├── tetheringsettingspopover.h
│ │ │ ├── tetheringsettingspopover.ui
│ │ │ ├── unlockmodempopover.cpp
│ │ │ ├── unlockmodempopover.h
│ │ │ ├── unlockmodempopover.ui
│ │ │ ├── wirelessnetworkselectionpopover.cpp
│ │ │ ├── wirelessnetworkselectionpopover.h
│ │ │ └── wirelessnetworkselectionpopover.ui
│ │ ├── switchmanager.cpp
│ │ ├── switchmanager.h
│ │ ├── thedesk-network.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── NotificationsPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── NotificationsPlugin.pro
│ │ ├── Plugin.json
│ │ ├── chunks/
│ │ │ ├── mprischunk.cpp
│ │ │ ├── mprischunk.h
│ │ │ └── mprischunk.ui
│ │ ├── dbus/
│ │ │ ├── notifications_adaptor.cpp
│ │ │ ├── notifications_adaptor.h
│ │ │ ├── notificationsinterface.cpp
│ │ │ ├── notificationsinterface.h
│ │ │ └── org.freedesktop.Notifications.xml
│ │ ├── drawer/
│ │ │ ├── hudwidget.cpp
│ │ │ ├── hudwidget.h
│ │ │ ├── hudwidget.ui
│ │ │ ├── notificationsdrawer.cpp
│ │ │ ├── notificationsdrawer.h
│ │ │ ├── notificationsdrawer.ui
│ │ │ ├── notificationsdrawerwidget.cpp
│ │ │ ├── notificationsdrawerwidget.h
│ │ │ └── notificationsdrawerwidget.ui
│ │ ├── notification.cpp
│ │ ├── notification.h
│ │ ├── notificationtracker.cpp
│ │ ├── notificationtracker.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── statuscenter/
│ │ │ ├── jobwidget.cpp
│ │ │ ├── jobwidget.h
│ │ │ ├── jobwidget.ui
│ │ │ ├── notificationappgroup.cpp
│ │ │ ├── notificationappgroup.h
│ │ │ ├── notificationappgroup.ui
│ │ │ ├── notificationsstatuscenterpane.cpp
│ │ │ ├── notificationsstatuscenterpane.h
│ │ │ ├── notificationsstatuscenterpane.ui
│ │ │ ├── notificationwidget.cpp
│ │ │ ├── notificationwidget.h
│ │ │ └── notificationwidget.ui
│ │ ├── thedesk-notifications.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── OverviewPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── OverviewPane/
│ │ │ ├── overviewpane.cpp
│ │ │ ├── overviewpane.h
│ │ │ ├── overviewpane.ui
│ │ │ ├── worldclock.cpp
│ │ │ ├── worldclock.h
│ │ │ └── worldclock.ui
│ │ ├── OverviewPlugin.pro
│ │ ├── Plugin.json
│ │ ├── clockchunk.cpp
│ │ ├── clockchunk.h
│ │ ├── clockchunk.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sk_SK.qm
│ │ ├── sk_SK.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ ├── zh_CN.ts
│ │ ├── zu_ZA.qm
│ │ └── zu_ZA.ts
│ ├── PowerPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── PowerPlugin.pro
│ │ ├── eventhandler.cpp
│ │ ├── eventhandler.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── powersettings.cpp
│ │ │ ├── powersettings.h
│ │ │ └── powersettings.ui
│ │ ├── sleepmonitor.cpp
│ │ ├── sleepmonitor.h
│ │ ├── thedesk-power.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id_ID.qm
│ │ ├── id_ID.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── ScreenshotPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── ScreenshotPlugin.pro
│ │ ├── eventhandler.cpp
│ │ ├── eventhandler.h
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── thedesk-screenshot.conf
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── ThemePlugin/
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── ThemePlugin.pro
│ │ ├── onboarding/
│ │ │ ├── onboardingtheme.cpp
│ │ │ ├── onboardingtheme.h
│ │ │ └── onboardingtheme.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── accentcolourpicker.cpp
│ │ │ ├── accentcolourpicker.h
│ │ │ ├── themesettingspane.cpp
│ │ │ ├── themesettingspane.h
│ │ │ └── themesettingspane.ui
│ │ ├── thedesk-theme.conf
│ │ ├── thedesk-themeplugin-resources.qrc
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id_ID.qm
│ │ ├── id_ID.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── TimeDatePlugin/
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── TimeDatePlugin.pro
│ │ ├── onboarding/
│ │ │ ├── onboardingtimezone.cpp
│ │ │ ├── onboardingtimezone.h
│ │ │ └── onboardingtimezone.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── popovers/
│ │ │ ├── settimedatepopover.cpp
│ │ │ ├── settimedatepopover.h
│ │ │ ├── settimedatepopover.ui
│ │ │ ├── settimezonepopover.cpp
│ │ │ ├── settimezonepopover.h
│ │ │ └── settimezonepopover.ui
│ │ ├── settings/
│ │ │ ├── datetimepane.cpp
│ │ │ ├── datetimepane.h
│ │ │ └── datetimepane.ui
│ │ ├── thedesk-timedate.conf
│ │ ├── timezonesmodel.cpp
│ │ ├── timezonesmodel.h
│ │ └── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr.qm
│ │ ├── tr.ts
│ │ ├── vi.qm
│ │ ├── vi.ts
│ │ └── vi_VN.ts
│ ├── UsersPlugin/
│ │ ├── CMakeLists.txt
│ │ ├── Plugin.json
│ │ ├── UsersPlugin.pro
│ │ ├── onboarding/
│ │ │ ├── onboardingusers.cpp
│ │ │ ├── onboardingusers.h
│ │ │ └── onboardingusers.ui
│ │ ├── plugin.cpp
│ │ ├── plugin.h
│ │ ├── settings/
│ │ │ ├── adduserdialog.cpp
│ │ │ ├── adduserdialog.h
│ │ │ ├── adduserdialog.ui
│ │ │ ├── changepassworddialog.cpp
│ │ │ ├── changepassworddialog.h
│ │ │ ├── changepassworddialog.ui
│ │ │ ├── changerealnamedialog.cpp
│ │ │ ├── changerealnamedialog.h
│ │ │ ├── changerealnamedialog.ui
│ │ │ ├── deleteuserdialog.cpp
│ │ │ ├── deleteuserdialog.h
│ │ │ ├── deleteuserdialog.ui
│ │ │ ├── lockuserdialog.cpp
│ │ │ ├── lockuserdialog.h
│ │ │ ├── lockuserdialog.ui
│ │ │ ├── user.cpp
│ │ │ ├── user.h
│ │ │ ├── usersmodel.cpp
│ │ │ ├── usersmodel.h
│ │ │ ├── userspane.cpp
│ │ │ ├── userspane.h
│ │ │ ├── userspane.ui
│ │ │ ├── usertypedialog.cpp
│ │ │ ├── usertypedialog.h
│ │ │ └── usertypedialog.ui
│ │ ├── thedesk-users.conf
│ │ └── translations/
│ │ ├── ar_SA.qm
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id_ID.qm
│ │ ├── id_ID.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro.qm
│ │ ├── ro.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ └── zh_CN.ts
│ ├── plugins.pri
│ └── plugins.pro
├── polkitagent/
│ ├── CMakeLists.txt
│ ├── authwindow.cpp
│ ├── authwindow.h
│ ├── authwindow.ui
│ ├── common.cpp
│ ├── common.h
│ ├── identitypopover.cpp
│ ├── identitypopover.h
│ ├── identitypopover.ui
│ ├── main.cpp
│ ├── polkitagent.pro
│ ├── polkitinterface.cpp
│ ├── polkitinterface.h
│ └── translations/
│ ├── ar_SA.ts
│ ├── au_AU.qm
│ ├── au_AU.ts
│ ├── cy.qm
│ ├── cy.ts
│ ├── da.qm
│ ├── da.ts
│ ├── de.qm
│ ├── de.ts
│ ├── en_GB.qm
│ ├── en_GB.ts
│ ├── en_US.qm
│ ├── en_US.ts
│ ├── es.ts
│ ├── es_VE.ts
│ ├── id.ts
│ ├── nl.qm
│ ├── nl.ts
│ ├── pt_BR.qm
│ ├── pt_BR.ts
│ ├── ro_RO.qm
│ ├── ro_RO.ts
│ ├── sv.qm
│ ├── sv.ts
│ ├── tr_TR.qm
│ ├── tr_TR.ts
│ ├── vi_VN.qm
│ ├── vi_VN.ts
│ ├── zh_CN.qm
│ ├── zh_CN.ts
│ ├── zu_ZA.qm
│ └── zu_ZA.ts
├── startdesk/
│ ├── CMakeLists.txt
│ ├── crash/
│ │ ├── backtracedialog.cpp
│ │ ├── backtracedialog.h
│ │ ├── backtracedialog.ui
│ │ ├── backtracepopover.cpp
│ │ ├── backtracepopover.h
│ │ ├── backtracepopover.ui
│ │ ├── backtracewidget.cpp
│ │ ├── backtracewidget.h
│ │ ├── backtracewidget.ui
│ │ ├── crashwidget.cpp
│ │ ├── crashwidget.h
│ │ └── crashwidget.ui
│ ├── main.cpp
│ ├── resources.qrc
│ ├── splash/
│ │ ├── splashcontroller.cpp
│ │ ├── splashcontroller.h
│ │ ├── splashwidget.cpp
│ │ ├── splashwidget.h
│ │ └── splashwidget.ui
│ ├── splashwindow.cpp
│ ├── splashwindow.h
│ ├── splashwindow.ui
│ ├── start-thedesk-wayland.in
│ ├── startdesk.pro
│ ├── thedesk-wayland.desktop.in
│ ├── thedesk.desktop.in
│ ├── translations/
│ │ ├── ar_SA.ts
│ │ ├── au_AU.qm
│ │ ├── au_AU.ts
│ │ ├── cy.qm
│ │ ├── cy.ts
│ │ ├── da.qm
│ │ ├── da.ts
│ │ ├── de.qm
│ │ ├── de.ts
│ │ ├── en_GB.qm
│ │ ├── en_GB.ts
│ │ ├── en_US.qm
│ │ ├── en_US.ts
│ │ ├── es.ts
│ │ ├── es_VE.ts
│ │ ├── id.ts
│ │ ├── nl.qm
│ │ ├── nl.ts
│ │ ├── pl_PL.qm
│ │ ├── pl_PL.ts
│ │ ├── pt_BR.qm
│ │ ├── pt_BR.ts
│ │ ├── ro_RO.qm
│ │ ├── ro_RO.ts
│ │ ├── sv.qm
│ │ ├── sv.ts
│ │ ├── tr_TR.qm
│ │ ├── tr_TR.ts
│ │ ├── vi_VN.qm
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.qm
│ │ ├── zh_CN.ts
│ │ ├── zu_ZA.qm
│ │ └── zu_ZA.ts
│ └── wayfire-thedesk-config.conf
├── theDesk.pro
└── wayfire-plugins/
├── CMakeLists.txt
├── a11y-plugin/
│ ├── CMakeLists.txt
│ ├── a11yplugin.cpp
│ ├── a11yplugin.h
│ ├── abstracta11ycontroller.cpp
│ ├── abstracta11ycontroller.h
│ ├── mousekeys.cpp
│ ├── mousekeys.h
│ ├── stickykeys.cpp
│ └── stickykeys.h
├── keygrab-plugin/
│ ├── CMakeLists.txt
│ ├── keygrab-plugin.pro
│ ├── keygrab-plugin_global.h
│ ├── keygrabplugin.cpp
│ └── keygrabplugin.h
├── plugins.pri
├── startdesk-plugin/
│ ├── CMakeLists.txt
│ ├── startdesk-plugin.pro
│ ├── startdeskplugin.cpp
│ └── startdeskplugin.h
└── wayfire-plugins.pro
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
theDesk.pro.user
================================================
FILE: .parlance.json
================================================
{
"name": "theDesk",
"subprojects": [
{
"name": "libthedesk",
"type": "qt",
"path": "/libthedesk/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Desktop",
"type": "qt",
"path": "/desktop/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Platform",
"type": "qt",
"path": "/platform/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Session Manager",
"type": "qt",
"path": "/startdesk/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Polkit",
"type": "qt",
"path": "/polkitagent/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Accessibility",
"type": "qt",
"path": "/plugins/AccessibilityPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Audio",
"type": "qt",
"path": "/plugins/AudioPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Bluetooth",
"type": "qt",
"path": "/plugins/BluetoothPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Brightness",
"type": "qt",
"path": "/plugins/BrightnessPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Defaults",
"type": "qt",
"path": "/plugins/DefaultsPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Display",
"type": "qt",
"path": "/plugins/DisplayPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Input",
"type": "qt",
"path": "/plugins/InputPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Locale",
"type": "qt",
"path": "/plugins/LocalePlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Network",
"type": "qt",
"path": "/plugins/NetworkPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Notifications",
"type": "qt",
"path": "/plugins/NotificationsPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Overview",
"type": "qt",
"path": "/plugins/OverviewPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Power",
"type": "qt",
"path": "/plugins/PowerPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Screenshots",
"type": "qt",
"path": "/plugins/ScreenshotPlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Theme",
"type": "qt",
"path": "/plugins/ThemePlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Time and Date",
"type": "qt",
"path": "/plugins/TimeDatePlugin/translations/{lang}.ts",
"baseLang": "en_US"
},
{
"name": "theDesk Users",
"type": "qt",
"path": "/plugins/UsersPlugin/translations/{lang}.ts",
"baseLang": "en_US"
}
]
}
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.24.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
project(thedesk VERSION 1.0.0 LANGUAGES CXX)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
link_directories(/usr/local/lib)
ENDIF()
find_package(QT REQUIRED NAMES Qt6)
set(KF_VERSION_MAJOR ${QT_VERSION_MAJOR} CACHE STRING "Major version of KDE Frameworks to link to")
add_subdirectory(libthedesk)
add_subdirectory(startdesk)
add_subdirectory(desktop)
add_subdirectory(platform)
add_subdirectory(plugins)
add_subdirectory(polkitagent)
add_subdirectory(locker)
add_subdirectory(desktop-portal)
add_subdirectory(wayfire-plugins)
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
---
theDesk is a desktop environment built on Qt libraries.
---


# Dependencies
- Qt 5
- Qt Core
- Qt GUI
- Qt Widgets
- Qt SVG
- [the-libs](https://github.com/vicr123/the-libs)
- [libtdesktopenvironment](https://github.com/vicr123/libtdesktopenvironment)
- Xlib
- xorg-libinput
- NetworkManager-Qt
## Recommended Dependencies
- [contemporary-widgets](https://github.com/vicr123/contemporary-widgets) - the default widget theme
- [contemporary-icons](https://github.com/vicr123/contemporary-icons) - the default icon theme
## Build
Run the following commands in your terminal.
```
mkdir build
qmake ../theDesk.pro
make
```
## Install
On Linux, run the following command in your terminal (with superuser permissions)
```
make install
```
---
> © Victor Tran, 2021. This project is licensed under the GNU General Public License, version 3, or at your option, any later version.
>
> Check the [LICENSE](LICENSE) file for more information.
================================================
FILE: desktop/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.24.0)
project(thedesk VERSION 1.0.0 LANGUAGES CXX)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network DBus Multimedia QuickWidgets)
find_package(libcontemporary REQUIRED)
find_package(libtdesktopenvironment REQUIRED)
set(SOURCES
background/background.cpp
bar/barwindow.cpp
bar/chunkcontainer.cpp
bar/currentappwidget.cpp
bar/currentappwidgetmenu.cpp
bar/mainbarwidget.cpp
bar/taskbarapplicationwidget.cpp
bar/taskbardesktopwidget.cpp
bar/taskbarwidget.cpp
cli/commandline.cpp
crash/crashhandling.cpp
gateway/appsearchprovider.cpp
gateway/appselectionmodel.cpp
gateway/appselectionmodellistdelegate.cpp
gateway/gateway.cpp
gateway/gatewaysearchmodel.cpp
gateway/gatewaysearchmodeldelegate.cpp
gateway/maingatewaywidget.cpp
gateway/searchresultswidget.cpp
main.cpp
run/rundialog.cpp
session/endsession.cpp
session/endsessionbutton.cpp
statuscenter/leftpanedelegate.cpp
statuscenter/statuscenter.cpp
statuscenter/statuscenterleftpane.cpp
statuscenter/statuscenterquickswitch.cpp
systemsettings/about/about.cpp
systemsettings/about/acknowledgements.cpp
systemsettings/about/changehostnamepopover.cpp
systemsettings/pluginmanagement/managepluginpopover.cpp
systemsettings/pluginmanagement/pluginitemdelegate.cpp
systemsettings/pluginmanagement/pluginmanagement.cpp
systemsettings/pluginmanagement/pluginmodel.cpp
systemsettings/recovery/recovery.cpp
systemsettings/systemsettings.cpp
systemsettings/systemsettingsleftpane.cpp
background/background.ui
bar/barwindow.ui
bar/chunkcontainer.ui
bar/currentappwidget.ui
bar/currentappwidgetmenu.ui
bar/mainbarwidget.ui
bar/taskbardesktopwidget.ui
bar/taskbarwidget.ui
gateway/gateway.ui
gateway/maingatewaywidget.ui
gateway/searchresultswidget.ui
run/rundialog.ui
session/endsession.ui
statuscenter/statuscenter.ui
statuscenter/statuscenterleftpane.ui
statuscenter/statuscenterquickswitch.ui
systemsettings/about/about.ui
systemsettings/about/acknowledgements.ui
systemsettings/about/changehostnamepopover.ui
systemsettings/pluginmanagement/managepluginpopover.ui
systemsettings/pluginmanagement/pluginmanagement.ui
systemsettings/recovery/recovery.ui
systemsettings/systemsettings.ui
systemsettings/systemsettingsleftpane.ui
resources.qrc
)
set(HEADERS
background/background.h
bar/barwindow.h
bar/chunkcontainer.h
bar/currentappwidget.h
bar/currentappwidgetmenu.h
bar/mainbarwidget.h
bar/taskbarapplicationwidget.h
bar/taskbardesktopwidget.h
bar/taskbarwidget.h
cli/commandline.h
crash/crashhandling.h
gateway/appsearchprovider.h
gateway/appselectionmodel.h
gateway/appselectionmodellistdelegate.h
gateway/gateway.h
gateway/gatewaysearchmodel.h
gateway/gatewaysearchmodeldelegate.h
gateway/maingatewaywidget.h
gateway/searchresultswidget.h
run/rundialog.h
session/endsession.h
session/endsessionbutton.h
statuscenter/leftpanedelegate.h
statuscenter/statuscenter.h
statuscenter/statuscenterleftpane.h
statuscenter/statuscenterquickswitch.h
systemsettings/about/about.h
systemsettings/about/acknowledgements.h
systemsettings/about/changehostnamepopover.h
systemsettings/pluginmanagement/managepluginpopover.h
systemsettings/pluginmanagement/pluginitemdelegate.h
systemsettings/pluginmanagement/pluginmanagement.h
systemsettings/pluginmanagement/pluginmodel.h
systemsettings/recovery/recovery.h
systemsettings/systemsettings.h
systemsettings/systemsettingsleftpane.h
)
add_executable(thedesk ${SOURCES} ${HEADERS})
set_target_properties(thedesk PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_GUI_IDENTIFIER com.vicr123.thedesk
WIN32_EXECUTABLE TRUE
CNTP_DATA_SUBDIR thedesk)
cntp_init(thedesk 20)
cntp_translate(thedesk)
cntp_target_name(thedesk "thedesk")
cntp_defaults_file(thedesk
DEFAULTS_FILE thedesk.conf)
target_link_libraries(thedesk Qt::Widgets Qt::Network Qt::DBus Qt::Multimedia Qt::QuickWidgets libcontemporary libtdesktopenvironment libthedesk)
target_include_directories(thedesk PUBLIC ../libthedesk/)
install(TARGETS thedesk
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION /Applications)
# TODO: Port install rules over from qmake
install(DIRECTORY media
DESTINATION ${CMAKE_INSTALL_DATADIR}/thedesk
)
================================================
FILE: desktop/acknowledgements.html
================================================
Thanks to the following people who contributed to the development of theDesk in some way:
ZoomTen for testing and contributing resorces and ideas, such as window borders
GitHub
The Pixel Polygon for the welcome cutscene
YouTube
All the people who contributed translations to theDesk
Translation Website
All the people that sponsor me (or have ever done so) on GitHub Sponsors:
- techli0n
- Neptunium Fluoride
- JPlexer
- Tomas
- Alee14
- Kommult
GitHub Sponsors
================================================
FILE: desktop/background/background.cpp
================================================
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "background.h"
#include "ui_background.h"
#include
#include
#include
#include
#include
#include
#include
#include
struct BackgroundPrivate {
static BackgroundController* bg;
static QList backgrounds;
SystemScreen* oldScreen = nullptr;
QMetaObject::Connection screenGeometryChangedConnection;
QSettings settings;
bool retrieving = false;
bool retrieveAgain = false;
BackgroundController::BackgroundData background;
bool isChangeBackgroundVisible = false;
bool communityBackgroundSettingsShown = true;
};
BackgroundController* BackgroundPrivate::bg = nullptr;
QList BackgroundPrivate::backgrounds = QList();
Background::Background() :
QDialog(nullptr),
ui(new Ui::Background) {
ui->setupUi(this);
d = new BackgroundPrivate();
if (!d->bg) {
d->bg = new BackgroundController(BackgroundController::Desktop);
connect(qApp, &QApplication::screenAdded, &Background::reconfigureBackgrounds);
connect(qApp, &QApplication::screenRemoved, &Background::reconfigureBackgrounds);
connect(ScreenDaemon::instance(), &ScreenDaemon::screensUpdated, &Background::reconfigureBackgrounds);
}
connect(d->bg, &BackgroundController::currentBackgroundChanged, this, [this](BackgroundController::BackgroundType type) {
if (type == BackgroundController::Desktop) this->changeBackground();
this->showCommunityBackgroundSettings(d->bg->currentBackgroundName(BackgroundController::Desktop) == "community" || d->bg->currentBackgroundName(BackgroundController::LockScreen) == "community");
});
connect(d->bg, &BackgroundController::shouldShowCommunityLabelsChanged, this, [this] {
if (d->bg->currentBackgroundName(BackgroundController::Desktop) == "community") this->changeBackground();
});
connect(d->bg, &BackgroundController::stretchTypeChanged, this, [this](BackgroundController::StretchType stretchType) {
switch (stretchType) {
case BackgroundController::StretchFit:
ui->stretchFitButton->setChecked(true);
break;
case BackgroundController::ZoomCrop:
ui->zoomCropButton->setChecked(true);
break;
case BackgroundController::Center:
ui->centerButton->setChecked(true);
break;
case BackgroundController::Tile:
ui->tileButton->setChecked(true);
break;
case BackgroundController::ZoomFit:
ui->zoomFitButton->setChecked(true);
break;
}
this->changeBackground();
});
this->showCommunityBackgroundSettings(d->bg->currentBackgroundName(BackgroundController::Desktop) == "community" || d->bg->currentBackgroundName(BackgroundController::LockScreen) == "community");
switch (d->bg->stretchType()) {
case BackgroundController::StretchFit:
ui->stretchFitButton->setChecked(true);
break;
case BackgroundController::ZoomCrop:
ui->zoomCropButton->setChecked(true);
break;
case BackgroundController::Center:
ui->centerButton->setChecked(true);
break;
case BackgroundController::Tile:
ui->tileButton->setChecked(true);
break;
case BackgroundController::ZoomFit:
ui->zoomFitButton->setChecked(true);
break;
}
ui->showImageInformationBox->setChecked(d->bg->shouldShowCommunityLabels());
ui->stackedWidget->setCurrentWidget(ui->backgroundPage);
ui->stackedWidget->setCurrentAnimation(tStackedWidget::Fade);
ui->backgroundPage->installEventFilter(this);
ui->backgroundSelectionWidget->setFixedHeight(0);
ui->backgroundList->setModel(new BackgroundSelectionModel());
ui->backgroundList->setItemDelegate(new BackgroundSelectionDelegate());
ui->backgroundList->setIconSize(QSize(213, 120));
ui->backgroundList->setFixedHeight(120);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
this->setAttribute(Qt::WA_ShowWithoutActivating, true);
changeBackground();
}
Background::~Background() {
delete d;
delete ui;
}
QCoro::Task<> Background::changeBackground() {
if (d->retrieving) {
d->retrieveAgain = true;
co_return;
}
d->retrieving = true;
ui->stackedWidget->setCurrentWidget(ui->loadingBackgroundPage);
try {
auto data = co_await d->bg->getCurrentBackground(this->size());
// TODO: what if the backgrounds change?
d->background = data;
if (d->background.extendedInfoAvailable) {
QPainter painter(&data.px);
if (d->settings.value("desktop/showLabels", true).toBool()) {
QLinearGradient darkener;
darkener.setColorAt(0, QColor::fromRgb(0, 0, 0, 0));
darkener.setColorAt(1, QColor::fromRgb(0, 0, 0, 200));
if (d->settings.value("bar/onTop", true).toBool()) {
darkener.setStart(0, 0);
darkener.setFinalStop(0, data.px.height());
} else {
darkener.setStart(0, data.px.height());
darkener.setFinalStop(0, 0);
}
painter.setBrush(darkener);
painter.drawRect(0, 0, data.px.width(), data.px.height());
painter.setPen(Qt::white);
int currentX = 30;
int baselineY;
if (d->settings.value("bar/onTop", true).toBool()) {
baselineY = data.px.height() - 30;
} else {
baselineY = 30 + QFontMetrics(QFont(this->font().family(), 20)).ascent();
}
if (!data.name.isEmpty()) {
painter.setFont(QFont(this->font().family(), 20));
int width = painter.fontMetrics().horizontalAdvance(data.name);
painter.drawText(currentX, baselineY, data.name);
currentX += width + 9;
}
if (!data.location.isEmpty()) {
painter.setFont(QFont(this->font().family(), 10));
QIcon locationIcon = QIcon::fromTheme("gps");
int height = painter.fontMetrics().height();
int width = painter.fontMetrics().horizontalAdvance(data.location) + height;
painter.drawPixmap(currentX, baselineY - height, locationIcon.pixmap(QSize(16, 16)));
painter.drawText(currentX + height + 6, baselineY - painter.fontMetrics().descent(), data.location);
currentX += width + 20;
}
if (!data.author.isEmpty()) {
painter.setFont(QFont(this->font().family(), 10));
QString author = tr("by %1").arg(data.author);
int width = painter.fontMetrics().horizontalAdvance(author);
painter.drawText(data.px.width() - width - 30, baselineY, author);
}
}
}
QTimer::singleShot(1000, this, [this, data] {
d->background = data;
this->update();
d->retrieving = false;
if (d->retrieveAgain) {
d->retrieveAgain = false;
this->changeBackground();
} else {
ui->stackedWidget->setCurrentWidget(ui->backgroundPage);
}
});
} catch (BackgroundException ex) {
d->retrieving = false;
if (d->retrieveAgain) {
d->retrieveAgain = false;
this->changeBackground();
} else {
ui->stackedWidget->setCurrentWidget(ui->backgroundErrorPage);
}
}
}
void Background::toggleChangeBackground() {
d->isChangeBackgroundVisible = !d->isChangeBackgroundVisible;
tVariantAnimation* anim = new tVariantAnimation();
anim->setStartValue(ui->backgroundSelectionWidget->height());
if (d->isChangeBackgroundVisible) {
anim->setEndValue(ui->backgroundSelectionWidget->sizeHint().height());
// TODO: Hide the bar
// MainWindow::instance()->forceHide();
} else {
// TODO: Show the bar
anim->setEndValue(0);
// MainWindow::instance()->unforceHide();
}
anim->setDuration(500);
anim->setEasingCurve(QEasingCurve::OutCubic);
connect(anim, &tVariantAnimation::valueChanged, this, [this](QVariant value) {
ui->backgroundSelectionWidget->setFixedHeight(value.toInt());
});
connect(anim, &tVariantAnimation::finished, this, [this] {
if (d->isChangeBackgroundVisible) {
ui->backgroundSelectionWidget->setFixedHeight(QWIDGETSIZE_MAX);
}
});
anim->start();
DesktopWm::setShowDesktop(d->isChangeBackgroundVisible);
}
void Background::showCommunityBackgroundSettings(bool shown) {
if (shown == d->communityBackgroundSettingsShown) return;
d->communityBackgroundSettingsShown = shown;
ui->communityBackgroundSettings->setVisible(shown);
}
void Background::show() {
DesktopWm::setSystemWindow(this, DesktopWm::SystemWindowTypeDesktop);
QDialog::show();
}
void Background::on_actionChange_Background_triggered() {
this->toggleChangeBackground();
}
void Background::reject() {
}
bool Background::eventFilter(QObject* watched, QEvent* event) {
if (watched == ui->backgroundPage) {
if (event->type() == QEvent::Paint) {
QPainter p(ui->backgroundPage);
if (d->retrieving) {
p.setPen(Qt::transparent);
p.setBrush(Qt::black);
p.drawRect(0, 0, this->width(), this->height());
} else {
p.drawPixmap(0, -ui->backgroundSelectionWidget->height(), d->background.px);
}
} else if (event->type() == QEvent::MouseButtonPress) {
if (d->isChangeBackgroundVisible) toggleChangeBackground();
}
}
return false;
}
void Background::on_Background_customContextMenuRequested(const QPoint& pos) {
if (d->isChangeBackgroundVisible) return;
QMenu* menu = new QMenu(this);
menu->addSection(tr("For desktop"));
menu->addAction(ui->actionChange_Background);
connect(menu, &QMenu::aboutToHide, menu, &QMenu::deleteLater);
menu->popup(this->mapToGlobal(pos));
}
void Background::paintEvent(QPaintEvent* event) {
}
void Background::resizeEvent(QResizeEvent* event) {
this->changeBackground();
}
void Background::resizeToScreen(int screen) {
auto s = ScreenDaemon::instance()->screens().at(screen);
if (s != d->oldScreen) {
if (s != nullptr) disconnect(d->screenGeometryChangedConnection);
connect(s, &SystemScreen::geometryChanged, this, [this, s] {
this->setGeometry(s->geometry());
});
this->setGeometry(s->geometry());
this->show();
d->oldScreen = s;
}
}
void Background::changeBackground(QString background, QList types) {
if (background == "custom") {
// Ask the user to select a background
background = QFileDialog::getOpenFileName(this, tr("Select Background"), "", "Images (*.png *.jpg *.jpeg *.bmp *.gif)");
if (background.isEmpty()) return;
}
for (auto type : types) {
d->bg->setBackground(background, type);
}
}
void Background::reconfigureBackgrounds() {
if (BackgroundPrivate::backgrounds.count() > ScreenDaemon::instance()->screens().count()) {
// Remove backgrounds until the correct number of backgrounds have been created
int difference = BackgroundPrivate::backgrounds.count() - ScreenDaemon::instance()->screens().count();
for (int i = 0; i < difference; i++) {
BackgroundPrivate::backgrounds.takeLast()->deleteLater();
}
}
if (BackgroundPrivate::backgrounds.count() < ScreenDaemon::instance()->screens().count()) {
// Add new backgrounds until the correct number of backgrounds have been created
int difference = ScreenDaemon::instance()->screens().count() - BackgroundPrivate::backgrounds.count();
for (int i = 0; i < difference; i++) {
Background* w = new Background();
BackgroundPrivate::backgrounds.append(w);
}
}
for (int i = 0; i < ScreenDaemon::instance()->screens().count(); i++) {
BackgroundPrivate::backgrounds.at(i)->resizeToScreen(i);
}
}
void Background::on_tryReloadBackgroundButton_clicked() {
this->changeBackground();
}
void Background::on_backgroundList_clicked(const QModelIndex& index) {
QString background = index.data(Qt::UserRole).toString();
QMenu* menu = new QMenu(this);
menu->addSection(tr("Set Background"));
menu->addAction(tr("Set as Desktop Background"), this, [this, background] {
changeBackground(background, {BackgroundController::Desktop});
});
menu->addAction(tr("Set as Lock Screen Background"), this, [this, background] {
changeBackground(background, {BackgroundController::LockScreen});
});
menu->addSeparator();
menu->addAction(tr("Set for both"), this, [this, background] {
changeBackground(background, {BackgroundController::Desktop, BackgroundController::LockScreen});
});
connect(menu, &QMenu::aboutToHide, menu, &QMenu::deleteLater);
menu->popup(QCursor::pos());
}
void Background::on_backButton_clicked() {
this->toggleChangeBackground();
}
void Background::on_showImageInformationBox_toggled(bool checked) {
d->bg->setShouldShowCommunityLabels(checked);
}
void Background::on_stretchFitButton_toggled(bool checked) {
if (checked) {
d->bg->setStretchType(BackgroundController::StretchFit);
}
}
void Background::on_zoomCropButton_toggled(bool checked) {
if (checked) {
d->bg->setStretchType(BackgroundController::ZoomCrop);
}
}
void Background::on_centerButton_toggled(bool checked) {
if (checked) {
d->bg->setStretchType(BackgroundController::Center);
}
}
void Background::on_tileButton_toggled(bool checked) {
if (checked) {
d->bg->setStretchType(BackgroundController::Tile);
}
}
void Background::on_zoomFitButton_toggled(bool checked) {
if (checked) {
d->bg->setStretchType(BackgroundController::ZoomFit);
}
}
void Background::on_actionEndSession_triggered() {
}
================================================
FILE: desktop/background/background.h
================================================
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef BACKGROUND_H
#define BACKGROUND_H
#include
#include
#include
class ChooseBackground;
namespace Ui {
class Background;
}
struct BackgroundPrivate;
class Background : public QDialog {
Q_OBJECT
public:
explicit Background();
~Background();
void show();
static void reconfigureBackgrounds();
public slots:
QCoro::Task<> changeBackground();
void toggleChangeBackground();
void showCommunityBackgroundSettings(bool shown);
signals:
void setAllBackgrounds(QString background);
void reloadBackground();
private slots:
void on_actionChange_Background_triggered();
void on_Background_customContextMenuRequested(const QPoint& pos);
void on_tryReloadBackgroundButton_clicked();
void on_backgroundList_clicked(const QModelIndex& index);
void on_backButton_clicked();
void on_showImageInformationBox_toggled(bool checked);
void on_stretchFitButton_toggled(bool checked);
void on_zoomCropButton_toggled(bool checked);
void on_centerButton_toggled(bool checked);
void on_tileButton_toggled(bool checked);
void on_zoomFitButton_toggled(bool checked);
void on_actionEndSession_triggered();
private:
Ui::Background* ui;
BackgroundPrivate* d;
void reject();
bool eventFilter(QObject* watched, QEvent* event);
void paintEvent(QPaintEvent* event);
void resizeEvent(QResizeEvent* event);
void resizeToScreen(int screen);
void changeBackground(QString background, QList types);
};
#endif // BACKGROUND_H
================================================
FILE: desktop/background/background.ui
================================================
Background
0
0
751
517
Qt::CustomContextMenu
theShell Background
:/icons/icon.svg:/icons/icon.svg
0
0
0
0
0
-
0
0
255
255
255
0
0
0
0
0
0
255
255
255
0
0
0
0
0
0
255
255
255
0
0
0
0
0
0
true
-
Qt::Vertical
20
37
-
Qt::Horizontal
114
20
-
-
Sorry, there was a problem displaying the background.
-
-
Qt::Horizontal
40
20
-
Try Again
-
Qt::Horizontal
40
20
-
Qt::Horizontal
113
20
-
Qt::Vertical
20
38
-
Qt::Vertical
20
58
-
Qt::Horizontal
275
20
-
-
Qt::Horizontal
274
20
-
Qt::Vertical
20
57
-
0
0
0
0
0
-
16777215
1
Qt::Horizontal
-
0
-
0
0
../statuscenter/PulseaudioPane../statuscenter/PulseaudioPane
true
-
0
0
15
Background
9
-
16777215
1
Qt::Horizontal
-
6
9
9
9
9
-
75
true
IMAGE
-
Select an image to display on your background and lock screen
-
0
0
QFrame::NoFrame
QListView::Static
false
QListView::Adjust
QListView::IconMode
-
0
0
0
0
0
-
16777215
1
Qt::Horizontal
-
6
9
9
9
9
-
75
true
COMMUNITY BACKGROUNDS
-
Images from the theDesk community will be cycled through every so often.
-
Show image information
-
16777215
1
Qt::Horizontal
-
6
9
9
9
9
-
75
true
STRETCH
-
Select how you'd like the background image to be sized
-
0
-
Stretch To Fit
..
64
64
true
true
Qt::ToolButtonTextUnderIcon
-
Zoom and Crop
..
64
64
true
true
Qt::ToolButtonTextUnderIcon
-
Center
..
64
64
true
true
Qt::ToolButtonTextUnderIcon
-
Tile
..
64
64
true
true
Qt::ToolButtonTextUnderIcon
-
Zoom To Fit
..
64
64
true
true
Qt::ToolButtonTextUnderIcon
-
Qt::Horizontal
40
20
..
Change Background
End Session
tCircularSpinner
QWidget
1
tStackedWidget
QStackedWidget
1
================================================
FILE: desktop/bar/barwindow.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "barwindow.h"
#include "ui_barwindow.h"
#include
#include
#include
#include
#include
#include
#include "mainbarwidget.h"
#include "statuscenter/statuscenter.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "gateway/gateway.h"
#include
struct BarWindowPrivate {
MainBarWidget* mainBarWidget;
StatusCenter* statusCenterWidget;
tVariantAnimation* heightAnim;
tVariantAnimation* barStatusCenterTransitionAnim;
QGraphicsOpacityEffect* mainBarOpacity;
QGraphicsOpacityEffect* statusCenterOpacity;
SystemScreen* oldPrimaryScreen = nullptr;
QList maximisedWindows;
bool barExpanding = true;
bool statusCenterShown = false;
bool barPendingShow = false;
GestureInteractionPtr lastGesture;
tSettings settings;
};
BarWindow::BarWindow(QWidget* parent) :
QWidget(parent),
ui(new Ui::BarWindow) {
ui->setupUi(this);
d = new BarWindowPrivate();
this->setAttribute(Qt::WA_TranslucentBackground);
this->setMouseTracking(true);
d->mainBarWidget = new MainBarWidget(this);
connect(d->mainBarWidget, &MainBarWidget::expandedHeightChanged, this, &BarWindow::barHeightChanged);
connect(d->mainBarWidget, &MainBarWidget::statusBarHeightChanged, this, &BarWindow::barHeightChanged);
d->statusCenterWidget = new StatusCenter(this);
d->mainBarOpacity = new QGraphicsOpacityEffect(d->mainBarWidget);
d->mainBarOpacity->setEnabled(false);
d->mainBarWidget->setGraphicsEffect(d->mainBarOpacity);
d->statusCenterOpacity = new QGraphicsOpacityEffect(d->statusCenterWidget);
d->statusCenterOpacity->setEnabled(false);
d->statusCenterWidget->setGraphicsEffect(d->statusCenterOpacity);
d->statusCenterWidget->setVisible(false);
d->heightAnim = new tVariantAnimation(this);
d->heightAnim->setDuration(500);
connect(d->heightAnim, &tVariantAnimation::valueChanged, this, [=](QVariant value) {
this->setFixedHeight(value.toInt() + 1);
});
connect(GestureDaemon::instance(), &GestureDaemon::gestureBegin, this, [=](GestureInteractionPtr gesture) {
if (gesture->isValidInteraction(GestureTypes::Swipe, GestureTypes::Down, 3)) {
if (d->barExpanding) {
trackStatusCenterPullDownGesture(gesture);
} else {
trackBarPullDownGesture(gesture);
}
} else if (gesture->isValidInteraction(GestureTypes::Swipe, GestureTypes::Up, 3)) {
if (d->statusCenterShown) {
trackStatusCenterPullUpGesture(gesture);
}
}
});
d->barStatusCenterTransitionAnim = new tVariantAnimation();
d->barStatusCenterTransitionAnim->setStartValue(0.0);
d->barStatusCenterTransitionAnim->setEndValue(1.0);
d->barStatusCenterTransitionAnim->setDuration(250);
d->barStatusCenterTransitionAnim->setEasingCurve(QEasingCurve::InOutCubic);
connect(d->barStatusCenterTransitionAnim, &tVariantAnimation::valueChanged, this, [=](QVariant value) {
double percentage = value.toDouble();
if (qFuzzyIsNull(percentage)) { // Fully show bar view
d->statusCenterWidget->setVisible(false);
d->mainBarWidget->setVisible(true);
d->statusCenterOpacity->setEnabled(false);
d->mainBarOpacity->setEnabled(false);
this->setFixedHeight(d->mainBarWidget->expandedHeight());
ui->line->setVisible(true);
} else if (qFuzzyCompare(percentage, 1)) { // Fully show Status Center view
d->statusCenterWidget->setVisible(true);
d->mainBarWidget->setVisible(false);
d->statusCenterOpacity->setEnabled(false);
d->mainBarOpacity->setEnabled(false);
this->setFixedHeight(d->statusCenterWidget->height());
ui->line->setVisible(false);
} else {
if (percentage < 0.5) { // Animate the bar
d->mainBarOpacity->setOpacity(1 - (percentage * 2));
d->mainBarOpacity->setEnabled(true);
d->mainBarWidget->setVisible(true);
d->statusCenterWidget->setVisible(false);
d->statusCenterOpacity->setEnabled(false);
} else { // Animate the Status Center
d->statusCenterOpacity->setOpacity(percentage * 2 - 1);
d->statusCenterOpacity->setEnabled(true);
d->statusCenterWidget->setVisible(true);
d->mainBarWidget->setVisible(false);
d->mainBarOpacity->setEnabled(false);
}
this->setFixedHeight((d->statusCenterWidget->height() - d->mainBarWidget->expandedHeight()) * percentage + d->mainBarWidget->expandedHeight());
ui->line->setVisible(true);
}
});
// Tell the window manager that this is a "taskbar" type window
this->setWindowFlag(Qt::FramelessWindowHint);
DesktopWm::instance()->setSystemWindow(this, DesktopWm::SystemWindowTypeTaskbar);
DesktopWm::instance()->blurWindow(this);
this->barHeightChanged();
connect(qApp, &QApplication::primaryScreenChanged, this, &BarWindow::updatePrimaryScreen);
updatePrimaryScreen();
connect(StateManager::statusCenterManager(), &StatusCenterManager::showStatusCenter, this, &BarWindow::showStatusCenter);
connect(StateManager::statusCenterManager(), &StatusCenterManager::hideStatusCenter, this, &BarWindow::hideStatusCenter);
connect(StateManager::barManager(), &BarManager::barLockedChanged, this, [=](bool isBarLocked) {
if (!isBarLocked) {
// showBar();
// } else {
if (!this->geometry().contains(QCursor::pos())) hideBar();
}
});
connect(&d->settings, &tSettings::settingChanged, this, [=](QString key, QVariant value) {
if (key == "Appearance/translucent") {
this->update();
}
});
connect(DesktopWm::instance(), &DesktopWm::windowAdded, this, &BarWindow::trackWindow);
connect(DesktopWm::instance(), &DesktopWm::windowRemoved, this, [=](DesktopWmWindowPtr window) {
if (d->maximisedWindows.contains(window)) {
d->maximisedWindows.removeAll(window);
this->update();
}
});
for (const DesktopWmWindowPtr& window : DesktopWm::openWindows()) {
trackWindow(window);
}
KeyGrab* statusCenterGrab = new KeyGrab(QKeySequence(Qt::MetaModifier | Qt::Key_Tab));
connect(statusCenterGrab, &KeyGrab::activated, this, [=] {
StateManager::statusCenterManager()->show();
});
ui->line->raise();
// Initialise the Gateway
Gateway::instance();
}
BarWindow::~BarWindow() {
delete ui;
delete d;
}
void BarWindow::setFixedHeight(int height) {
QWidget::setFixedHeight(height);
// Work around a Qt bug that causes the native window not to be updated on Wayland for some reason
this->windowHandle()->setGeometry(this->geometry());
}
void BarWindow::setFixedWidth(int width) {
QWidget::setFixedWidth(width);
// Work around a Qt bug that causes the native window not to be updated on Wayland for some reason
this->windowHandle()->setGeometry(this->geometry());
}
void BarWindow::resizeEvent(QResizeEvent* event) {
ui->line->setGeometry(0, this->height() - 1, this->width(), this->height());
d->mainBarWidget->setFixedWidth(this->width());
d->mainBarWidget->barHeightChanged(this->height() - 1);
d->statusCenterWidget->setFixedWidth(this->width());
StateManager::barManager()->setBarHeight(this->height());
}
void BarWindow::enterEvent(QEnterEvent* event) {
if (d->lastGesture && d->lastGesture->isActive()) return;
d->barPendingShow = true;
if ((this->layoutDirection() == Qt::RightToLeft && mapFromGlobal(QCursor::pos()).x() > d->mainBarWidget->currentAppWidgetX()) ||
(this->layoutDirection() == Qt::LeftToRight && mapFromGlobal(QCursor::pos()).x() < d->mainBarWidget->currentAppWidgetX())) showBar();
}
void BarWindow::leaveEvent(QEvent* event) {
if (d->lastGesture && d->lastGesture->isActive()) return;
hideBar();
}
void BarWindow::paintEvent(QPaintEvent* event) {
QColor bgCol = this->palette().color(QPalette::Window);
if (d->settings.value("Appearance/translucent").toBool() && d->maximisedWindows.count() == 0) bgCol.setAlpha(150);
QPainter painter(this);
painter.setPen(Qt::transparent);
painter.setBrush(bgCol);
painter.drawRect(0, 0, this->width(), this->height());
}
void BarWindow::trackWindow(DesktopWmWindowPtr window) {
window->disconnect(this);
DesktopWm::instance()->disconnect(window);
connect(window, &DesktopWmWindow::geometryChanged, this, [=] {
trackWindow(window);
});
connect(window, &DesktopWmWindow::windowStateChanged, this, [=] {
trackWindow(window);
});
connect(DesktopWm::instance(), &DesktopWm::currentDesktopChanged, window, [=] {
trackWindow(window);
});
QRect screenGeometry = QApplication::primaryScreen()->geometry();
if (window->isMaximised() && !window->isMinimized() && screenGeometry.contains(window->geometry()) && window->isOnCurrentDesktop()) {
if (d->maximisedWindows.contains(window)) return;
d->maximisedWindows.append(window);
this->update();
} else if (!window->isMaximised() || window->isMinimized() || !window->isOnCurrentDesktop()) {
if (!d->maximisedWindows.contains(window)) return;
d->maximisedWindows.removeAll(window);
this->update();
}
}
void BarWindow::updatePrimaryScreen() {
if (d->oldPrimaryScreen) {
disconnect(d->oldPrimaryScreen, &SystemScreen::geometryChanged, this, &BarWindow::updatePrimaryScreen);
disconnect(d->oldPrimaryScreen, &SystemScreen::rotationChanged, this, &BarWindow::updatePrimaryScreen);
}
auto* primaryScreen = ScreenDaemon::instance()->primayScreen();
connect(primaryScreen, &SystemScreen::geometryChanged, this, &BarWindow::updatePrimaryScreen);
connect(primaryScreen, &SystemScreen::rotationChanged, this, &BarWindow::updatePrimaryScreen);
d->oldPrimaryScreen = primaryScreen;
if (primaryScreen) {
// Qt adjusts the size of the window for us, so we'll need to adjust for that
auto primaryGeometry = primaryScreen->geometry();
primaryGeometry.setSize(primaryGeometry.size() / primaryScreen->qtScreen()->devicePixelRatio());
this->setFixedWidth(primaryGeometry.width());
this->move(primaryGeometry.topLeft());
d->statusCenterWidget->setFixedHeight(primaryGeometry.height());
}
// Refresh the state of all the windows
for (const DesktopWmWindowPtr& window : DesktopWm::openWindows()) {
trackWindow(window);
}
barHeightChanged();
}
void BarWindow::barHeightChanged() {
DesktopWm::setScreenMarginForWindow(this, qApp->primaryScreen(), Qt::TopEdge, d->mainBarWidget->statusBarHeight() * (ScreenDaemon::instance()->primayScreen() ? ScreenDaemon::instance()->primayScreen()->qtScreen()->devicePixelRatio() : 1));
d->mainBarWidget->setFixedHeight(d->mainBarWidget->expandedHeight());
if (!d->statusCenterShown) {
QSignalBlocker blocker(d->heightAnim);
d->heightAnim->setStartValue(this->height() - 1);
d->heightAnim->setEndValue(d->barExpanding ? d->mainBarWidget->expandedHeight() : d->mainBarWidget->statusBarHeight());
d->heightAnim->setEasingCurve(QEasingCurve::OutCubic);
d->heightAnim->stop();
d->heightAnim->start();
}
}
void BarWindow::showStatusCenter() {
QSignalBlocker blocker(d->heightAnim);
d->heightAnim->stop();
StateManager::statusCenterManager()->setIsShowingStatusCenter(true);
int time = d->barStatusCenterTransitionAnim->currentTime();
d->barStatusCenterTransitionAnim->setDirection(tVariantAnimation::Forward);
d->barStatusCenterTransitionAnim->start();
d->barStatusCenterTransitionAnim->setCurrentTime(time);
// Tell the window manager that this is now a standard system window
DesktopWm::instance()->setSystemWindow(this);
d->statusCenterWidget->setFocus();
d->statusCenterShown = true;
}
void BarWindow::hideStatusCenter() {
StateManager::statusCenterManager()->setIsShowingStatusCenter(false);
int time = d->barStatusCenterTransitionAnim->currentTime();
d->barStatusCenterTransitionAnim->setDirection(tVariantAnimation::Backward);
d->barStatusCenterTransitionAnim->start();
d->barStatusCenterTransitionAnim->setCurrentTime(time);
// Tell the window manager that this is now a "taskbar" type window
DesktopWm::instance()->setSystemWindow(this, DesktopWm::SystemWindowTypeTaskbar);
d->mainBarWidget->setFocus();
d->statusCenterShown = false;
}
void BarWindow::showBar() {
d->barPendingShow = false;
// If we're showing the status bar, don't touch the height
if (!StateManager::statusCenterManager()->isShowingStatusCenter()) {
QSignalBlocker blocker(d->heightAnim);
d->heightAnim->setStartValue(this->height() - 1);
d->heightAnim->setEndValue(d->mainBarWidget->expandedHeight());
d->heightAnim->setEasingCurve(QEasingCurve::OutCubic);
d->heightAnim->stop();
d->heightAnim->start();
d->barExpanding = true;
}
}
void BarWindow::hideBar() {
// If we're showing the status bar, don't touch the height
if (!StateManager::statusCenterManager()->isShowingStatusCenter() && !StateManager::barManager()->isBarLocked()) {
QSignalBlocker blocker(d->heightAnim);
d->heightAnim->setStartValue(this->height() - 1);
d->heightAnim->setEndValue(d->mainBarWidget->statusBarHeight());
d->heightAnim->setEasingCurve(QEasingCurve::OutCubic);
d->heightAnim->stop();
d->heightAnim->start();
d->barExpanding = false;
}
}
void BarWindow::trackBarPullDownGesture(GestureInteractionPtr gesture) {
if (d->statusCenterShown || d->barExpanding) return;
// Capture this gesture!
d->lastGesture = gesture;
QSignalBlocker blocker(d->heightAnim);
d->heightAnim->setStartValue(this->height() - 1);
d->heightAnim->setEndValue(d->mainBarWidget->expandedHeight());
d->heightAnim->setEasingCurve(QEasingCurve::Linear);
d->heightAnim->stop();
d->barExpanding = true;
connect(gesture.data(), &GestureInteraction::interactionUpdated, this, [=] {
d->heightAnim->setCurrentTime(d->heightAnim->totalDuration() * gesture->percentage());
d->heightAnim->valueChanged(d->heightAnim->currentValue());
});
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.7) {
showBar();
QTimer::singleShot(3000, this, [=] {
if (gesture == d->lastGesture && !this->underMouse()) hideBar();
});
} else {
hideBar();
}
});
}
void BarWindow::trackStatusCenterPullDownGesture(GestureInteractionPtr gesture) {
if (d->statusCenterShown) return;
// Capture this gesture!
d->lastGesture = gesture;
d->barStatusCenterTransitionAnim->setDirection(tVariantAnimation::Forward);
d->barStatusCenterTransitionAnim->setCurrentTime(0);
connect(gesture.data(), &GestureInteraction::interactionUpdated, this, [=] {
d->barStatusCenterTransitionAnim->setCurrentTime(d->barStatusCenterTransitionAnim->totalDuration() * gesture->percentage());
d->barStatusCenterTransitionAnim->valueChanged(d->barStatusCenterTransitionAnim->currentValue());
});
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.7) {
showStatusCenter();
} else {
hideStatusCenter();
}
});
}
void BarWindow::trackStatusCenterPullUpGesture(GestureInteractionPtr gesture) {
if (!d->statusCenterShown) return;
// Only accept this gesture if there is not currently a popover active
QList childWidgets;
childWidgets.append(this);
while (!childWidgets.isEmpty()) {
QWidget* w = childWidgets.takeFirst();
if (tPopover::popoverForPopoverWidget(w)) return;
for (QObject* o : w->children()) {
if (qobject_cast(o)) childWidgets.append(qobject_cast(o));
}
}
// Capture this gesture!
d->lastGesture = gesture;
d->barStatusCenterTransitionAnim->setDirection(tVariantAnimation::Forward);
d->barStatusCenterTransitionAnim->setCurrentTime(d->barStatusCenterTransitionAnim->duration());
connect(gesture.data(), &GestureInteraction::interactionUpdated, this, [=] {
d->barStatusCenterTransitionAnim->setCurrentTime(d->barStatusCenterTransitionAnim->totalDuration() - d->barStatusCenterTransitionAnim->totalDuration() * gesture->percentage());
d->barStatusCenterTransitionAnim->valueChanged(d->barStatusCenterTransitionAnim->currentValue());
});
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.3) {
hideStatusCenter();
} else {
showStatusCenter();
}
});
}
void BarWindow::mouseMoveEvent(QMouseEvent* event) {
if (event->pos().x() < d->mainBarWidget->currentAppWidgetX() && d->barPendingShow) showBar();
}
================================================
FILE: desktop/bar/barwindow.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef BARWINDOW_H
#define BARWINDOW_H
#include
#include
#include
namespace Ui {
class BarWindow;
}
struct BarWindowPrivate;
class BarWindow : public QWidget {
Q_OBJECT
public:
explicit BarWindow(QWidget* parent = nullptr);
~BarWindow();
void setFixedHeight(int height);
void setFixedWidth(int width);
private:
Ui::BarWindow* ui;
BarWindowPrivate* d;
void resizeEvent(QResizeEvent* event);
void enterEvent(QEnterEvent* event);
void leaveEvent(QEvent* event);
void paintEvent(QPaintEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void trackWindow(DesktopWmWindowPtr window);
void updatePrimaryScreen();
void barHeightChanged();
void showStatusCenter();
void hideStatusCenter();
void showBar();
void hideBar();
void trackBarPullDownGesture(GestureInteractionPtr gesture);
void trackStatusCenterPullDownGesture(GestureInteractionPtr gesture);
void trackStatusCenterPullUpGesture(GestureInteractionPtr gesture);
};
#endif // BARWINDOW_H
================================================
FILE: desktop/bar/barwindow.ui
================================================
BarWindow
0
0
636
300
Form
130
250
118
1
16777215
1
Qt::Horizontal
================================================
FILE: desktop/bar/chunkcontainer.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "chunkcontainer.h"
#include "ui_chunkcontainer.h"
#include "common/common.h"
#include
#include
#include
#include
#include
#include
#include
struct ChunkContainerPrivate {
BarManager* barManager;
QList> loadedChunks;
QStringList preferredChunkOrder = {
"OverviewClock",
"Power",
"PowerStretch",
"flight-mode",
"network-cellular",
"Network",
"network-tethering",
"bluetooth",
"audio",
"audio-mic",
"redshift",
"keyboardlayout",
"caffeinate",
"Accessibility-StickyKeys",
"mpris"};
QMap chunkWidgets;
qreal currentAnimProgress = 1;
};
ChunkContainer::ChunkContainer(QWidget* parent) :
QWidget(parent),
ui(new Ui::ChunkContainer) {
ui->setupUi(this);
d = new ChunkContainerPrivate();
d->barManager = StateManager::barManager();
ui->statusCenterButtonLine->setVisible(false);
connect(d->barManager, &BarManager::chunkAdded, this, &ChunkContainer::chunkAdded);
connect(d->barManager, &BarManager::chunkRemoved, this, &ChunkContainer::chunkRemoved);
for (Chunk* chunk : d->barManager->chunks()) {
this->chunkAdded(chunk);
}
connect(StateManager::barManager(), &BarManager::barHeightTransitioning, this, [=](qreal percentage) {
int spacing = 3 + 3 * percentage;
ui->chunkLayout->setSpacing(spacing);
});
connect(ui->scrollArea->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=](int value) {
ui->statusCenterButtonLine->setVisible(value != 0);
});
QPalette pal;
pal.setBrush(QPalette::Window, Qt::transparent);
ui->scrollArea->setPalette(pal);
ui->scrollAreaWidgetContents->setPalette(pal);
}
ChunkContainer::~ChunkContainer() {
delete d;
delete ui;
ui = nullptr;
}
int ChunkContainer::statusBarHeight() {
int maxHeight = 0;
for (Chunk* chunk : d->barManager->chunks()) {
maxHeight = qMax(chunk->statusBarHeight(), maxHeight);
}
return maxHeight;
}
int ChunkContainer::expandedHeight() {
int maxHeight = 0;
for (Chunk* chunk : d->barManager->chunks()) {
maxHeight = qMax(chunk->expandedHeight(), maxHeight);
}
return maxHeight;
}
int ChunkContainer::currentAppWidgetX() {
return this->layoutDirection() == Qt::RightToLeft ? ui->currentAppWidget->width() : ui->currentAppWidget->x();
}
void ChunkContainer::barHeightChanged(int height) {
// if (height >= statusBarHeight() && height <= expandedHeight()) {
// this->setFixedHeight(height);
// }
int boundHeight = qBound(statusBarHeight(), height, expandedHeight());
this->setFixedHeight(boundHeight);
ui->chunkWidget->setFixedHeight(boundHeight);
qreal percentageAnim = static_cast((height - statusBarHeight())) / (expandedHeight() - statusBarHeight());
if (percentageAnim < 0) percentageAnim = 0;
if (percentageAnim > 1) percentageAnim = 1;
d->barManager->barHeightTransitioning(percentageAnim);
ui->currentAppWidget->barHeightChanging(percentageAnim);
d->currentAnimProgress = percentageAnim;
}
void ChunkContainer::paintEvent(QPaintEvent* event) {
}
void ChunkContainer::chunkAdded(Chunk* chunk) {
// Create a chunk widget
QWidget* chunkWidget = new QWidget(this);
QBoxLayout* chunkWidgetLayout = new QBoxLayout(QBoxLayout::LeftToRight, chunkWidget);
QFrame* line = new QFrame(chunkWidget);
line->setFrameShape(QFrame::VLine);
line->setFixedWidth(1);
chunkWidgetLayout->addWidget(line);
chunkWidgetLayout->addWidget(chunk);
chunkWidgetLayout->setSpacing(0);
chunkWidgetLayout->setContentsMargins(0, 0, 0, 0);
chunkWidget->setLayout(chunkWidgetLayout);
d->chunkWidgets.insert(chunk, chunkWidget);
QGraphicsOpacityEffect* lineOpacity = new QGraphicsOpacityEffect(line);
lineOpacity->setOpacity(d->currentAnimProgress);
line->setGraphicsEffect(lineOpacity);
QStringList currentItems;
for (QPair item : d->loadedChunks) {
currentItems.append(item.first);
}
int index = Common::getInsertionIndex(d->preferredChunkOrder, currentItems, chunk->name());
if (index == -1) {
// Add it at the end
ui->chunkLayout->addWidget(chunkWidget);
d->loadedChunks.append({chunk->name(), chunk});
} else {
// Add this chunk at the beginning
ui->chunkLayout->insertWidget(index, chunkWidget);
d->loadedChunks.insert(index, {chunk->name(), chunk});
}
connect(this, &ChunkContainer::chunksChanged, chunkWidget, [=] {
// Make sure the line is not visible and set the margins appropriately
for (int i = 0; i < d->loadedChunks.count(); i++) {
QPair chunkDescriptor = d->loadedChunks.at(i);
if (chunkDescriptor.second == chunk) {
line->setVisible(i != 0);
return;
}
}
});
connect(StateManager::barManager(), &BarManager::barHeightTransitioning, lineOpacity, &QGraphicsOpacityEffect::setOpacity);
emit statusBarHeightChanged();
emit expandedHeightChanged();
emit chunksChanged();
}
void ChunkContainer::chunkRemoved(Chunk* chunk) {
if (!ui) return;
for (int i = 0; i < d->loadedChunks.count(); i++) {
if (d->loadedChunks.at(i).second == chunk) {
QWidget* chunkWidget = d->chunkWidgets.take(chunk);
ui->chunkLayout->removeWidget(chunkWidget);
d->loadedChunks.removeAt(i);
chunk->setParent(nullptr);
chunkWidget->deleteLater();
emit statusBarHeightChanged();
emit expandedHeightChanged();
return;
}
}
}
void ChunkContainer::on_statusCenterButton_clicked() {
StateManager::statusCenterManager()->showStatusCenter();
}
================================================
FILE: desktop/bar/chunkcontainer.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef CHUNKCONTAINER_H
#define CHUNKCONTAINER_H
#include
namespace Ui {
class ChunkContainer;
}
class Chunk;
struct ChunkContainerPrivate;
class ChunkContainer : public QWidget {
Q_OBJECT
public:
explicit ChunkContainer(QWidget* parent = nullptr);
~ChunkContainer();
int statusBarHeight();
int expandedHeight();
int currentAppWidgetX();
void barHeightChanged(int height);
signals:
void statusBarHeightChanged();
void expandedHeightChanged();
void chunksChanged();
private slots:
void on_statusCenterButton_clicked();
private:
Ui::ChunkContainer* ui;
ChunkContainerPrivate* d;
void paintEvent(QPaintEvent* event);
void chunkAdded(Chunk* chunk);
void chunkRemoved(Chunk* chunk);
};
#endif // CHUNKCONTAINER_H
================================================
FILE: desktop/bar/chunkcontainer.ui
================================================
ChunkContainer
0
0
400
23
Form
0
0
0
0
0
-
0
0
Open Status Center
..
-
1
16777215
Qt::Vertical
-
0
0
QFrame::NoFrame
Qt::ScrollBarAlwaysOff
Qt::ScrollBarAlwaysOff
QAbstractScrollArea::AdjustToContents
true
0
0
365
23
0
0
0
0
0
-
0
0
0
9
0
9
0
-
Qt::Horizontal
0
20
-
CurrentAppWidget
QWidget
1
================================================
FILE: desktop/bar/currentappwidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "currentappwidget.h"
#include "ui_currentappwidget.h"
#include
#include
#include
#include
#include
#include
#include
#include "currentappwidgetmenu.h"
struct CurrentAppWidgetPrivate {
QPalette pal;
QGraphicsOpacityEffect* opacity;
tVariantAnimation* anim;
QuickWidgetContainer* menuContainer;
CurrentAppWidgetMenu* menu;
KeyGrab* forceStopGrab;
};
CurrentAppWidget::CurrentAppWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::CurrentAppWidget) {
ui->setupUi(this);
d = new CurrentAppWidgetPrivate();
d->pal = this->palette();
d->pal.setColor(QPalette::Window, QColor(0, 0, 0, 0));
this->setPalette(d->pal);
d->opacity = new QGraphicsOpacityEffect(this);
d->opacity->setOpacity(1);
this->setGraphicsEffect(d->opacity);
d->anim = new tVariantAnimation(this);
d->anim->setStartValue(0.0);
d->anim->setEndValue(1.0);
d->anim->setDuration(200);
connect(d->anim, &tVariantAnimation::valueChanged, this, [ = ](QVariant value) {
d->opacity->setOpacity(value.toReal());
});
d->menu = new CurrentAppWidgetMenu();
d->menuContainer = new QuickWidgetContainer(this);
d->menuContainer->setQuickWidget(d->menu);
connect(d->menuContainer, &QuickWidgetContainer::hiding, this, &CurrentAppWidget::activeWindowChanged);
connect(d->menu, &CurrentAppWidgetMenu::done, d->menuContainer, &QuickWidgetContainer::hideContainer);
connect(DesktopWm::instance(), &DesktopWm::activeWindowChanged, this, &CurrentAppWidget::activeWindowChanged);
activeWindowChanged();
d->forceStopGrab = new KeyGrab(QKeySequence(Qt::ControlModifier | Qt::AltModifier | Qt::Key_Escape), "force-stop");
connect(d->forceStopGrab, &KeyGrab::activated, this, [ = ] {
DesktopWmWindowPtr active = DesktopWm::activeWindow();
if (!active->application()) return;
d->menu->setWindow(active);
d->menu->showForceStopScreen();
if (!d->menuContainer->isShowing()) d->menuContainer->showContainer();
});
}
CurrentAppWidget::~CurrentAppWidget() {
delete d;
delete ui;
}
void CurrentAppWidget::barHeightChanging(float barTransitionPercentage) {
if (qFuzzyIsNull(barTransitionPercentage)) {
this->setFixedWidth(QWIDGETSIZE_MAX);
this->setVisible(true);
} else if (qFuzzyCompare(barTransitionPercentage, 1)) {
this->setVisible(false);
} else {
this->setFixedWidth(this->sizeHint().width() * (1 - barTransitionPercentage));
this->setVisible(true);
}
}
void CurrentAppWidget::activeWindowChanged() {
if (d->menuContainer->isShowing()) return;
DesktopWmWindowPtr active = DesktopWm::activeWindow();
if (active) {
ApplicationPointer app = active->application();
if (app) {
ui->iconLabel->setPixmap(QIcon::fromTheme(app->getProperty("Icon").toString()).pixmap(SC_DPI_T(QSize(16, 16), QSize)));
ui->currentAppLabel->setText(app->getProperty("Name").toString());
if (d->anim->direction() == tVariantAnimation::Backward) {
d->anim->setDirection(tVariantAnimation::Forward);
d->anim->start();
}
} else {
if (d->anim->direction() == tVariantAnimation::Forward) {
d->anim->setDirection(tVariantAnimation::Backward);
d->anim->start();
}
}
} else {
ui->iconLabel->setPixmap(QIcon(":/thedesk/desktop/thedesk.svg").pixmap(SC_DPI_T(QSize(16, 16), QSize)));
ui->currentAppLabel->setText(QStringLiteral("theDesk"));
if (d->anim->direction() == tVariantAnimation::Backward) {
d->anim->setDirection(tVariantAnimation::Forward);
d->anim->start();
}
}
}
void CurrentAppWidget::enterEvent(QEvent* event) {
QPalette pal = d->pal;
pal.setColor(QPalette::Window, QColor(255, 255, 255, 100));
this->setPalette(pal);
}
void CurrentAppWidget::leaveEvent(QEvent* event) {
this->setPalette(d->pal);
}
void CurrentAppWidget::mousePressEvent(QMouseEvent* event) {
QPalette pal = d->pal;
pal.setColor(QPalette::Window, QColor(0, 0, 0, 100));
this->setPalette(pal);
}
void CurrentAppWidget::mouseReleaseEvent(QMouseEvent* event) {
QPalette pal = d->pal;
pal.setColor(QPalette::Window, QColor(255, 255, 255, 100));
this->setPalette(pal);
if (this->underMouse()) {
//Click!
DesktopWmWindowPtr active = DesktopWm::activeWindow();
if (!active || !active->application()) return;
d->menu->setWindow(active);
if (!d->menuContainer->isShowing()) d->menuContainer->showContainer();
}
}
================================================
FILE: desktop/bar/currentappwidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef CURRENTAPPWIDGET_H
#define CURRENTAPPWIDGET_H
#include
namespace Ui {
class CurrentAppWidget;
}
struct CurrentAppWidgetPrivate;
class CurrentAppWidget : public QWidget {
Q_OBJECT
public:
explicit CurrentAppWidget(QWidget* parent = nullptr);
~CurrentAppWidget();
void barHeightChanging(float barTransitionPercentage);
private:
Ui::CurrentAppWidget* ui;
CurrentAppWidgetPrivate* d;
void activeWindowChanged();
// QWidget interface
protected:
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
};
#endif // CURRENTAPPWIDGET_H
================================================
FILE: desktop/bar/currentappwidget.ui
================================================
CurrentAppWidget
0
0
90
35
Form
true
0
0
0
0
0
-
1
16777215
Qt::Vertical
-
6
3
3
3
3
-
Icon
-
Current App
================================================
FILE: desktop/bar/currentappwidgetmenu.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "currentappwidgetmenu.h"
#include "ui_currentappwidgetmenu.h"
#include
struct CurrentAppWidgetMenuPrivate {
DesktopWmWindowPtr window;
QList actionButtons;
};
CurrentAppWidgetMenu::CurrentAppWidgetMenu(QWidget* parent) :
QWidget(parent),
ui(new Ui::CurrentAppWidgetMenu) {
ui->setupUi(this);
d = new CurrentAppWidgetMenuPrivate();
ui->quitImmediateButton->setProperty("type", "destructive");
ui->doQuitImmediateButton->setProperty("type", "destructive");
updateModifiers();
ui->stackedWidget->setCurrentAnimation(tStackedWidget::SlideHorizontal);
}
CurrentAppWidgetMenu::~CurrentAppWidgetMenu() {
delete d;
delete ui;
}
QSize CurrentAppWidgetMenu::sizeHint() const {
return this->size();
}
void CurrentAppWidgetMenu::setWindow(DesktopWmWindowPtr window) {
for (QPushButton* button : d->actionButtons) {
ui->actionsLayout->removeWidget(button);
button->setVisible(false);
button->deleteLater();
}
d->actionButtons.clear();
d->window = window;
QString applicationName = window->application()->getProperty("Name").toString();
ui->quitImmediateButton->setText(tr("Force Stop"));
ui->quitImmediateTitle->setText(tr("Force Stop %1").arg(applicationName).toUpper());
ui->quitImmediateDescription->setText(tr("%1 will be forced to exit and won't have a chance to save any unsaved data.").arg(applicationName));
ui->doQuitImmediateButton->setText(tr("Force Stop %1").arg(applicationName));
ui->cancelImmediateQuitButton->setVisible(true);
QStringList actions = window->application()->getStringList("Actions");
for (const QString& action : qAsConst(actions)) {
QPushButton* button = new QPushButton();
button->setText(window->application()->getActionProperty(action, "Name").toString());
connect(button, &QPushButton::clicked, this, [ = ] {
window->application()->launchAction(action);
emit done();
});
ui->actionsLayout->addWidget(button);
d->actionButtons.append(button);
}
ui->actionsWidget->setVisible(!actions.isEmpty());
ui->stackedWidget->setCurrentWidget(ui->initialPage, false);
updateModifiers();
}
void CurrentAppWidgetMenu::showForceStopScreen() {
ui->cancelImmediateQuitButton->setVisible(false);
ui->stackedWidget->setCurrentWidget(ui->quitImmediatelyPage, false);
this->setFixedSize(ui->stackedWidget->currentWidget()->sizeHint());
}
void CurrentAppWidgetMenu::updateModifiers() {
bool showExtraOptions = qApp->queryKeyboardModifiers() & Qt::ShiftModifier;
ui->quitImmediateButton->setVisible(showExtraOptions);
on_stackedWidget_switchingFrame(ui->stackedWidget->currentIndex());
}
void CurrentAppWidgetMenu::on_closeWindowButton_clicked() {
d->window->close();
emit done();
}
void CurrentAppWidgetMenu::keyPressEvent(QKeyEvent* event) {
updateModifiers();
}
void CurrentAppWidgetMenu::keyReleaseEvent(QKeyEvent* event) {
updateModifiers();
}
void CurrentAppWidgetMenu::on_doQuitImmediateButton_clicked() {
d->window->kill();
emit done();
}
void CurrentAppWidgetMenu::on_cancelImmediateQuitButton_clicked() {
ui->stackedWidget->setCurrentWidget(ui->initialPage);
}
void CurrentAppWidgetMenu::on_quitImmediateButton_clicked() {
ui->stackedWidget->setCurrentWidget(ui->quitImmediatelyPage);
}
void CurrentAppWidgetMenu::on_stackedWidget_switchingFrame(int frame) {
QTimer::singleShot(0, [ = ] {
tVariantAnimation::singleShot(this, this->size(), ui->stackedWidget->widget(frame)->sizeHint(), 250, [ = ](QVariant value) {
this->setFixedSize(value.toSize());
});
});
}
================================================
FILE: desktop/bar/currentappwidgetmenu.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef CURRENTAPPWIDGETMENU_H
#define CURRENTAPPWIDGETMENU_H
#include
#include
namespace Ui {
class CurrentAppWidgetMenu;
}
struct CurrentAppWidgetMenuPrivate;
class CurrentAppWidgetMenu : public QWidget {
Q_OBJECT
public:
explicit CurrentAppWidgetMenu(QWidget* parent = nullptr);
~CurrentAppWidgetMenu();
QSize sizeHint() const;
void setWindow(DesktopWmWindowPtr window);
void showForceStopScreen();
void updateModifiers();
private slots:
void on_closeWindowButton_clicked();
void on_doQuitImmediateButton_clicked();
void on_cancelImmediateQuitButton_clicked();
void on_quitImmediateButton_clicked();
void on_stackedWidget_switchingFrame(int frame);
signals:
void done();
private:
Ui::CurrentAppWidgetMenu* ui;
CurrentAppWidgetMenuPrivate* d;
// QWidget interface
protected:
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
};
#endif // CURRENTAPPWIDGETMENU_H
================================================
FILE: desktop/bar/currentappwidgetmenu.ui
================================================
CurrentAppWidgetMenu
0
0
400
105
Form
0
0
0
0
0
-
0
0
0
0
0
0
-
0
0
0
0
0
-
Close Window
..
-
0
0
0
0
0
-
16777215
1
Qt::Horizontal
-
-
16777215
1
Qt::Horizontal
-
Quit Immediately
..
0
0
0
0
0
-
9
9
9
6
-
true
QUIT IMMEDIATELY
-
TextLabel
-
Cancel
..
-
Quit Immediately
..
tStackedWidget
QStackedWidget
1
switchingFrame(int)
================================================
FILE: desktop/bar/mainbarwidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "mainbarwidget.h"
#include "ui_mainbarwidget.h"
#include "gateway/gateway.h"
#include
#include
#include
#include
#include
#include
#include
MainBarWidget::MainBarWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::MainBarWidget) {
ui->setupUi(this);
ui->gatewayButton->setIconSize(SC_DPI_T(QSize(32, 32), QSize));
connect(ui->chunkContainer, &ChunkContainer::expandedHeightChanged, this, &MainBarWidget::expandedHeightChanged);
connect(ui->chunkContainer, &ChunkContainer::statusBarHeightChanged, this, &MainBarWidget::statusBarHeightChanged);
connect(new KeyGrab(QKeySequence(Qt::Key_Super_L), "gatewayOpen"), &KeyGrab::activated, this, [=] {
Gateway::instance()->show();
});
}
MainBarWidget::~MainBarWidget() {
delete ui;
}
int MainBarWidget::statusBarHeight() {
return ui->chunkContainer->statusBarHeight();
}
int MainBarWidget::expandedHeight() {
return ui->chunkContainer->expandedHeight() + ui->mainContentsWidget->sizeHint().height();
}
int MainBarWidget::currentAppWidgetX() {
return ui->chunkContainer->currentAppWidgetX();
}
void MainBarWidget::barHeightChanged(int height) {
ui->chunkContainer->barHeightChanged(height);
}
void MainBarWidget::on_gatewayButton_clicked() {
Gateway::instance()->show();
}
================================================
FILE: desktop/bar/mainbarwidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef MAINBARWIDGET_H
#define MAINBARWIDGET_H
#include
namespace Ui {
class MainBarWidget;
}
class MainBarWidget : public QWidget {
Q_OBJECT
public:
explicit MainBarWidget(QWidget* parent = nullptr);
~MainBarWidget();
int statusBarHeight();
int expandedHeight();
int currentAppWidgetX();
void barHeightChanged(int height);
signals:
void statusBarHeightChanged();
void expandedHeightChanged();
private slots:
void on_gatewayButton_clicked();
private:
Ui::MainBarWidget* ui;
};
#endif // MAINBARWIDGET_H
================================================
FILE: desktop/bar/mainbarwidget.ui
================================================
MainBarWidget
0
0
724
195
Form
0
0
0
0
0
-
-
0
0
0
0
0
-
0
0
:/thedesk/desktop/icons/thedesk.svg:/thedesk/desktop/icons/thedesk.svg
32
32
true
-
0
0
-
Qt::Vertical
0
0
ChunkContainer
QWidget
1
TaskbarWidget
QWidget
1
================================================
FILE: desktop/bar/taskbarapplicationwidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "taskbarapplicationwidget.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct TaskbarApplicationWidgetPrivate {
ApplicationPointer app;
uint desktop;
ActionQuickWidget* windowListMenu;
QuickWidgetContainer* windowListMenuContainer;
QList trackedWindows;
QMap actions;
};
TaskbarApplicationWidget::TaskbarApplicationWidget(QString desktopEntry, uint desktop, QWidget* parent) :
QPushButton(parent) {
d = new TaskbarApplicationWidgetPrivate();
d->app = ApplicationPointer(new Application(desktopEntry));
d->desktop = desktop;
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
this->setCheckable(true);
connect(DesktopWm::instance(), &DesktopWm::windowRemoved, this, [=](DesktopWmWindowPtr window) {
removeTrackedWindow(window);
});
connect(DesktopWm::instance(), &DesktopWm::activeWindowChanged, this, &TaskbarApplicationWidget::updateActive);
connect(this, &TaskbarApplicationWidget::clicked, this, [=] {
if (d->trackedWindows.count() == 1) {
d->trackedWindows.first()->activate();
} else {
if (!d->windowListMenuContainer->isShowing()) d->windowListMenuContainer->showContainer();
}
updateActive();
});
this->setIconSize(SC_DPI_T(QSize(32, 32), QSize));
d->windowListMenuContainer = new QuickWidgetContainer(this);
d->windowListMenu = new ActionQuickWidget(d->windowListMenuContainer);
d->windowListMenuContainer->setQuickWidget(d->windowListMenu);
// connect(d->windowListMenu, &ActionQuickWidget::done, d->menuContainer, &QuickWidgetContainer::hideContainer);
updateIcon();
}
TaskbarApplicationWidget::~TaskbarApplicationWidget() {
delete d;
}
void TaskbarApplicationWidget::trackWindow(DesktopWmWindowPtr window) {
if (d->trackedWindows.contains(window)) return;
QAction* action = new QAction(this);
action->setText(window->title());
connect(window, &DesktopWmWindow::titleChanged, action, [=] {
action->setText(window->title());
});
connect(action, &QAction::triggered, window, [=] {
window->activate();
});
d->actions.insert(window, action);
d->windowListMenu->addAction(action);
d->trackedWindows.append(window);
updateIcon();
updateActive();
}
void TaskbarApplicationWidget::removeTrackedWindow(DesktopWmWindowPtr window) {
if (!d->trackedWindows.contains(window)) return;
window->disconnect(this);
d->trackedWindows.removeOne(window);
QAction* action = d->actions.take(window);
d->windowListMenu->removeAction(action);
action->deleteLater();
updateIcon();
updateActive();
if (d->trackedWindows.isEmpty()) emit windowsRemoved();
}
QList TaskbarApplicationWidget::trackedWindows() {
return d->trackedWindows;
}
void TaskbarApplicationWidget::setColor(QColor color) {
QPalette pal = this->palette();
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
}
void TaskbarApplicationWidget::resizeEvent(QResizeEvent* event) {
this->setFixedWidth(this->height());
}
void TaskbarApplicationWidget::updateIcon() {
if (d->app->isValid()) {
this->setIcon(d->app->icon());
} else if (!d->trackedWindows.isEmpty()) {
this->setIcon(d->trackedWindows.first()->icon());
} else {
this->setIcon(QIcon::fromTheme("generic-app"));
}
emit iconChanged();
}
void TaskbarApplicationWidget::updateActive() {
this->setChecked(d->trackedWindows.contains(DesktopWm::activeWindow()));
}
void TaskbarApplicationWidget::contextMenuEvent(QContextMenuEvent* event) {
auto menu = new QMenu(this);
if (d->trackedWindows.count() == 1) {
auto win = d->trackedWindows.constFirst();
menu->addSection(tr("For %1").arg(QLocale().quoteString(win->title())));
QMenu* desktopsMenu = new QMenu(menu);
desktopsMenu->setTitle(tr("Move to desktop"));
auto desktopsGroup = new QActionGroup(desktopsMenu);
desktopsGroup->setExclusive(true);
auto allDesktopsAction = desktopsMenu->addAction(tr("All Desktops"), [win] {
win->moveToDesktop(UINT_MAX);
});
desktopsGroup->addAction(allDesktopsAction);
allDesktopsAction->setCheckable(true);
if (win->desktop() == UINT_MAX) allDesktopsAction->setChecked(true);
desktopsMenu->addSeparator();
for (auto i = 0; i < DesktopWm::desktops().count() - 1; i++) {
auto desktopName = DesktopWm::desktops().at(i);
auto action = desktopsMenu->addAction(desktopName, [win, i] {
win->moveToDesktop(i);
});
desktopsGroup->addAction(action);
action->setCheckable(true);
if (i == win->desktop()) action->setChecked(true);
}
desktopsMenu->addSeparator();
desktopsMenu->addAction(QIcon::fromTheme("list-add"), tr("New Desktop"), [win] {
win->moveToDesktop(DesktopWm::desktops().count() - 1);
});
menu->addMenu(desktopsMenu);
menu->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, [win] {
win->close();
});
} else {
if (d->app->isValid()) {
menu->addSection(tr("For %n %1 windows", nullptr, d->trackedWindows.count()).arg(QLocale().quoteString(d->app->getProperty("Name").toString())));
} else {
menu->addSection(tr("For %n windows", nullptr, d->trackedWindows.count()));
}
menu->addAction(QIcon::fromTheme("application-exit"), tr("Close All"), this, [this] {
for (auto win : d->trackedWindows) {
win->close();
}
});
}
auto locker = StateManager::barManager()->acquireLock();
connect(menu, &QMenu::aboutToHide, this, [locker, menu] {
locker->unlock();
menu->deleteLater();
});
menu->popup(event->globalPos());
}
================================================
FILE: desktop/bar/taskbarapplicationwidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef TASKBARAPPLICATIONWIDGET_H
#define TASKBARAPPLICATIONWIDGET_H
#include
class DesktopWmWindow;
typedef QPointer DesktopWmWindowPtr;
struct TaskbarApplicationWidgetPrivate;
class TaskbarApplicationWidget : public QPushButton {
Q_OBJECT
public:
explicit TaskbarApplicationWidget(QString desktopEntry, uint desktop, QWidget* parent = nullptr);
~TaskbarApplicationWidget();
void trackWindow(DesktopWmWindowPtr window);
void removeTrackedWindow(DesktopWmWindowPtr window);
QList trackedWindows();
void setColor(QColor color);
signals:
void iconChanged();
void windowsRemoved();
private:
TaskbarApplicationWidgetPrivate* d;
void resizeEvent(QResizeEvent* event);
void updateIcon();
void updateActive();
// QWidget interface
protected:
void contextMenuEvent(QContextMenuEvent *event);
};
#endif // TASKBARAPPLICATIONWIDGET_H
================================================
FILE: desktop/bar/taskbardesktopwidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "taskbardesktopwidget.h"
#include "ui_taskbardesktopwidget.h"
#include "taskbarapplicationwidget.h"
#include
#include
#include
#include
struct TaskbarDesktopWidgetPrivate {
QMap applicationWidgets;
QList applicationWidgetOrder;
uint desktop;
QColor color;
tVariantAnimation* progressAnim;
const QRgb colors[6] = {
0x0000c8,
0x006400,
0x640000,
0xff6400,
0x0064ff,
0x6400ff};
};
TaskbarDesktopWidget::TaskbarDesktopWidget(uint desktop, QWidget* parent) :
QWidget(parent),
ui(new Ui::TaskbarDesktopWidget) {
ui->setupUi(this);
d = new TaskbarDesktopWidgetPrivate();
d->desktop = desktop;
d->color = QColor::fromRgb(d->colors[desktop % 6]);
d->progressAnim = new tVariantAnimation();
d->progressAnim->setStartValue(0.0);
d->progressAnim->setEndValue(1.0);
d->progressAnim->setDuration(250);
d->progressAnim->setEasingCurve(QEasingCurve::OutCubic);
connect(d->progressAnim, &tVariantAnimation::valueChanged, this, &TaskbarDesktopWidget::updateAnimation);
connect(d->progressAnim, &tVariantAnimation::finished, this, &TaskbarDesktopWidget::finishAnimation);
if (DesktopWm::currentDesktop() == d->desktop) d->progressAnim->setCurrentTime(d->progressAnim->duration());
finishAnimation();
connect(DesktopWm::instance(), &DesktopWm::currentDesktopChanged, this, &TaskbarDesktopWidget::updateDesktop);
connect(DesktopWm::instance(), &DesktopWm::windowAdded, this, &TaskbarDesktopWidget::windowAdded);
connect(DesktopWm::instance(), &DesktopWm::windowRemoved, this, &TaskbarDesktopWidget::windowRemoved);
for (DesktopWmWindowPtr window : DesktopWm::openWindows()) {
this->windowAdded(window);
}
QPalette pal = ui->desktopOverviewButton->palette();
pal.setColor(QPalette::Button, d->color);
ui->desktopOverviewButton->setPalette(pal);
ui->desktopOverviewButton->setIconSize(SC_DPI_T(QSize(32, 32), QSize));
updateOverviewButtonIcon();
}
TaskbarDesktopWidget::~TaskbarDesktopWidget() {
delete d;
delete ui;
}
void TaskbarDesktopWidget::moveDesktop(uint newDesktop) {
d->desktop = newDesktop;
QList windowsToMove;
for (TaskbarApplicationWidget* widget : d->applicationWidgetOrder) {
windowsToMove.append(widget->trackedWindows());
}
for (DesktopWmWindowPtr window : windowsToMove) {
window->moveToDesktop(newDesktop);
}
}
void TaskbarDesktopWidget::windowAdded(DesktopWmWindowPtr window) {
connect(window, &DesktopWmWindow::desktopChanged, this, [this, window] {
if (window->isOnDesktop(d->desktop) && window->shouldShowInTaskbar()) {
registerOnDesktop(window);
} else {
deregisterFromDesktop(window);
}
});
if (window->isOnDesktop(d->desktop) && window->shouldShowInTaskbar()) registerOnDesktop(window);
}
void TaskbarDesktopWidget::windowRemoved(DesktopWmWindowPtr window) {
deregisterFromDesktop(window);
}
void TaskbarDesktopWidget::registerOnDesktop(DesktopWmWindowPtr window) {
QString desktopEntry = QString::number(window->pid());
if (window->application()) desktopEntry = window->application()->desktopEntry();
TaskbarApplicationWidget* widget;
if (d->applicationWidgets.contains(desktopEntry)) {
widget = d->applicationWidgets.value(desktopEntry);
} else {
widget = new TaskbarApplicationWidget(desktopEntry, d->desktop, this);
widget->setColor(d->color);
connect(widget, &TaskbarApplicationWidget::iconChanged, this, &TaskbarDesktopWidget::updateOverviewButtonIcon);
connect(widget, &TaskbarApplicationWidget::windowsRemoved, this, [=] {
d->applicationWidgets.remove(desktopEntry);
d->applicationWidgetOrder.removeOne(widget);
ui->applicationsLayout->removeWidget(widget);
widget->deleteLater();
updateOverviewButtonIcon();
});
ui->applicationsLayout->addWidget(widget);
d->applicationWidgets.insert(desktopEntry, widget);
d->applicationWidgetOrder.append(widget);
}
widget->trackWindow(window);
updateOverviewButtonIcon();
}
void TaskbarDesktopWidget::deregisterFromDesktop(DesktopWmWindowPtr window) {
QString desktopEntry = QString::number(window->pid());
if (window->application()) desktopEntry = window->application()->desktopEntry();
if (d->applicationWidgets.contains(desktopEntry)) {
TaskbarApplicationWidget* widget = d->applicationWidgets.value(desktopEntry);
widget->removeTrackedWindow(window);
}
}
void TaskbarDesktopWidget::updateOverviewButtonIcon() {
QPixmap pixmap(SC_DPI_T(QSize(32, 32), QSize));
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
for (int i = 0; i < 4; i++) {
if (d->applicationWidgetOrder.count() <= i) continue;
QRect boxGeometry;
boxGeometry.setSize(SC_DPI_T(QSize(16, 16), QSize));
boxGeometry.moveTopLeft(QPoint(SC_DPI(16) * (i % 2), SC_DPI(16) * (i / 2)));
QRect geometry;
geometry.setSize(SC_DPI_T(QSize(14, 14), QSize));
geometry.moveCenter(boxGeometry.center());
if (i == 3 && d->applicationWidgetOrder.count() > 4) {
QFont font = this->font();
font.setPixelSize(geometry.height());
painter.setFont(font);
painter.setPen(this->palette().color(QPalette::ButtonText));
painter.drawText(geometry, Qt::AlignCenter, QStringLiteral("%1%2").arg(QLocale().positiveSign()).arg(d->applicationWidgetOrder.count() - 3));
} else {
QPixmap icon(d->applicationWidgetOrder.at(i)->icon().pixmap(geometry.size()));
painter.drawPixmap(geometry, icon);
}
}
ui->desktopOverviewButton->setIcon(QIcon(pixmap));
}
void TaskbarDesktopWidget::updateDesktop() {
if (DesktopWm::currentDesktop() == d->desktop && d->progressAnim->currentValue().toReal() < 0.5) {
d->progressAnim->setDirection(tVariantAnimation::Forward);
d->progressAnim->start();
} else if (DesktopWm::currentDesktop() != d->desktop && d->progressAnim->currentValue().toReal() > 0.5) {
d->progressAnim->setDirection(tVariantAnimation::Backward);
d->progressAnim->start();
}
}
void TaskbarDesktopWidget::updateAnimation() {
ui->applicationsWidget->setFixedWidth(ui->applicationsWidget->sizeHint().width() * d->progressAnim->currentValue().toReal());
ui->desktopOverviewButton->setFixedWidth(this->height() * (1 - d->progressAnim->currentValue().toReal()));
}
void TaskbarDesktopWidget::finishAnimation() {
if (d->progressAnim->currentValue().toReal() > 0.5) {
ui->applicationsWidget->setFixedWidth(QWIDGETSIZE_MAX);
ui->desktopOverviewButton->setFixedWidth(0);
} else {
ui->applicationsWidget->setFixedWidth(0);
ui->desktopOverviewButton->setFixedWidth(this->height());
}
}
void TaskbarDesktopWidget::on_desktopOverviewButton_clicked() {
DesktopWm::setCurrentDesktop(d->desktop);
}
void TaskbarDesktopWidget::resizeEvent(QResizeEvent* event) {
if (d->progressAnim->state() == tVariantAnimation::Running) {
updateAnimation();
} else {
finishAnimation();
}
}
================================================
FILE: desktop/bar/taskbardesktopwidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef TASKBARDESKTOPWIDGET_H
#define TASKBARDESKTOPWIDGET_H
#include
namespace Ui {
class TaskbarDesktopWidget;
}
class DesktopWmWindow;
typedef QPointer DesktopWmWindowPtr;
struct TaskbarDesktopWidgetPrivate;
class TaskbarDesktopWidget : public QWidget {
Q_OBJECT
public:
explicit TaskbarDesktopWidget(uint desktop, QWidget* parent = nullptr);
~TaskbarDesktopWidget();
void moveDesktop(uint newDesktop);
private slots:
void on_desktopOverviewButton_clicked();
private:
Ui::TaskbarDesktopWidget* ui;
TaskbarDesktopWidgetPrivate* d;
void resizeEvent(QResizeEvent* event);
void windowAdded(DesktopWmWindowPtr window);
void windowRemoved(DesktopWmWindowPtr window);
void registerOnDesktop(DesktopWmWindowPtr window);
void deregisterFromDesktop(DesktopWmWindowPtr window);
void updateOverviewButtonIcon();
void updateDesktop();
void updateAnimation();
void finishAnimation();
};
#endif // TASKBARDESKTOPWIDGET_H
================================================
FILE: desktop/bar/taskbardesktopwidget.ui
================================================
TaskbarDesktopWidget
0
0
255
48
Form
0
0
0
0
0
-
0
0
-
0
0
0
0
0
0
0
================================================
FILE: desktop/bar/taskbarwidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "taskbarwidget.h"
#include "ui_taskbarwidget.h"
#include "taskbardesktopwidget.h"
#include
#include
#include
#include
#include
#include
struct TaskbarWidgetPrivate {
QList desktopWidgets;
};
TaskbarWidget::TaskbarWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::TaskbarWidget) {
ui->setupUi(this);
d = new TaskbarWidgetPrivate();
// connect(DesktopWm::instance(), &DesktopWm::windowAdded, this, &TaskbarWidget::addWindow);
// connect(DesktopWm::instance(), &DesktopWm::windowRemoved, this, &TaskbarWidget::removeWindow);
// connect(DesktopWm::instance(), &DesktopWm::activeWindowChanged, this, &TaskbarWidget::activeWindowChanged);
// for (DesktopWmWindowPtr window : DesktopWm::openWindows()) {
// this->addWindow(window);
// }
connect(DesktopWm::instance(), &DesktopWm::currentDesktopChanged, this, &TaskbarWidget::updateDesktop);
connect(DesktopWm::instance(), &DesktopWm::desktopCountChanged, this, &TaskbarWidget::updateDesktop);
connect(DesktopWm::instance(), &DesktopWm::currentDesktopChanged, this, &TaskbarWidget::normaliseDesktops);
connect(DesktopWm::instance(), &DesktopWm::desktopCountChanged, this, &TaskbarWidget::normaliseDesktops);
connect(DesktopWm::instance(), &DesktopWm::windowAdded, this, &TaskbarWidget::addWindow);
connect(DesktopWm::instance(), &DesktopWm::windowRemoved, this, &TaskbarWidget::removeWindow);
// TODO: Move to window manager
connect(GestureDaemon::instance(), &GestureDaemon::gestureBegin, this, [=](GestureInteractionPtr gesture) {
if (gesture->isValidInteraction(GestureTypes::Swipe, GestureTypes::Left, 4)) {
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.7 && DesktopWm::currentDesktop() != DesktopWm::desktops().length() - 1) {
DesktopWm::setCurrentDesktop(DesktopWm::currentDesktop() + 1);
}
});
} else if (gesture->isValidInteraction(GestureTypes::Swipe, GestureTypes::Right, 4)) {
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.7 && DesktopWm::currentDesktop() != 0) {
DesktopWm::setCurrentDesktop(DesktopWm::currentDesktop() - 1);
}
});
}
});
ui->lastDesktopButton->setIconSize(SC_DPI_T(QSize(24, 24), QSize));
ui->lastDesktopButton->setVisible(DesktopWm::supportsSetNumDesktops());
normaliseDesktops();
updateDesktop();
}
TaskbarWidget::~TaskbarWidget() {
delete d;
delete ui;
d = nullptr;
}
void TaskbarWidget::addWindow(DesktopWmWindowPtr window) {
connect(window, &DesktopWmWindow::desktopChanged, this, &TaskbarWidget::normaliseDesktops);
// Race condition?
QTimer::singleShot(500, this, [=] {
normaliseDesktops();
});
}
void TaskbarWidget::removeWindow(DesktopWmWindowPtr window) {
// Race condition?
QTimer::singleShot(500, this, [=] {
normaliseDesktops();
});
}
void TaskbarWidget::activeWindowChanged() {
}
void TaskbarWidget::normaliseDesktops() {
// Ensure there is a taskbar desktop widget for every desktop - 1
for (int i = 0; i < DesktopWm::desktops().count() - 1; i++) {
if (d->desktopWidgets.count() == i) {
// Add another widget
TaskbarDesktopWidget* widget = new TaskbarDesktopWidget(i);
ui->desktopsLayout->addWidget(widget);
d->desktopWidgets.append(widget);
}
}
// Remove any extraenous desktop widgets
while (d->desktopWidgets.count() > DesktopWm::desktops().count() - 1) {
TaskbarDesktopWidget* widget = d->desktopWidgets.takeLast();
ui->desktopsLayout->removeWidget(widget);
widget->deleteLater();
}
// Go through each desktop to find any that need to be removed
for (int i = 0; i < DesktopWm::desktops().count() - 1; i++) {
if (DesktopWm::currentDesktop() == static_cast(i)) continue;
bool haveWindows = false;
for (auto window : DesktopWm::windowsOnDesktop(i)) {
if (window->desktop() != UINT_MAX) haveWindows = true;
}
if (haveWindows) continue;
// This desktop needs to be removed
// Shuffle all of the windows from the desktops in front down
for (int j = i + 1; j < DesktopWm::desktops().count() - 1; j++) {
d->desktopWidgets.at(j)->moveDesktop(j - 1);
}
// Remove the last desktop
DesktopWm::setNumDesktops(DesktopWm::desktops().count() - 1);
// Normalise and check again
normaliseDesktops();
return;
}
// Ensure that there is an empty desktop at the end
bool haveWindows = false;
for (auto window : DesktopWm::windowsOnDesktop(DesktopWm::desktops().count() - 1)) {
if (window->desktop() != UINT_MAX) haveWindows = true;
}
if (haveWindows) {
// Add an extra desktop
DesktopWm::setNumDesktops(DesktopWm::desktops().count() + 1);
// Normalise and check again
normaliseDesktops();
return;
}
}
void TaskbarWidget::updateDesktop() {
// Race condition?
QTimer::singleShot(500, this, [=] {
ui->lastDesktopButton->setChecked(DesktopWm::currentDesktop() == DesktopWm::desktops().count() - 1);
});
}
void TaskbarWidget::on_lastDesktopButton_clicked() {
DesktopWm::setCurrentDesktop(DesktopWm::desktops().count() - 1);
}
void TaskbarWidget::resizeEvent(QResizeEvent* event) {
ui->lastDesktopButton->setFixedWidth(this->height());
}
================================================
FILE: desktop/bar/taskbarwidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef TASKBARWIDGET_H
#define TASKBARWIDGET_H
#include
namespace Ui {
class TaskbarWidget;
}
class DesktopWmWindow;
typedef QPointer DesktopWmWindowPtr;
struct TaskbarWidgetPrivate;
class TaskbarWidget : public QWidget {
Q_OBJECT
public:
explicit TaskbarWidget(QWidget* parent = nullptr);
~TaskbarWidget();
private slots:
void on_lastDesktopButton_clicked();
private:
Ui::TaskbarWidget* ui;
TaskbarWidgetPrivate* d;
void resizeEvent(QResizeEvent* event);
void addWindow(DesktopWmWindowPtr window);
void removeWindow(DesktopWmWindowPtr window);
void activeWindowChanged();
void normaliseDesktops();
void updateDesktop();
};
#endif // TASKBARWIDGET_H
================================================
FILE: desktop/bar/taskbarwidget.ui
================================================
TaskbarWidget
0
0
400
23
Form
0
0
0
0
0
-
0
-
0
0
true
-
Qt::Horizontal
395
20
================================================
FILE: desktop/cli/commandline.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "commandline.h"
#include
#include
#include "plugins/pluginmanager.h"
#include "server/sessionserver.h"
CommandLine::CommandLine(QObject* parent) : QObject(parent) {
}
#include
int CommandLine::parse(QStringList args) {
QTextStream stream(stdout);
QCommandLineParser parser;
QCommandLineOption safeOption("safe", tr("Start theDesk in Safe Mode"));
parser.addOption(safeOption);
QCommandLineOption serverOption("sessionserver", tr("Internal use; the path to a local socket to communicate with the session manager"), tr("path"));
parser.addOption(serverOption);
QCommandLineOption helpOption = parser.addHelpOption();
QCommandLineOption versionOption = parser.addVersionOption();
if (!parser.parse(args)) {
stream << parser.errorText() << "\n";
return 1;
}
if (parser.isSet(helpOption)) {
stream << parser.helpText();
return 0;
}
if (parser.isSet(versionOption)) {
parser.showVersion();
}
if (parser.isSet(safeOption)) {
PluginManager::instance()->setSafeMode(true);
}
if (!parser.value(serverOption).isEmpty()) {
//Connect to the session server
SessionServer::instance()->setServerPath(parser.value(serverOption));
}
return -1;
}
================================================
FILE: desktop/cli/commandline.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef COMMANDLINE_H
#define COMMANDLINE_H
#include
class CommandLine : public QObject {
Q_OBJECT
public:
explicit CommandLine(QObject* parent = nullptr);
static int parse(QStringList args);
signals:
};
#endif // COMMANDLINE_H
================================================
FILE: desktop/common/common.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "common.h"
int Common::getInsertionIndex(QStringList preferredOrder, QStringList currentItems, QString item) {
//First, check to see if there is a preferred order for this item
if (!preferredOrder.contains(item)) {
//No preferred order so just add it at the end
return -1;
}
//Find where this item is supposed to go
int beforeIndex = preferredOrder.indexOf(item) - 1;
if (beforeIndex == -1) {
//Add this item at the beginning
return 0;
}
//Iterate over the currently loaded items and insert the item at the correct place
QStringList itemsBefore = preferredOrder.mid(0, beforeIndex + 1);
for (int i = currentItems.count() - 1; i >= 0; i--) {
if (itemsBefore.contains(currentItems.at(i))) {
return i + 1;
}
}
//None of the other items were found so just add it at the beginning
return 0;
}
================================================
FILE: desktop/common/common.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef COMMON_H
#define COMMON_H
#include
namespace Common {
/**
* Given a list of items, find the correct index to insert this item into
*
* @param preferredOrder The preferred order of items
* @param currentItems The items that are currently in the layout
* @param item The name of the current item
* @return An index, or -1 to add to the end of the layout
*/
int getInsertionIndex(QStringList preferredOrder, QStringList currentItems, QString item);
}
#endif // COMMON_H
================================================
FILE: desktop/crash/crashhandling.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "crashhandling.h"
#include
#include
#include
#include
#include "plugins/pluginmanager.h"
namespace CrashHandling {
void catchSignal(int sig);
}
void CrashHandling::prepareCrashHandler() {
signal(SIGSEGV, CrashHandling::catchSignal);
signal(SIGBUS, CrashHandling::catchSignal);
signal(SIGFPE, CrashHandling::catchSignal);
}
void CrashHandling::catchSignal(int sig) {
const QMap signalNames = {
{SIGSEGV, "SIGSEGV"},
{SIGBUS, "SIGBUS"},
{SIGFPE, "SIGFPE"}
};
QTextStream output(stderr);
output << "----- BEGIN CRASH HANDLER -----\n";
output << "THEDESK-TRAP: Fatal Signal: " << signalNames.value(sig) << "\n";
output << "THEDESK-TRAP: \n";
output << "THEDESK-TRAP: --- LOADED PLUGINS ---\n";
for (QUuid plugin : PluginManager::instance()->loadedPlugins()) {
output << "THEDESK-TRAP: " << plugin.toString() << "\n";
}
output << "THEDESK-TRAP: \n";
output << "THEDESK-TRAP: --- BACKTRACE ---\n";
QStringList backtrace = tApplication::exportBacktrace();
for (QString line : backtrace) {
output << "THEDESK-TRAP: " << line << "\n";
}
output.flush();
signal(sig, SIG_DFL);
raise(sig);
}
================================================
FILE: desktop/crash/crashhandling.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef CRASHHANDLING_H
#define CRASHHANDLING_H
namespace CrashHandling {
void prepareCrashHandler();
}
#endif // CRASHHANDLING_H
================================================
FILE: desktop/desktop.pro
================================================
QT += core gui tdesktopenvironment network multimedia multimediawidgets quickwidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = thedesk
CONFIG += c++11
# Include the-libs build tools
include(/usr/share/the-libs/pri/gentranslations.pri)
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$PWD/translations) $$shell_quote($$OUT_PWD) && \
$$QMAKE_COPY $$quote($$PWD/defaults.conf) $$shell_quote($$OUT_PWD)
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
background/background.cpp \
bar/barwindow.cpp \
bar/chunkcontainer.cpp \
bar/currentappwidget.cpp \
bar/currentappwidgetmenu.cpp \
bar/mainbarwidget.cpp \
bar/taskbarapplicationwidget.cpp \
bar/taskbardesktopwidget.cpp \
bar/taskbarwidget.cpp \
cli/commandline.cpp \
crash/crashhandling.cpp \
gateway/appsearchprovider.cpp \
gateway/appselectionmodel.cpp \
gateway/appselectionmodellistdelegate.cpp \
gateway/gateway.cpp \
gateway/gatewaysearchmodel.cpp \
gateway/gatewaysearchmodeldelegate.cpp \
gateway/maingatewaywidget.cpp \
gateway/searchresultswidget.cpp \
main.cpp \
run/rundialog.cpp \
session/endsession.cpp \
session/endsessionbutton.cpp \
statuscenter/leftpanedelegate.cpp \
statuscenter/statuscenter.cpp \
statuscenter/statuscenterleftpane.cpp \
statuscenter/statuscenterquickswitch.cpp \
systemsettings/about/about.cpp \
systemsettings/about/acknowledgements.cpp \
systemsettings/about/changehostnamepopover.cpp \
systemsettings/pluginmanagement/managepluginpopover.cpp \
systemsettings/pluginmanagement/pluginitemdelegate.cpp \
systemsettings/pluginmanagement/pluginmanagement.cpp \
systemsettings/pluginmanagement/pluginmodel.cpp \
systemsettings/recovery/recovery.cpp \
systemsettings/systemsettings.cpp \
systemsettings/systemsettingsleftpane.cpp
HEADERS += \
background/background.h \
bar/barwindow.h \
bar/chunkcontainer.h \
bar/currentappwidget.h \
bar/currentappwidgetmenu.h \
bar/mainbarwidget.h \
bar/taskbarapplicationwidget.h \
bar/taskbardesktopwidget.h \
bar/taskbarwidget.h \
cli/commandline.h \
crash/crashhandling.h \
gateway/appsearchprovider.h \
gateway/appselectionmodel.h \
gateway/appselectionmodellistdelegate.h \
gateway/gateway.h \
gateway/gatewaysearchmodel.h \
gateway/gatewaysearchmodeldelegate.h \
gateway/maingatewaywidget.h \
gateway/searchresultswidget.h \
run/rundialog.h \
session/endsession.h \
session/endsessionbutton.h \
statuscenter/leftpanedelegate.h \
statuscenter/statuscenter.h \
statuscenter/statuscenterleftpane.h \
statuscenter/statuscenterquickswitch.h \
systemsettings/about/about.h \
systemsettings/about/acknowledgements.h \
systemsettings/about/changehostnamepopover.h \
systemsettings/pluginmanagement/managepluginpopover.h \
systemsettings/pluginmanagement/pluginitemdelegate.h \
systemsettings/pluginmanagement/pluginmanagement.h \
systemsettings/pluginmanagement/pluginmodel.h \
systemsettings/recovery/recovery.h \
systemsettings/systemsettings.h \
systemsettings/systemsettingsleftpane.h
FORMS += \
background/background.ui \
bar/barwindow.ui \
bar/chunkcontainer.ui \
bar/currentappwidget.ui \
bar/currentappwidgetmenu.ui \
bar/mainbarwidget.ui \
bar/taskbardesktopwidget.ui \
bar/taskbarwidget.ui \
gateway/gateway.ui \
gateway/maingatewaywidget.ui \
gateway/searchresultswidget.ui \
run/rundialog.ui \
session/endsession.ui \
statuscenter/statuscenter.ui \
statuscenter/statuscenterleftpane.ui \
statuscenter/statuscenterquickswitch.ui \
systemsettings/about/about.ui \
systemsettings/about/acknowledgements.ui \
systemsettings/about/changehostnamepopover.ui \
systemsettings/pluginmanagement/managepluginpopover.ui \
systemsettings/pluginmanagement/pluginmanagement.ui \
systemsettings/recovery/recovery.ui \
systemsettings/systemsettings.ui \
systemsettings/systemsettingsleftpane.ui
unix {
target.path = /usr/bin/
translations.files = translations/*.qm
translations.path = /usr/share/thedesk/translations
defaults.files = defaults.conf
defaults.path = /etc/theSuite/theDesk/
media.files = media/
media.path = /usr/share/thedesk/
acknowledgements.files = acknowledgements.html
acknowledgements.path = /usr/share/thedesk
INSTALLS += target translations defaults media acknowledgements
}
DEFINES += SYSTEM_LIBRARY_DIRECTORY=\\\"$$THELIBS_INSTALL_LIB\\\"
unix:!macx: LIBS += -L$$OUT_PWD/../libthedesk/ -lthedesk
INCLUDEPATH += $$PWD/../libthedesk
DEPENDPATH += $$PWD/../libthedesk
RESOURCES += \
resources.qrc
DISTFILES += \
acknowledgements.html \
defaults.conf \
onboarding/OnboardingVideoForm.qml
================================================
FILE: desktop/gateway/appsearchprovider.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "appsearchprovider.h"
#include
#include
#include
struct AppSearchProviderPrivate {
};
AppSearchProvider::AppSearchProvider(QObject* parent) :
GatewaySearchProvider(parent) {
d = new AppSearchProviderPrivate();
}
AppSearchProvider::~AppSearchProvider() {
delete d;
}
tPromise>* AppSearchProvider::searchResults(QString query) {
return TPROMISE_CREATE_SAME_THREAD(QList, {
Q_UNUSED(rej)
QList results;
for (const QString& desktopEntry : Application::allApplications()) {
ApplicationPointer a(new Application(desktopEntry));
// Make sure this app is good to be shown
if (a->getProperty("Type", "").toString() != "Application") continue;
if (a->getProperty("NoDisplay", false).toBool()) continue;
if (!a->getStringList("OnlyShowIn", {"thedesk"}).contains("thedesk")) continue;
if (a->getStringList("NotShowIn").contains("thedesk")) continue;
QStringList possibleWords;
possibleWords.append(a->getProperty("Name").toString());
possibleWords.append(a->getProperty("GenericName").toString());
possibleWords.append(a->getStringList("Keywords"));
for (const QString& s : possibleWords) {
if (s.contains(query, Qt::CaseInsensitive)) {
results.append({
{"application", a->desktopEntry() },
{"mainText", a->getProperty("Name").toString()},
{"priority", 0 },
{"drawArrows", false }
});
for (QString action : a->getStringList("Actions")) {
results.append({
{"application", a->desktopEntry() },
{"action", action },
{"mainText", a->getProperty("Name").toString()},
{"priority", 0 },
{"drawArrows", false }
});
}
break;
}
}
}
// if (theLibsGlobal::searchInPath(query.split(" ")[0]).count() > 0) {
// d->appsShown.append(ApplicationPointer(new Application({
// {"Name", query},
// {"Exec", query},
// {"GenericName", tr("Run Command")},
// {"Icon", "system-run"}
// })));
// }
res(results);
});
}
void AppSearchProvider::launch(QVariantMap data) {
Application app(data.value("application").toString());
if (data.contains("action")) {
app.launchAction(data.value("action").toString());
} else {
app.launch();
}
}
void AppSearchProvider::paint(QPainter* painter, const QStyleOptionViewItem& option, const QVariantMap data) const {
tPaintCalculator calculator = this->calculator(painter, option, data);
calculator.setPainter(painter);
painter->setFont(option.font);
calculator.performPaint();
}
QSize AppSearchProvider::sizeHint(const QStyleOptionViewItem& option, const QVariantMap data) const {
// Application app(data.value("application").toString());
// int fontHeight = option.fontMetrics.height() * 2 + SC_DPI(14);
// int iconHeight = SC_DPI(46);
// return QSize(option.fontMetrics.horizontalAdvance(app.getProperty("Name").toString()), qMax(fontHeight, iconHeight));
return calculator(nullptr, option, data).sizeWithMargins().toSize();
}
tPaintCalculator AppSearchProvider::calculator(QPainter* painter, const QStyleOptionViewItem& option, const QVariantMap data) const {
Application app(data.value("application").toString());
tPaintCalculator calculator;
calculator.setDrawBounds(option.rect);
calculator.setLayoutDirection(option.direction);
QString name;
QString genericName;
QPixmap icon;
QRect iconRect;
QRect textRect;
QRect descRect;
if (data.contains("action")) {
QString action = data.value("action").toString();
name = app.getActionProperty(action, "Name").toString();
icon = app.actionIcon(action, SC_DPI_T(QSize(16, 16), QSize));
iconRect.setLeft(option.rect.left() + SC_DPI(12));
iconRect.setTop(option.rect.top() + SC_DPI(6));
iconRect.setSize(icon.size());
textRect.setHeight(option.fontMetrics.height());
textRect.setWidth(option.fontMetrics.horizontalAdvance(name) + 1);
textRect.moveCenter(iconRect.center());
textRect.moveLeft(iconRect.right() + SC_DPI(6));
} else {
name = app.getProperty("Name").toString();
genericName = app.getProperty("GenericName", tr("Application")).toString();
icon = app.icon(SC_DPI_T(QSize(32, 32), QSize));
iconRect.setLeft(option.rect.left() + SC_DPI(6));
iconRect.setTop(option.rect.top() + SC_DPI(6));
iconRect.setSize(icon.size());
textRect.setLeft(iconRect.right() + SC_DPI(6));
textRect.setTop(option.rect.top() + SC_DPI(6));
textRect.setBottom(option.rect.top() + option.fontMetrics.height() + SC_DPI(6));
textRect.setRight(option.rect.right() - SC_DPI(6));
descRect.setLeft(iconRect.right() + SC_DPI(6));
descRect.setTop(option.rect.top() + option.fontMetrics.height() + SC_DPI(8));
descRect.setBottom(option.rect.top() + option.fontMetrics.height() * 2 + SC_DPI(6));
descRect.setRight(option.rect.right() - SC_DPI(6));
}
if (option.state & QStyle::State_Selected) {
calculator.addRect(option.rect, [=](QRectF drawBounds) {
painter->setPen(Qt::transparent);
painter->setBrush(option.palette.color(QPalette::Highlight));
painter->drawRect(drawBounds);
});
calculator.addRect(textRect, [=](QRectF drawBounds) {
painter->setBrush(Qt::transparent);
painter->setPen(option.palette.color(QPalette::HighlightedText));
painter->drawText(drawBounds, Qt::AlignLeading, name);
});
calculator.addRect(descRect, [=](QRectF drawBounds) {
painter->drawText(drawBounds, Qt::AlignLeading, genericName);
});
} else if (option.state & QStyle::State_MouseOver) {
calculator.addRect(option.rect, [=](QRectF drawBounds) {
QColor col = option.palette.color(QPalette::Highlight);
col.setAlpha(127);
painter->setBrush(col);
painter->setPen(Qt::transparent);
painter->drawRect(drawBounds);
});
calculator.addRect(textRect, [=](QRectF drawBounds) {
painter->setBrush(Qt::transparent);
painter->setPen(option.palette.color(QPalette::WindowText));
painter->drawText(drawBounds, Qt::AlignLeading, name);
});
calculator.addRect(descRect, [=](QRectF drawBounds) {
painter->setPen(option.palette.color(QPalette::Disabled, QPalette::WindowText));
painter->drawText(drawBounds, Qt::AlignLeading, genericName);
});
} else {
calculator.addRect(textRect, [=](QRectF drawBounds) {
painter->setPen(option.palette.color(QPalette::WindowText));
painter->drawText(drawBounds, Qt::AlignLeading, name);
});
calculator.addRect(descRect, [=](QRectF drawBounds) {
painter->setPen(option.palette.color(QPalette::Disabled, QPalette::WindowText));
painter->drawText(drawBounds, Qt::AlignLeading, genericName);
});
}
calculator.addRect(iconRect, [=](QRectF drawBounds) {
painter->drawPixmap(drawBounds.toRect(), icon);
});
if (data.value("drawArrows", true).toBool()) {
if (app.getStringList("Actions").count() > 0) { // Actions included
QRect actionsRect;
actionsRect.setWidth(SC_DPI(16));
actionsRect.setHeight(SC_DPI(16));
actionsRect.moveCenter(iconRect.center());
actionsRect.moveRight(option.rect.right() - SC_DPI(9));
calculator.addRect(actionsRect, [=](QRectF drawBounds) {
painter->drawPixmap(drawBounds.toRect(), QIcon::fromTheme("arrow-right").pixmap(SC_DPI_T(QSize(16, 16), QSize)));
});
}
}
return calculator;
}
================================================
FILE: desktop/gateway/appsearchprovider.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef APPSEARCHPROVIDER_H
#define APPSEARCHPROVIDER_H
#include
class tPaintCalculator;
struct AppSearchProviderPrivate;
class AppSearchProvider : public GatewaySearchProvider {
Q_OBJECT
public:
explicit AppSearchProvider(QObject* parent = nullptr);
~AppSearchProvider();
tPromise>* searchResults(QString query);
void launch(QVariantMap data);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QVariantMap data) const;
QSize sizeHint(const QStyleOptionViewItem& option, const QVariantMap data) const;
tPaintCalculator calculator(QPainter* painter, const QStyleOptionViewItem& option, const QVariantMap data) const;
signals:
private:
AppSearchProviderPrivate* d;
};
#endif // APPSEARCHPROVIDER_H
================================================
FILE: desktop/gateway/appselectionmodel.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "appselectionmodel.h"
#include
#include
#include
struct AppSelectionModelPrivate {
QString category;
QList apps;
QList appsShown;
};
AppSelectionModel::AppSelectionModel(QObject* parent) :
QAbstractListModel(parent) {
d = new AppSelectionModelPrivate();
connect(ApplicationDaemon::instance(), &ApplicationDaemon::appsUpdateRequired, this, &AppSelectionModel::updateData);
updateData();
}
AppSelectionModel::~AppSelectionModel() {
delete d;
}
int AppSelectionModel::rowCount(const QModelIndex& parent) const {
if (parent.isValid()) return 0;
return d->appsShown.count();
}
QVariant AppSelectionModel::data(const QModelIndex& index, int role) const {
if (!index.isValid()) return QVariant();
ApplicationPointer a = d->appsShown.at(index.row());
if (d->appsShown.count() > index.row()) {
if (role == Qt::DisplayRole) {
return a->getProperty("Name", a->desktopEntry());
} else if (role == Qt::DecorationRole) {
// Cache the icon for smooth scrolling
return a->icon(SC_DPI_T(QSize(32, 32), QSize));
} else if (role == Qt::UserRole) { // Description
return a->getProperty("GenericName", tr("Application"));
} else if (role == Qt::UserRole + 1) { // Pinned
// return d->pinnedAppsList.contains(a->desktopEntry());
return false;
} else if (role == Qt::UserRole + 2) { // Desktop Entry
return a->desktopEntry();
} else if (role == Qt::UserRole + 3) { // App
return QVariant::fromValue(a);
}
}
return QVariant();
}
void AppSelectionModel::filterCategory(QString category) {
d->category = category;
d->appsShown.clear();
// If there is no current category, show all apps
if (category == "") {
d->appsShown.append(d->apps);
emit dataChanged(index(0), index(rowCount()));
return;
}
for (ApplicationPointer app : qAsConst(d->apps)) {
QStringList categories = app->getStringList("Categories");
if (categories.contains(category, Qt::CaseSensitive)) d->appsShown.append(app);
}
emit dataChanged(index(0), index(rowCount()));
}
void AppSelectionModel::updateData() {
emit loading();
d->apps.clear();
struct ApplicationListReturnValue {
QList apps;
QMap appIcons;
};
(new tPromise>([=](QString& error) {
QList apps;
QList normalApps;
for (QString desktopEntry : Application::allApplications()) {
ApplicationPointer a(new Application(desktopEntry));
// Make sure this app is good to be shown
if (a->getProperty("Type", "").toString() != "Application") continue;
if (a->getProperty("NoDisplay", false).toBool()) continue;
if (!a->getStringList("OnlyShowIn", {"thedesk"}).contains("thedesk")) continue;
if (a->getStringList("NotShowIn").contains("thedesk")) continue;
normalApps.append(a);
}
std::sort(normalApps.begin(), normalApps.end(), [](const ApplicationPointer& a, const ApplicationPointer& b) -> bool {
if (a->getProperty("Name").toString().localeAwareCompare(b->getProperty("Name").toString()) < 0) {
return true;
} else {
return false;
}
});
apps.append(normalApps);
return apps;
}))->then([=](QList apps) {
d->apps = apps;
// Perform a category search to initialize the list
filterCategory(d->category);
emit ready();
});
}
================================================
FILE: desktop/gateway/appselectionmodel.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef APPSELECTIONMODEL_H
#define APPSELECTIONMODEL_H
#include
struct AppSelectionModelPrivate;
class AppSelectionModel : public QAbstractListModel {
Q_OBJECT
public:
explicit AppSelectionModel(QObject* parent = nullptr);
~AppSelectionModel() override;
// Basic functionality:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
void filterCategory(QString category);
signals:
void loading();
void ready();
private:
AppSelectionModelPrivate* d;
void updateData();
};
#endif // APPSELECTIONMODEL_H
================================================
FILE: desktop/gateway/appselectionmodellistdelegate.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "appselectionmodellistdelegate.h"
#include "appsearchprovider.h"
#include
#include
#include
AppSelectionModelListDelegate::AppSelectionModelListDelegate(QWidget* parent, bool drawArrows) :
QStyledItemDelegate(parent) {
this->drawArrows = drawArrows;
}
void AppSelectionModelListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
AppSearchProvider provider;
return provider.paint(painter, option, {
{"application", index.data(Qt::UserRole + 2).toString()},
{"drawArrows", this->drawArrows }
});
}
QSize AppSelectionModelListDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
AppSearchProvider provider;
return provider.sizeHint(option, {
{"application", index.data(Qt::UserRole + 2).toString()}
});
}
================================================
FILE: desktop/gateway/appselectionmodellistdelegate.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef APPSELECTIONMODELLISTDELEGATE_H
#define APPSELECTIONMODELLISTDELEGATE_H
#include
class AppSelectionModelListDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
AppSelectionModelListDelegate(QWidget* parent = nullptr, bool drawArrows = true);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
private:
bool drawArrows;
};
#endif // APPSELECTIONMODELLISTDELEGATE_H
================================================
FILE: desktop/gateway/gateway.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "gateway.h"
#include "ui_gateway.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct GatewayPrivate {
Gateway* instance = nullptr;
tVariantAnimation* width;
GestureInteractionPtr lastGesture;
};
GatewayPrivate* Gateway::d = new GatewayPrivate();
Gateway::Gateway() :
QDialog(nullptr),
ui(new Ui::Gateway) {
ui->setupUi(this);
ui->gatewayContainer->move(0, 0);
connect(ui->gatewayContainer, &MainGatewayWidget::closeGateway, this, [=] {
this->close();
});
d->width = new tVariantAnimation();
d->width->setDuration(500);
connect(d->width, &tVariantAnimation::valueChanged, this, [=](QVariant value) {
this->setFixedWidth(value.toInt());
auto* screen = ScreenDaemon::instance()->primayScreen();
QRect geometry;
geometry.setHeight(this->height());
geometry.setWidth(value.toInt());
if (this->layoutDirection() == Qt::RightToLeft) {
geometry.moveTopRight(screen->geometry().topRight());
} else {
geometry.moveTopLeft(screen->geometry().topLeft());
}
this->setGeometry(geometry);
});
connect(d->width, &tVariantAnimation::finished, this, [=] {
if (d->lastGesture && d->lastGesture->isActive()) return;
if (this->geometry().width() == 0) {
QDialog::hide();
ui->gatewayContainer->clearState();
}
});
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
DesktopWm::setSystemWindow(this, DesktopWm::SystemWindowTypeMenu);
this->setFixedWidth(0);
connect(GestureDaemon::instance(), &GestureDaemon::gestureBegin, this, [=](GestureInteractionPtr interaction) {
if (interaction->isValidInteraction(GestureTypes::Swipe, this->layoutDirection() == Qt::RightToLeft ? GestureTypes::Left : GestureTypes::Right, 3)) {
trackGatewayOpenGesture(interaction);
} else if (interaction->isValidInteraction(GestureTypes::Swipe, this->layoutDirection() == Qt::RightToLeft ? GestureTypes::Right : GestureTypes::Left, 3)) {
trackGatewayCloseGesture(interaction);
}
});
ui->line->raise();
}
void Gateway::resizeEvent(QResizeEvent* event) {
ui->gatewayContainer->setFixedSize(ui->gatewayContainer->sizeHint().width(), this->height());
if (this->layoutDirection() == Qt::RightToLeft) {
ui->gatewayContainer->move(1, 0);
ui->line->setGeometry(0, 0, 1, this->height());
} else {
ui->gatewayContainer->move(this->geometry().width() - ui->gatewayContainer->width() - 1, 0);
ui->line->setGeometry(this->geometry().width() - 1, 0, 1, this->height());
}
StateManager::gatewayManager()->setGatewayWidth(this->geometry().width());
}
void Gateway::changeEvent(QEvent* event) {
QDialog::changeEvent(event);
switch (event->type()) {
case QEvent::ActivationChange:
if (!this->isActiveWindow()) this->close();
break;
default:;
}
}
void Gateway::trackGatewayOpenGesture(GestureInteractionPtr gesture) {
if (this->isVisible()) return;
// Capture this gesture!
d->lastGesture = gesture;
auto* screen = ScreenDaemon::instance()->primayScreen();
this->setFixedHeight(screen->geometry().height());
d->width->setEasingCurve(QEasingCurve::Linear);
d->width->setCurrentTime(0);
d->width->setStartValue(0);
d->width->setEndValue(ui->gatewayContainer->sizeHint().width() + 1);
connect(gesture.data(), &GestureInteraction::interactionUpdated, this, [=] {
d->width->setCurrentTime(d->width->totalDuration() * gesture->percentage());
d->width->valueChanged(d->width->currentValue());
});
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.3) {
show();
} else {
close();
}
});
QDialog::show();
}
void Gateway::trackGatewayCloseGesture(GestureInteractionPtr gesture) {
if (!this->isVisible()) return;
// Capture this gesture!
d->lastGesture = gesture;
auto* screen = ScreenDaemon::instance()->primayScreen();
this->setFixedHeight(screen->geometry().height());
d->width->setEasingCurve(QEasingCurve::Linear);
d->width->setCurrentTime(0);
d->width->setStartValue(ui->gatewayContainer->sizeHint().width() + 1);
d->width->setEndValue(0);
connect(gesture.data(), &GestureInteraction::interactionUpdated, this, [=] {
d->width->setCurrentTime(d->width->totalDuration() * gesture->percentage());
d->width->valueChanged(d->width->currentValue());
});
connect(gesture.data(), &GestureInteraction::interactionEnded, this, [=] {
if (gesture->extrapolatePercentage(100) > 0.3) {
close();
} else {
show();
}
});
}
Gateway::~Gateway() {
delete ui;
}
Gateway* Gateway::instance() {
if (!d->instance) d->instance = new Gateway();
return d->instance;
}
void Gateway::setFixedHeight(int height) {
QWidget::setFixedHeight(height);
// Work around a Qt bug that causes the native window not to be updated on Wayland for some reason
this->windowHandle()->setGeometry(this->geometry());
}
void Gateway::setFixedWidth(int width) {
QWidget::setFixedWidth(width);
// Work around a Qt bug that causes the native window not to be updated on Wayland for some reason
this->windowHandle()->setGeometry(this->geometry());
}
void Gateway::show() {
auto* screen = ScreenDaemon::instance()->primayScreen();
this->setFixedHeight(screen->geometry().height());
d->width->setEasingCurve(QEasingCurve::OutCubic);
d->width->setStartValue(this->geometry().width());
d->width->setEndValue(ui->gatewayContainer->sizeHint().width() + 1);
d->width->stop();
d->width->start();
QDialog::show();
QDialog::activateWindow();
ui->gatewayContainer->setFocus();
DesktopWm::setSystemWindow(this, DesktopWm::SystemWindowTypeMenu);
}
void Gateway::close() {
d->width->setEasingCurve(QEasingCurve::OutCubic);
d->width->setStartValue(this->geometry().width());
d->width->setEndValue(0);
d->width->stop();
d->width->start();
}
================================================
FILE: desktop/gateway/gateway.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef GATEWAY_H
#define GATEWAY_H
#include
#include
namespace Ui {
class Gateway;
}
struct GatewayPrivate;
class Gateway : public QDialog {
Q_OBJECT
public:
~Gateway();
static Gateway* instance();
void setFixedHeight(int height);
void setFixedWidth(int width);
void show();
void close();
private:
explicit Gateway();
Ui::Gateway* ui;
static GatewayPrivate* d;
void resizeEvent(QResizeEvent* event);
void changeEvent(QEvent* event);
void trackGatewayOpenGesture(GestureInteractionPtr gesture);
void trackGatewayCloseGesture(GestureInteractionPtr gesture);
};
#endif // GATEWAY_H
================================================
FILE: desktop/gateway/gateway.ui
================================================
Gateway
0
0
400
300
Dialog
50
20
120
80
370
80
1
61
1
16777215
Qt::Vertical
MainGatewayWidget
QWidget
gateway/maingatewaywidget.h
1
================================================
FILE: desktop/gateway/gatewaysearchmodel.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "gatewaysearchmodel.h"
#include
#include
#include
struct GatewaySearchModelPrivate {
QString query;
QList currentItems;
};
GatewaySearchModel::GatewaySearchModel(QObject* parent)
: QAbstractListModel(parent) {
d = new GatewaySearchModelPrivate();
}
GatewaySearchModel::~GatewaySearchModel() {
delete d;
}
void GatewaySearchModel::search(QString query) {
d->currentItems.clear();
d->query = query;
for (GatewaySearchProvider* searchProvider : StateManager::gatewayManager()->searchProviders()) {
searchProvider->searchResults(query)->then([ = ](QList results) {
if (d->query != query) return;
QList endResults;
for (QVariantMap result : results) {
endResults.append({
{"provider", QVariant::fromValue(searchProvider)},
{"data", result},
{"priority", result.value("priority", 1)},
{"mainText", result.value("mainText", "")}
});
}
d->currentItems.append(endResults);
//Sort the items
std::stable_sort(d->currentItems.begin(), d->currentItems.end(), [ = ](const QVariantMap first, const QVariantMap second) {
if (first.value("priority") == second.value("priority")) {
return first.value("mainText").toString().localeAwareCompare(second.value("mainText").toString()) < 0;
}
return first.value("priority").toInt() < second.value("priority").toInt();
});
emit dataChanged(index(0), index(rowCount()));
});
}
}
int GatewaySearchModel::rowCount(const QModelIndex& parent) const {
if (parent.isValid()) return 0;
return d->currentItems.count();
}
QVariant GatewaySearchModel::data(const QModelIndex& index, int role) const {
if (!index.isValid()) return QVariant();
if (d->currentItems.length() <= index.row()) return QVariant();
switch (role) {
case Qt::UserRole:
return d->currentItems.at(index.row()).value("data");
case Qt::UserRole + 1:
return d->currentItems.at(index.row()).value("provider");
}
return QVariant();
}
void GatewaySearchModel::launch(const QModelIndex& index) const {
GatewaySearchProvider* provider = index.data(Qt::UserRole + 1).value();
provider->launch(index.data(Qt::UserRole).toMap());
}
================================================
FILE: desktop/gateway/gatewaysearchmodel.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef GATEWAYSEARCHMODEL_H
#define GATEWAYSEARCHMODEL_H
#include
struct GatewaySearchModelPrivate;
class GatewaySearchModel : public QAbstractListModel {
Q_OBJECT
public:
explicit GatewaySearchModel(QObject* parent = nullptr);
~GatewaySearchModel();
void search(QString query);
// Basic functionality:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
void launch(const QModelIndex& index) const;
private:
GatewaySearchModelPrivate* d;
};
#endif // GATEWAYSEARCHMODEL_H
================================================
FILE: desktop/gateway/gatewaysearchmodeldelegate.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "gatewaysearchmodeldelegate.h"
#include
GatewaySearchModelDelegate::GatewaySearchModelDelegate(QObject* parent) : QStyledItemDelegate(parent) {
}
void GatewaySearchModelDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
GatewaySearchProvider* provider = index.data(Qt::UserRole + 1).value();
return provider->paint(painter, option, index.data(Qt::UserRole).toMap());
}
QSize GatewaySearchModelDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
GatewaySearchProvider* provider = index.data(Qt::UserRole + 1).value();
return provider->sizeHint(option, index.data(Qt::UserRole).toMap());
}
================================================
FILE: desktop/gateway/gatewaysearchmodeldelegate.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef GATEWAYSEARCHMODELDELEGATE_H
#define GATEWAYSEARCHMODELDELEGATE_H
#include
class GatewaySearchModelDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
explicit GatewaySearchModelDelegate(QObject* parent = nullptr);
signals:
// QAbstractItemDelegate interface
public:
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
#endif // GATEWAYSEARCHMODELDELEGATE_H
================================================
FILE: desktop/gateway/maingatewaywidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "maingatewaywidget.h"
#include "ui_maingatewaywidget.h"
#include
#include
#include
#include
#include "appselectionmodel.h"
#include "appselectionmodellistdelegate.h"
#include "session/endsession.h"
#include
#include
#include
#include "searchresultswidget.h"
#include
#include
#include
struct MainGatewayWidgetPrivate {
AppSelectionModel* model;
SearchResultsWidget* searchWidget;
};
MainGatewayWidget::MainGatewayWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::MainGatewayWidget) {
ui->setupUi(this);
d = new MainGatewayWidgetPrivate();
d->model = new AppSelectionModel(this);
connect(d->model, &AppSelectionModel::loading, this, [ = ] {
ui->gatewayTypeStack->setCurrentWidget(ui->gatewayLoading);
});
connect(d->model, &AppSelectionModel::ready, this, [ = ] {
QTimer::singleShot(500, [ = ] {
ui->gatewayTypeStack->setCurrentWidget(ui->gatewayList);
});
});
ui->gatewayTypeStack->setCurrentWidget(ui->gatewayLoading);
ui->gatewayTypeStack->setCurrentAnimation(tStackedWidget::Fade);
ui->titleLabel->setBackButtonShown(true);
ui->leftPane->setFixedWidth(SC_DPI(200));
// ui->usernameLabel->setText(tr("Hey, %1!").arg(DesktopWm::userDisplayName()));
ui->usernameLabel->setText(DesktopWm::userDisplayName());
ui->appsList->setModel(d->model);
ui->appsList->setItemDelegate(new AppSelectionModelListDelegate(this, true));
ui->appsList->setFocusProxy(ui->searchBox);
QScroller::grabGesture(ui->appsList->viewport(), QScroller::LeftMouseButtonGesture);
this->setFocusProxy(ui->searchBox);
ui->endSessionButton->setFocusProxy(ui->searchBox);
d->searchWidget = new SearchResultsWidget(ui->searchResultsContainer);
d->searchWidget->move(0, 0);
d->searchWidget->hide();
connect(d->searchWidget, &SearchResultsWidget::closeGateway, this, &MainGatewayWidget::closeGateway);
connect(tScrim::scrimForWidget(ui->appContentsWidget), &tScrim::scrimClicked, this, [ = ] {
ui->searchBox->setText("");
tScrim::scrimForWidget(ui->appContentsWidget)->hide();
d->searchWidget->hide();
});
QList> categories = {
{"AudioVideo", tr("A/V")},
{"Development", tr("Development")},
{"Education", tr("Education")},
{"Game", tr("Games")},
{"Graphics", tr("Graphics")},
{"Network", tr("Networking")},
{"Office", tr("Office")},
{"Science", tr("Science")},
{"Utility", tr("Utilities")}
};
std::sort(categories.begin(), categories.end(), [ = ](const QPair& first, const QPair& second) {
return first.second.localeAwareCompare(second.second) < 0;
});
for (const QPair& category : categories) {
QPushButton* button = new QPushButton(this);
button->setAutoExclusive(true);
button->setCheckable(true);
button->setText(category.second);
connect(button, &QPushButton::toggled, this, [ = ](bool checked) {
if (checked) d->model->filterCategory(category.first);
});
ui->categoriesLayout->addWidget(button);
}
ui->searchBox->installEventFilter(this);
}
MainGatewayWidget::~MainGatewayWidget() {
delete d;
delete ui;
}
QSize MainGatewayWidget::sizeHint() const {
QSize sizeHint = QWidget::sizeHint();
sizeHint.setWidth(SC_DPI(400));
sizeHint.setWidth(SC_DPI(700));
return sizeHint;
}
void MainGatewayWidget::clearState() {
ui->searchBox->setText("");
tScrim::scrimForWidget(ui->appContentsWidget)->hide();
d->searchWidget->hide();
ui->allAppsButton->setChecked(true);
}
void MainGatewayWidget::on_searchBox_textEdited(const QString& arg1) {
if (arg1.isEmpty()) {
tScrim::scrimForWidget(ui->appContentsWidget)->hide();
d->searchWidget->hide();
} else {
tScrim::scrimForWidget(ui->appContentsWidget)->show();
d->searchWidget->show();
}
d->searchWidget->search(arg1);
}
void MainGatewayWidget::on_appsList_clicked(const QModelIndex& index) {
int x = ui->appsList->mapFromGlobal(QCursor::pos()).x();
if ((this->layoutDirection() == Qt::RightToLeft && x < SC_DPI(32)) ||
(this->layoutDirection() == Qt::LeftToRight && x > ui->appsList->width() - SC_DPI(32))) {
if (showActionMenu(index)) return;
}
launch(index);
}
void MainGatewayWidget::on_searchBox_returnPressed() {
if (!ui->searchBox->text().isEmpty()) d->searchWidget->launchSelected();
}
void MainGatewayWidget::launch(QModelIndex applicationIndex) {
applicationIndex.data(Qt::UserRole + 3).value()->launch();
emit closeGateway();
}
bool MainGatewayWidget::showActionMenu(QModelIndex applicationIndex) {
ApplicationPointer application = applicationIndex.data(Qt::UserRole + 3).value();
if (application->getStringList("Actions").isEmpty()) return false;
QMenu* menu = new QMenu();
menu->addSection(tr("Actions for %1").arg(QLocale().quoteString(application->getProperty("Name").toString())));
for (const QString& action : application->getStringList("Actions")) {
menu->addAction(application->actionIcon(action), application->getActionProperty(action, "Name").toString(), this, [ = ] {
application->launchAction(action);
emit closeGateway();
});
}
connect(menu, &QMenu::aboutToHide, menu, &QMenu::deleteLater);
QRect rect = ui->appsList->visualRect(applicationIndex);
if (layoutDirection() == Qt::RightToLeft) {
menu->popup(ui->appsList->mapToGlobal(rect.topLeft()));
} else {
menu->popup(ui->appsList->mapToGlobal(rect.topRight()));
}
return true;
}
void MainGatewayWidget::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
}
void MainGatewayWidget::resizeEvent(QResizeEvent* event) {
d->searchWidget->setFixedWidth(this->width());
}
void MainGatewayWidget::on_endSessionButton_clicked() {
StateManager::instance()->powerManager()->showPowerOffConfirmation();
}
void MainGatewayWidget::on_allAppsButton_toggled(bool checked) {
if (checked) d->model->filterCategory("");
}
void MainGatewayWidget::on_titleLabel_backButtonClicked() {
emit closeGateway();
}
void MainGatewayWidget::on_statusCenterButton_clicked() {
StateManager::statusCenterManager()->show();
emit closeGateway();
}
void MainGatewayWidget::on_systemSettingsButton_clicked() {
StateManager::statusCenterManager()->show();
StateManager::statusCenterManager()->setPane("SystemSettings");
emit closeGateway();
}
bool MainGatewayWidget::eventFilter(QObject* watched, QEvent* event) {
if (watched == ui->searchBox) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent* keyEvent = static_cast(event);
if (keyEvent->key() == Qt::Key_Down) {
if (ui->searchBox->text().isEmpty()) {
QItemSelectionModel* selectionModel = ui->appsList->selectionModel();
int selectionRow = 0;
if (selectionModel->hasSelection()) {
int row = selectionModel->selectedIndexes().first().row();
if (row != d->model->rowCount() - 1) selectionRow = row + 1;
}
selectionModel->select(d->model->index(selectionRow), QItemSelectionModel::ClearAndSelect);
ui->appsList->scrollTo(d->model->index(selectionRow), QListView::PositionAtCenter);
} else {
d->searchWidget->moveSelectionDown();
}
return true;
} else if (keyEvent->key() == Qt::Key_Up) {
if (ui->searchBox->text().isEmpty()) {
QItemSelectionModel* selectionModel = ui->appsList->selectionModel();
int selectionRow = d->model->rowCount() - 1;
if (selectionModel->hasSelection()) {
int row = selectionModel->selectedIndexes().first().row();
if (row != 0) selectionRow = row - 1;
}
selectionModel->select(d->model->index(selectionRow), QItemSelectionModel::ClearAndSelect);
ui->appsList->scrollTo(d->model->index(selectionRow), QListView::PositionAtCenter);
} else {
d->searchWidget->moveSelectionUp();
}
return true;
} else if ((layoutDirection() == Qt::LeftToRight && keyEvent->key() == Qt::Key_Right) ||
(layoutDirection() == Qt::RightToLeft && keyEvent->key() == Qt::Key_Left)) {
if (ui->searchBox->text().isEmpty()) {
QItemSelectionModel* selectionModel = ui->appsList->selectionModel();
if (selectionModel->hasSelection()) {
showActionMenu(selectionModel->selectedIndexes().first());
}
return true;
}
}
}
}
return false;
}
================================================
FILE: desktop/gateway/maingatewaywidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef MAINGATEWAYWIDGET_H
#define MAINGATEWAYWIDGET_H
#include
namespace Ui {
class MainGatewayWidget;
}
struct MainGatewayWidgetPrivate;
class MainGatewayWidget : public QWidget {
Q_OBJECT
public:
explicit MainGatewayWidget(QWidget* parent = nullptr);
~MainGatewayWidget();
QSize sizeHint() const;
void clearState();
private slots:
void on_searchBox_textEdited(const QString& arg1);
void on_appsList_clicked(const QModelIndex& index);
void on_searchBox_returnPressed();
void on_endSessionButton_clicked();
void on_allAppsButton_toggled(bool checked);
void on_titleLabel_backButtonClicked();
void on_statusCenterButton_clicked();
void on_systemSettingsButton_clicked();
signals:
void closeGateway();
private:
Ui::MainGatewayWidget* ui;
MainGatewayWidgetPrivate* d;
void launch(QModelIndex applicationIndex);
bool showActionMenu(QModelIndex applicationIndex);
void changeEvent(QEvent* event);
void resizeEvent(QResizeEvent* event);
// QObject interface
public:
bool eventFilter(QObject* watched, QEvent* event);
};
#endif // MAINGATEWAYWIDGET_H
================================================
FILE: desktop/gateway/maingatewaywidget.ui
================================================
MainGatewayWidget
0
0
405
570
Form
0
0
0
0
0
-
0
0
0
0
0
0
-
Gateway
-
false
Type to search...
true
-
16777215
1
Qt::Horizontal
-
0
0
0
0
0
-
0
0
0
0
0
-
0
0
0
0
0
-
75
true
CATEGORIES
9
-
All Apps
true
true
true
-
-
16777215
1
Qt::Horizontal
-
Status Center
-
Qt::Vertical
20
353
-
1
16777215
Qt::Vertical
-
0
0
0
0
0
-
QFrame::NoFrame
-
Qt::Vertical
20
64
-
15
Preparing the Gateway...
Qt::AlignCenter
-
-
Qt::Horizontal
40
20
-
-
Qt::Horizontal
40
20
-
Qt::Vertical
20
63
-
16777215
1
Qt::Horizontal
-
-
0
0
20
TextLabel
-
-
Qt::Horizontal
40
20
-
System Settings
true
-
Qt::NoFocus
End Session
..
true
tStackedWidget
QStackedWidget
1
switchingFrame(int)
tTitleLabel
QLabel
backButtonClicked()
tCircularSpinner
QWidget
1
================================================
FILE: desktop/gateway/searchresultswidget.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "searchresultswidget.h"
#include "ui_searchresultswidget.h"
#include
#include "gatewaysearchmodel.h"
#include "gatewaysearchmodeldelegate.h"
struct SearchResultsWidgetPrivate {
GatewaySearchModel* model;
int maxHeight = 0;
};
SearchResultsWidget::SearchResultsWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::SearchResultsWidget) {
ui->setupUi(this);
d = new SearchResultsWidgetPrivate();
d->model = new GatewaySearchModel();
ui->listView->setModel(d->model);
ui->listView->setItemDelegate(new GatewaySearchModelDelegate(this));
connect(d->model, &GatewaySearchModel::dataChanged, this, [ = ] {
int height = 1;
for (int i = 0; i < d->model->rowCount(); i++) {
height += ui->listView->sizeHintForRow(i);
}
if (height > this->parentWidget()->height()) height = this->parentWidget()->height();// + 1;
this->setFixedHeight(height);
});
QPalette pal = ui->listView->palette();
pal.setColor(QPalette::Base, Qt::transparent);
ui->listView->setPalette(pal);
ui->line->setVisible(false);
}
SearchResultsWidget::~SearchResultsWidget() {
delete ui;
delete d;
}
void SearchResultsWidget::search(QString query) {
ui->listView->selectionModel()->clear();
d->model->search(query);
}
void SearchResultsWidget::moveSelectionUp() {
QItemSelectionModel* selectionModel = ui->listView->selectionModel();
int selectionRow = d->model->rowCount() - 1;
if (selectionModel->hasSelection()) {
int row = selectionModel->selectedIndexes().first().row();
if (row != 0) selectionRow = row - 1;
}
selectionModel->select(d->model->index(selectionRow), QItemSelectionModel::ClearAndSelect);
ui->listView->scrollTo(d->model->index(selectionRow), QListView::PositionAtCenter);
}
void SearchResultsWidget::moveSelectionDown() {
QItemSelectionModel* selectionModel = ui->listView->selectionModel();
int selectionRow = 0;
if (selectionModel->hasSelection()) {
int row = selectionModel->selectedIndexes().first().row();
if (row != d->model->rowCount() - 1) selectionRow = row + 1;
}
selectionModel->select(d->model->index(selectionRow), QItemSelectionModel::ClearAndSelect);
ui->listView->scrollTo(d->model->index(selectionRow), QListView::PositionAtCenter);
}
void SearchResultsWidget::launchSelected() {
QModelIndexList indices = ui->listView->selectionModel()->selectedIndexes();
if (indices.isEmpty() || !indices.first().isValid()) {
if (d->model->rowCount() > 0) launch(d->model->index(0));
} else {
launch(indices.at(0));
}
}
void SearchResultsWidget::on_listView_clicked(const QModelIndex& index) {
launch(index);
}
void SearchResultsWidget::launch(QModelIndex index) {
d->model->launch(index);
emit closeGateway();
}
================================================
FILE: desktop/gateway/searchresultswidget.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2021 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef SEARCHRESULTSWIDGET_H
#define SEARCHRESULTSWIDGET_H
#include
namespace Ui {
class SearchResultsWidget;
}
struct SearchResultsWidgetPrivate;
class SearchResultsWidget : public QWidget {
Q_OBJECT
public:
explicit SearchResultsWidget(QWidget* parent = nullptr);
~SearchResultsWidget();
void search(QString query);
void moveSelectionUp();
void moveSelectionDown();
void launchSelected();
private slots:
void on_listView_clicked(const QModelIndex& index);
signals:
void closeGateway();
private:
Ui::SearchResultsWidget* ui;
SearchResultsWidgetPrivate* d;
void launch(QModelIndex index);
};
#endif // SEARCHRESULTSWIDGET_H
================================================
FILE: desktop/gateway/searchresultswidget.ui
================================================
SearchResultsWidget
0
0
400
300
Form
0
0
0
0
0
-
QFrame::NoFrame
-
16777215
1
Qt::Horizontal
================================================
FILE: desktop/main.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "background/background.h"
#include "bar/barwindow.h"
#include "cli/commandline.h"
#include "crash/crashhandling.h"
#include "plugins/pluginmanager.h"
#include "run/rundialog.h"
#include "server/sessionserver.h"
#include "session/endsession.h"
#include
#include
#include "gateway/appsearchprovider.h"
int main(int argc, char* argv[]) {
tApplication a(argc, argv);
a.setOrganizationName("theSuite");
a.setOrganizationDomain("vicr123.com");
a.setApplicationName("theDesk");
a.setApplicationVersion("2.0");
a.setCopyrightYear("2024");
a.setApplicationShareDir("thedesk");
StateManager::instance();
StateManager::localeManager()->addTranslationSet({a.applicationDirPath() + "/translations",
"/usr/share/thedesk/translations"});
tSettings::registerDefaults(QDir::cleanPath(qApp->applicationDirPath() + "/../desktop/thedesk.conf"));
tSettings::registerDefaults("/usr/share/defaults/thedesk.conf");
CrashHandling::prepareCrashHandler();
// Parse command line arguments
int parseResult = CommandLine::parse(a.arguments());
if (parseResult != -1) {
// Stop running right here
return parseResult;
}
if (a.queryKeyboardModifiers() & Qt::ControlModifier && !PluginManager::instance()->isSafeMode()) {
tPromiseResults results = SessionServer::instance()->askQuestion(QApplication::translate("main", "Safe Mode"), QApplication::translate("main", "You're holding the CTRL key. Start theDesk in Safe Mode?"))->await();
if (results.result) PluginManager::instance()->setSafeMode(true);
}
DesktopWm::instance()->registerAsPrimaryProvider();
PluginManager::instance()->scanPlugins();
QObject::connect(StateManager::instance()->powerManager(), &PowerManager::powerOffConfirmationRequested, [=](PowerManager::PowerOperation operation, QString message, QStringList flags, tPromiseFunctions::SuccessFunction cb) {
EndSession::showDialog(operation, message, flags)->then(cb);
});
// Perform onboarding if required
if (!OnboardingController::performOnboarding(false)) {
// Exit now because onboarding failed (probably the user chose to log out)
return 0;
}
// Prepare the run dialog
RunDialog::initialise();
// Prepare the background
Background::reconfigureBackgrounds();
StateManager::gatewayManager()->registerSearchProvider(new AppSearchProvider());
BarWindow w;
w.show();
QTimer::singleShot(0, [=] {
SessionServer::instance()->hideSplashes();
SessionServer::instance()->performAutostart();
});
return a.exec();
}
================================================
FILE: desktop/media/welcome1.webm
================================================
[File too large to display: 10.3 MB]
================================================
FILE: desktop/resources.qrc
================================================
icons/thedesk.svg
icons/cactus.svg
================================================
FILE: desktop/run/rundialog.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "rundialog.h"
#include "ui_rundialog.h"
#include "transparentdialog.h"
#include
#include
#include
#include
#include
RunDialog::RunDialog(QWidget* parent) :
QWidget(parent),
ui(new Ui::RunDialog) {
ui->setupUi(this);
ui->titleLabel->setBackButtonShown(true);
ui->widget->setFixedWidth(SC_DPI(600));
this->setFocusProxy(ui->lineEdit);
}
RunDialog::~RunDialog() {
delete ui;
}
void RunDialog::initialise() {
KeyGrab* grab = new KeyGrab(QKeySequence(Qt::AltModifier | Qt::Key_F2), "run");
connect(grab, &KeyGrab::activated, [ = ] {
TransparentDialog* dialog = new TransparentDialog();
dialog->setWindowFlag(Qt::FramelessWindowHint);
dialog->setWindowFlag(Qt::WindowStaysOnTopHint);
dialog->showFullScreen();
QTimer::singleShot(500, [ = ] {
RunDialog* popoverContents = new RunDialog();
tPopover* popover = new tPopover(popoverContents);
popover->setPopoverSide(tPopover::Bottom);
popover->setPopoverWidth(popoverContents->sizeHint().height());
connect(popoverContents, &RunDialog::done, popover, &tPopover::dismiss);
connect(popover, &tPopover::dismissed, popoverContents, &RunDialog::deleteLater);
connect(popover, &tPopover::dismissed, [ = ] {
popover->deleteLater();
dialog->deleteLater();
});
popover->show(dialog);
popoverContents->setFocus();
});
});
}
void RunDialog::on_titleLabel_backButtonClicked() {
emit done();
}
void RunDialog::on_runButton_clicked() {
QStringList parts = ui->lineEdit->text().split(" ");
QString executable = parts.takeFirst();
if (QProcess::startDetached(executable, parts)) {
emit done();
} else {
tErrorFlash::flashError(ui->lineEdit);
}
}
================================================
FILE: desktop/run/rundialog.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef RUNDIALOG_H
#define RUNDIALOG_H
#include
namespace Ui {
class RunDialog;
}
class RunDialog : public QWidget {
Q_OBJECT
public:
explicit RunDialog(QWidget* parent = nullptr);
~RunDialog();
static void initialise();
private slots:
void on_titleLabel_backButtonClicked();
void on_runButton_clicked();
signals:
void done();
private:
Ui::RunDialog* ui;
};
#endif // RUNDIALOG_H
================================================
FILE: desktop/run/rundialog.ui
================================================
RunDialog
0
0
400
300
Form
0
0
0
0
0
-
Run
-
6
0
0
0
0
-
Enter a command to run.
9
-
-
Run this command
tTitleLabel
QLabel
backButtonClicked()
lineEdit
returnPressed()
runButton
click()
198
254
198
278
================================================
FILE: desktop/session/endsession.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "endsession.h"
#include "ui_endsession.h"
#include "transparentdialog.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct EndSessionPrivate {
tVariantAnimation* powerOffAnimation;
EndSessionButton* timedButton;
};
EndSession::EndSession(PowerManager::PowerOperation operation, QString message, QStringList flags, QWidget* parent) :
QWidget(parent),
ui(new Ui::EndSession) {
ui->setupUi(this);
d = new EndSessionPrivate();
if (message == "") {
message = tr("Hey %1, ready to head out? We'll %2 in %n seconds if you don't do anything.");
}
ui->rebootInstallUpdatesButton->setVisible(false);
if (operation != PowerManager::All) {
ui->powerOffButton->setVisible(false);
ui->rebootButton->setVisible(false);
ui->logoutButton->setVisible(false);
ui->suspendButton->setVisible(false);
ui->lockButton->setVisible(false);
ui->screenOffButton->setVisible(false);
ui->switchUsersButton->setVisible(false);
ui->hibernateButton->setVisible(false);
}
switch (operation) {
case PowerManager::All:
if (StateManager::onboardingManager()->isOnboardingRunning()) {
ui->lockButton->setVisible(false);
ui->screenOffButton->setVisible(false);
}
Q_FALLTHROUGH();
case PowerManager::PowerOff:
d->timedButton = ui->powerOffButton;
break;
case PowerManager::Reboot:
if (flags.contains("update")) {
d->timedButton = ui->rebootInstallUpdatesButton;
} else {
d->timedButton = ui->rebootButton;
}
break;
case PowerManager::LogOut:
d->timedButton = ui->logoutButton;
break;
case PowerManager::Suspend:
d->timedButton = ui->suspendButton;
break;
case PowerManager::Lock:
d->timedButton = ui->lockButton;
break;
case PowerManager::TurnOffScreen:
d->timedButton = ui->screenOffButton;
break;
case PowerManager::Hibernate:
d->timedButton = ui->hibernateButton;
break;
}
d->timedButton->setVisible(true);
d->timedButton->setProperty("type", "destructive");
d->powerOffAnimation = new tVariantAnimation();
d->powerOffAnimation->setStartValue(60.0);
d->powerOffAnimation->setEndValue(0.0);
d->powerOffAnimation->setDuration(60000);
d->powerOffAnimation->setForceAnimation(true);
connect(d->powerOffAnimation, &tVariantAnimation::valueChanged, this, [=](QVariant value) {
const QMap text = {
{ui->powerOffButton, QT_TR_NOOP("power off the system") },
{ui->rebootButton, QT_TR_NOOP("reboot the system") },
{ui->rebootInstallUpdatesButton, QT_TR_NOOP("reboot the system and install any pending updates")},
{ui->logoutButton, QT_TR_NOOP("log you out") },
{ui->suspendButton, QT_TR_NOOP("suspend the system") },
{ui->lockButton, QT_TR_NOOP("lock the screen") },
{ui->screenOffButton, QT_TR_NOOP("turn off the screen") },
{ui->switchUsersButton, QT_TR_NOOP("switch users") },
{ui->hibernateButton, QT_TR_NOOP("hibernate the system") }
};
ui->descriptionLabel->setText(tr(qPrintable(message), nullptr, value.toFloat() < 1 ? 1 : qRound(value.toDouble()))
.arg(DesktopWm::userDisplayName())
.arg(tr(text.value(d->timedButton))));
d->timedButton->setTimeRemaining(value.toDouble());
});
connect(d->powerOffAnimation, &tVariantAnimation::finished, d->timedButton, &QCommandLinkButton::click);
d->powerOffAnimation->start();
ui->centeredWidget->setFixedWidth(SC_DPI(600));
ui->centeredWidgetUpdates->setFixedWidth(SC_DPI(600));
ui->powerOffButton->setProperty("type", "destructive");
ui->rebootButton->setProperty("type", "destructive");
ui->titleLabel->setBackButtonShown(true);
ui->updatesAvailableTitle->setBackButtonShown(true);
ui->stackedWidget->setCurrentAnimation(tStackedWidget::SlideHorizontal);
}
EndSession::~EndSession() {
d->powerOffAnimation->stop();
delete d;
delete ui;
}
tPromise* EndSession::showDialog(PowerManager::PowerOperation operation, QString message, QStringList flags) {
return tPromise::runOnSameThread([=](tPromiseFunctions::SuccessFunction res, tPromiseFunctions::FailureFunction rej) {
Q_UNUSED(rej)
TransparentDialog* dialog = new TransparentDialog();
dialog->showFullScreen();
QTimer::singleShot(500, [=] {
EndSession* popoverContents = new EndSession(operation, message, flags);
tPopover* popover = new tPopover(popoverContents);
popover->setPopoverSide(tPopover::Bottom);
popover->setPopoverWidth(popoverContents->heightForWidth(dialog->width()));
connect(popoverContents, &EndSession::done, popover, &tPopover::dismiss);
connect(popover, &tPopover::dismissed, popoverContents, &EndSession::deleteLater);
connect(popover, &tPopover::dismissed, [=] {
popover->deleteLater();
dialog->deleteLater();
popoverContents->deleteLater();
res();
});
popover->show(dialog);
});
});
}
void EndSession::on_titleLabel_backButtonClicked() {
d->powerOffAnimation->stop();
emit done();
}
void EndSession::on_powerOffButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::PowerOff);
emit done();
}
void EndSession::on_rebootButton_clicked() {
if (QFile("/var/lib/PackageKit/prepared-update").exists() && !QFile::exists("/system-update")) {
// Ask the user to install updates
ui->stackedWidget->setCurrentWidget(ui->updatesAvailablePage);
} else {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Reboot);
emit done();
}
}
void EndSession::on_logoutButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::LogOut);
emit done();
}
void EndSession::on_suspendButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Suspend);
emit done();
}
void EndSession::on_lockButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Lock);
emit done();
}
void EndSession::on_screenOffButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::TurnOffScreen);
emit done();
}
void EndSession::on_switchUsersButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::SwitchUsers);
emit done();
}
void EndSession::on_hibernateButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Hibernate);
emit done();
}
void EndSession::on_updatesAvailableTitle_backButtonClicked() {
ui->stackedWidget->setCurrentWidget(ui->mainPage);
}
void EndSession::on_rebootNoUpdateButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Reboot);
emit done();
}
void EndSession::on_rebootUpdateButton_clicked() {
// Reboot
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Reboot, {"update"});
emit done();
}
void EndSession::on_stackedWidget_switchingFrame(int frame) {
if (frame == 0) {
d->powerOffAnimation->start();
} else {
d->powerOffAnimation->stop();
}
}
void EndSession::on_rebootInstallUpdatesButton_clicked() {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Reboot, {"update"});
emit done();
}
void EndSession::on_rebootButton_customContextMenuRequested(const QPoint& pos) {
QMenu* menu = new QMenu();
menu->addSection(tr("Advanced Reboot"));
menu->addAction(QIcon::fromTheme("system-reboot"), tr("Reboot"), [=] {
// Just reboot
ui->rebootButton->click();
});
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "CanRebootToFirmwareSetup");
QDBusMessage msg = QDBusConnection::systemBus().call(message);
if (msg.arguments().first().toString() == "yes") {
menu->addAction(QIcon::fromTheme("system-reboot"), tr("Reboot into System UEFI Setup"), [=] {
StateManager::instance()->powerManager()->performPowerOperation(PowerManager::Reboot, {"setup"});
emit done();
});
}
menu->popup(ui->rebootButton->mapToGlobal(pos));
}
================================================
FILE: desktop/session/endsession.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef ENDSESSION_H
#define ENDSESSION_H
#include
#include
#include
namespace Ui {
class EndSession;
}
struct EndSessionPrivate;
class EndSession : public QWidget {
Q_OBJECT
public:
~EndSession();
static tPromise* showDialog(PowerManager::PowerOperation operation = PowerManager::All, QString message = "", QStringList flags = {});
signals:
void done();
private slots:
void on_titleLabel_backButtonClicked();
void on_powerOffButton_clicked();
void on_rebootButton_clicked();
void on_logoutButton_clicked();
void on_suspendButton_clicked();
void on_lockButton_clicked();
void on_screenOffButton_clicked();
void on_switchUsersButton_clicked();
void on_hibernateButton_clicked();
void on_updatesAvailableTitle_backButtonClicked();
void on_rebootNoUpdateButton_clicked();
void on_rebootUpdateButton_clicked();
void on_stackedWidget_switchingFrame(int frame);
void on_rebootInstallUpdatesButton_clicked();
void on_rebootButton_customContextMenuRequested(const QPoint &pos);
private:
explicit EndSession(PowerManager::PowerOperation operation, QString message, QStringList flags, QWidget* parent = nullptr);
Ui::EndSession* ui;
EndSessionPrivate* d;
};
#endif // ENDSESSION_H
================================================
FILE: desktop/session/endsession.ui
================================================
EndSession
0
0
799
515
Form
0
0
0
0
0
-
0
0
0
0
0
0
-
End Session
-
-
600
16777215
0
0
0
0
0
-
9
9
-
Ready to leave?
true
-
9
-
Power Off
..
Turns off your computer.
-
Qt::CustomContextMenu
Reboot
..
Turns off your computer and turns it on again
-
Reboot and install updates
..
Turns off your computer, installs pending updates and turns it on again
-
Log Out
..
Ends your session but keeps your computer on for other people to use
-
Suspend
..
Puts your computer in a low power state so it reopens quickly
-
Lock
..
Locks your workspace with your password
-
Turn Off Screen
..
Turns off the screen, but keeps everything else running in the background
-
Switch Users
..
Switches to the logon screen, but keeps your session in the background
-
Hibernate
..
Powers off your computer, but restores the session when powered back on
-
Qt::Vertical
0
20
0
0
0
0
0
-
Reboot
-
0
0
0
0
0
-
0
0
0
0
0
-
9
6
-
Updates are available. What do you want to do?
-
0
0
Reboot and update
..
We'll perform system updates once this device has rebooted.
-
0
0
Reboot
..
We'll reboot your device normally.
-
Qt::Vertical
20
348
tStackedWidget
QStackedWidget
1
switchingFrame(int)
tTitleLabel
QLabel
backButtonClicked()
EndSessionButton
QCommandLinkButton
session/endsessionbutton.h
================================================
FILE: desktop/session/endsessionbutton.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "endsessionbutton.h"
#include
#include
struct EndSessionButtonPrivate {
double timeRemaining = 0;
};
EndSessionButton::EndSessionButton(QWidget* parent) : QCommandLinkButton(parent) {
d = new EndSessionButtonPrivate();
}
EndSessionButton::~EndSessionButton() {
delete d;
}
void EndSessionButton::setTimeRemaining(double timeRemaining) {
d->timeRemaining = timeRemaining;
this->update();
}
void EndSessionButton::paintEvent(QPaintEvent* event) {
QCommandLinkButton::paintEvent(event);
QPainter* painter = new QPainter(this);
tPaintCalculator calculator;
calculator.setDrawBounds(this->size());
calculator.setPainter(painter);
calculator.setLayoutDirection(this->layoutDirection());
calculator.addRect(QRectF(0, 0, this->width() * d->timeRemaining / 60.0, this->height()), [ = ](QRectF drawBounds) {
painter->setBrush(QColor(255, 255, 255, 50));
painter->setPen(Qt::transparent);
painter->drawRect(drawBounds);
});
calculator.performPaint();
delete painter;
}
================================================
FILE: desktop/session/endsessionbutton.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef ENDSESSIONBUTTON_H
#define ENDSESSIONBUTTON_H
#include
struct EndSessionButtonPrivate;
class EndSessionButton : public QCommandLinkButton {
Q_OBJECT
public:
explicit EndSessionButton(QWidget* parent = nullptr);
~EndSessionButton();
void setTimeRemaining(double timeRemaining);
signals:
private:
EndSessionButtonPrivate* d;
void paintEvent(QPaintEvent* event);
};
#endif // ENDSESSIONBUTTON_H
================================================
FILE: desktop/statuscenter/leftpanedelegate.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "leftpanedelegate.h"
#include
#include
#include
LeftPaneDelegate::LeftPaneDelegate(QObject* parent) :
QStyledItemDelegate(parent) {
}
void LeftPaneDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
QStyledItemDelegate::paint(painter, option, index);
if (index.data(Qt::UserRole).toBool()) {
// Draw an indicator arrow
tPaintCalculator calculator;
calculator.setDrawBounds(option.rect);
calculator.setLayoutDirection(option.direction);
QRect iconRect;
iconRect.setSize(SC_DPI_T(QSize(16, 16), QSize));
iconRect.moveCenter(option.rect.center());
iconRect.moveRight(option.rect.right() - SC_DPI(6));
calculator.addRect(iconRect, [=](QRectF drawBounds) {
painter->drawPixmap(drawBounds.toRect(), QIcon::fromTheme("arrow-right").pixmap(iconRect.size()));
});
calculator.performPaint();
}
}
================================================
FILE: desktop/statuscenter/leftpanedelegate.h
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#ifndef LEFTPANEDELEGATE_H
#define LEFTPANEDELEGATE_H
#include
class LeftPaneDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
explicit LeftPaneDelegate(QObject* parent = nullptr);
signals:
// QAbstractItemDelegate interface
public:
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
#endif // LEFTPANEDELEGATE_H
================================================
FILE: desktop/statuscenter/statuscenter.cpp
================================================
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2020 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* *************************************/
#include "statuscenter.h"
#include "ui_statuscenter.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include "statuscenterleftpane.h"
#include "common/common.h"
#include "systemsettings/systemsettings.h"
#include
#include "statuscenterquickswitch.h"
struct StatusCenterPrivate {
StatusCenterLeftPane* leftPane;
bool leftPaneAttached = false;
QList> loadedPanes;
QMap paneItems;
QList> switchItems;
QStringList preferredPaneOrder;
QStringList preferredSwitchOrder;
tSettings settings;
};
StatusCenter::StatusCenter(QWidget* parent) :
QWidget(parent),
ui(new Ui::StatusCenter) {
ui->setupUi(this);
d = new StatusCenterPrivate();
ui->stackedWidget->setCurrentAnimation(tStackedWidget::Lift);
d->preferredPaneOrder = d->settings.delimitedList("StatusCenter/panesOrder");
d->preferredSwitchOrder = d->settings.delimitedList("StatusCenter/quickSwitchOrder");
d->preferredPaneOrder.removeAll("SystemSettings");
d->preferredPaneOrder.append("SystemSettings");
d->leftPane = new StatusCenterLeftPane(this);
if (this->width() <= SC_DPI(1024)) {
d->leftPaneAttached = true;
detachLeftPane();
} else {
d->leftPaneAttached = false;
attachLeftPane();
}
connect(StateManager::statusCenterManager(), &StatusCenterManager::paneAdded, this, [ = ](StatusCenterPane * pane, StatusCenterManager::PaneType type) {
if (type == StatusCenterManager::Informational) {
this->addPane(pane);
}
});
connect(StateManager::statusCenterManager(), &StatusCenterManager::paneRemoved, this, &StatusCenter::removePane);
connect(StateManager::statusCenterManager(), &StatusCenterManager::showHamburgerMenu, this, &StatusCenter::showHamburgerMenu);
connect(StateManager::statusCenterManager(), &StatusCenterManager::rootMenu, d->leftPane, &StatusCenterLeftPane::popMenu);
connect(StateManager::statusCenterManager(), &StatusCenterManager::switchAdded, this, &StatusCenter::addSwitch);
connect(StateManager::statusCenterManager(), &StatusCenterManager::switchRemoved, this, &StatusCenter::removeSwitch);
for (StatusCenterPane* pane : StateManager::statusCenterManager()->panes()) {
if (StateManager::statusCenterManager()->paneType(pane) == StatusCenterManager::Informational) this->addPane(pane);
}
for (QuickSwitch* sw : StateManager::statusCenterManager()->switches()) {
this->addSwitch(sw);
}
connect(d->leftPane, &StatusCenterLeftPane::indexChanged, this, QOverload::of(&StatusCenter::selectPane));
connect(d->leftPane, &StatusCenterLeftPane::enterMenu, this, &StatusCenter::enterMenu);
connect(StateManager::statusCenterManager(), QOverload::of(&StatusCenterManager::paneRequest), this, [ = ](QString paneName) {
for (StatusCenterPane* pane : StateManager::statusCenterManager()->panes()) {
if (pane->name() == paneName) {
if (StateManager::statusCenterManager()->paneType(pane) == StatusCenterManager::Informational) {
selectPane(pane);
} else {
selectPane("SystemSettings");
}
}
}
});
connect(StateManager::statusCenterManager(), QOverload::of(&StatusCenterManager::paneRequest), this, [ = ](StatusCenterPane * pane) {
if (StateManager::statusCenterManager()->paneType(pane) == StatusCenterManager::Informational) {
selectPane(pane);
} else {
selectPane("SystemSettings");
}
});
//Add internal items to the Status Center
StateManager::instance()->statusCenterManager()->addPane(new SystemSettings(d->leftPane), StatusCenterManager::Informational);
QShortcut* escapeShortcut = new QShortcut(Qt::Key_Escape, this);
connect(escapeShortcut, &QShortcut::activated, ui->closeButton, &QToolButton::click);
}
StatusCenter::~StatusCenter() {
delete d;
delete ui;
}
void StatusCenter::on_closeButton_clicked() {
StateManager::instance()->statusCenterManager()->hide();
}
void StatusCenter::resizeEvent(QResizeEvent* event) {
if (this->width() <= SC_DPI(1024)) {
detachLeftPane();
} else {
attachLeftPane();
}
}
void StatusCenter::attachLeftPane() {
if (d->leftPaneAttached) return;
ui->leftPaneContainer->addWidget(d->leftPane);
d->leftPane->setAttached(true);
StateManager::statusCenterManager()->setIsHamburgerMenuRequired(false);
d->leftPaneAttached = true;
}
void StatusCenter::detachLeftPane() {
if (!d->leftPaneAttached) return;
ui->leftPaneContainer->removeWidget(d->leftPane);
d->leftPane->move(-d->leftPane->width(), 0);
d->leftPane->setAttached(false);
StateManager::statusCenterManager()->setIsHamburgerMenuRequired(true);
d->leftPaneAttached = false;
}
void StatusCenter::showHamburgerMenu() {
if (!tPopover::popoverForWidget(ui->mainWidget)) {
tPopover* popover = new tPopover(d->leftPane);
popover->setPopoverWidth(d->leftPane->width());
popover->setPopoverSide(tPopover::Leading);
connect(StateManager::statusCenterManager(), &StatusCenterManager::hideHamburgerMenu, popover, &tPopover::dismiss);
connect(popover, &tPopover::dismissed, popover, &tPopover::deleteLater);
popover->show(ui->mainWidget);
}
}
void StatusCenter::selectPane(StatusCenterPane* pane) {
ui->stackedWidget->setCurrentWidget(pane);
if (pane->leftPane()) d->leftPane->pushMenu(pane->leftPane());
d->paneItems.value(pane)->setSelected(true);
}
void StatusCenter::selectPane(QString pane) {
for (QPair loadedPane : d->loadedPanes) {
if (loadedPane.first == pane) selectPane(loadedPane.second);
}
}
void StatusCenter::selectPane(int index) {
selectPane(d->loadedPanes.at(index).second);
}
void StatusCenter::enterMenu(int index) {
StatusCenterPane* pane = d->loadedPanes.at(index).second;
if (pane->leftPane()) {
if (d->leftPane->peekMenu() != pane->leftPane()) d->leftPane->pushMenu(pane->leftPane());
} else {
StateManager::statusCenterManager()->hideStatusCenterHamburgerMenu();
}
}
void StatusCenter::addPane(StatusCenterPane* pane) {
QListWidgetItem* item = new QListWidgetItem();
item->setText(pane->displayName());
item->setIcon(pane->icon());
connect(pane, &StatusCenterPane::displayNameChanged, this, [ = ] {
if (d->paneItems.contains(pane)) {
d->paneItems.value(pane)->setText(pane->displayName());
}
});
connect(pane, &StatusCenterPane::iconChanged, this, [ = ] {
if (d->paneItems.contains(pane)) {
d->paneItems.value(pane)->setIcon(pane->icon());
}
});
if (pane->leftPane()) {
item->setData(Qt::UserRole, true);
}
d->paneItems.insert(pane, item);
QStringList currentItems;
for (QPair item : d->loadedPanes) {
currentItems.append(item.first);
}
int index = Common::getInsertionIndex(d->preferredPaneOrder, currentItems, pane->name());
if (index == -1) {
//Add it at the end
ui->stackedWidget->addWidget(pane);
d->leftPane->appendItem(item);
d->loadedPanes.append({pane->name(), pane});
} else {
//Add this chunk at the correct index
ui->stackedWidget->insertWidget(index, pane);
d->leftPane->insertItem(index, item);
d->loadedPanes.insert(index, {pane->name(), pane});
}
}
void StatusCenter::removePane(StatusCenterPane* pane) {
for (int i = 0; i < d->loadedPanes.count(); i++) {
if (d->loadedPanes.at(i).second == pane) {
QListWidgetItem* item = d->paneItems.take(pane);
d->leftPane->removeItem(item);
delete item;
ui->stackedWidget->removeWidget(pane);
d->loadedPanes.removeAt(i);
return;
}
}
}
void StatusCenter::addSwitch(QuickSwitch* sw) {
QStringList currentItems;
for (QPair