Add transparent overlay window (#4746)
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "widgets/helper/ResizingTextEdit.hpp"
|
||||
#include "widgets/helper/SearchPopup.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/OverlayWindow.hpp"
|
||||
#include "widgets/Scrollbar.hpp"
|
||||
#include "widgets/splits/DraggedSplit.hpp"
|
||||
#include "widgets/splits/SplitContainer.hpp"
|
||||
@@ -765,6 +766,47 @@ void Split::addShortcuts()
|
||||
}
|
||||
return "";
|
||||
}},
|
||||
{"popupOverlay",
|
||||
[this](const auto &) -> QString {
|
||||
this->showOverlayWindow();
|
||||
return {};
|
||||
}},
|
||||
{"toggleOverlayInertia",
|
||||
[this](const auto &args) -> QString {
|
||||
if (args.empty())
|
||||
{
|
||||
return "No arguments provided to toggleOverlayInertia "
|
||||
"(expected one)";
|
||||
}
|
||||
const auto &arg = args.front();
|
||||
|
||||
if (arg == "this")
|
||||
{
|
||||
if (this->overlayWindow_)
|
||||
{
|
||||
this->overlayWindow_->toggleInertia();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (arg == "thisOrAll")
|
||||
{
|
||||
if (this->overlayWindow_)
|
||||
{
|
||||
this->overlayWindow_->toggleInertia();
|
||||
}
|
||||
else
|
||||
{
|
||||
getApp()->getWindows()->toggleAllOverlayInertia();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (arg == "all")
|
||||
{
|
||||
getApp()->getWindows()->toggleAllOverlayInertia();
|
||||
return {};
|
||||
}
|
||||
return {};
|
||||
}},
|
||||
};
|
||||
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
@@ -1104,6 +1146,20 @@ void Split::popup()
|
||||
window.show();
|
||||
}
|
||||
|
||||
OverlayWindow *Split::overlayWindow()
|
||||
{
|
||||
return this->overlayWindow_.data();
|
||||
}
|
||||
|
||||
void Split::showOverlayWindow()
|
||||
{
|
||||
if (!this->overlayWindow_)
|
||||
{
|
||||
this->overlayWindow_ = new OverlayWindow(this->getIndirectChannel());
|
||||
}
|
||||
this->overlayWindow_->show();
|
||||
}
|
||||
|
||||
void Split::clear()
|
||||
{
|
||||
this->view_->clearMessages();
|
||||
|
||||
@@ -21,6 +21,7 @@ class SplitInput;
|
||||
class SplitContainer;
|
||||
class SplitOverlay;
|
||||
class SelectChannelDialog;
|
||||
class OverlayWindow;
|
||||
|
||||
// Each ChatWidget consists of three sub-elements that handle their own part of
|
||||
// the chat widget: ChatWidgetHeader
|
||||
@@ -80,6 +81,8 @@ public:
|
||||
// This is called on window focus lost
|
||||
void unpause();
|
||||
|
||||
OverlayWindow *overlayWindow();
|
||||
|
||||
static pajlada::Signals::Signal<Qt::KeyboardModifiers>
|
||||
modifierStatusChanged;
|
||||
static Qt::KeyboardModifiers modifierStatus;
|
||||
@@ -158,6 +161,8 @@ private:
|
||||
SplitInput *const input_;
|
||||
SplitOverlay *const overlay_;
|
||||
|
||||
QPointer<OverlayWindow> overlayWindow_;
|
||||
|
||||
QPointer<SelectChannelDialog> selectChannelDialog_;
|
||||
|
||||
pajlada::Signals::Connection channelIDChangedConnection_;
|
||||
@@ -179,6 +184,7 @@ public slots:
|
||||
void explainMoving();
|
||||
void explainSplitting();
|
||||
void popup();
|
||||
void showOverlayWindow();
|
||||
void clear();
|
||||
void openInBrowser();
|
||||
void openModViewInBrowser();
|
||||
|
||||
@@ -390,6 +390,9 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
menu->addAction(
|
||||
"Popup", this->split_, &Split::popup,
|
||||
h->getDisplaySequence(HotkeyCategory::Window, "popup", {{"split"}}));
|
||||
menu->addAction(
|
||||
"Popup overlay", this->split_, &Split::showOverlayWindow,
|
||||
h->getDisplaySequence(HotkeyCategory::Split, "popupOverlay"));
|
||||
menu->addAction(
|
||||
"Search", this->split_,
|
||||
[this] {
|
||||
|
||||
Reference in New Issue
Block a user