Skip to content

Commit b2b2c95

Browse files
committed
update actions
1 parent 176ce30 commit b2b2c95

File tree

18 files changed

+298
-194
lines changed

18 files changed

+298
-194
lines changed

src/libs/application/uishell/src/qml/HomeWindow.qml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Window {
2525

2626
readonly property bool isMacOS: Qt.platform.os === "osx" || Qt.platform.os === "macos"
2727

28+
readonly property CommandPalette commandPalette: commandPalettePopup
29+
readonly property InputPalette inputPalette: inputPalettePopup
30+
2831
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
2932
LayoutMirroring.childrenInherit: true
3033

@@ -51,6 +54,22 @@ Window {
5154
setupFrameless()
5255
}
5356

57+
CommandPalette {
58+
id: commandPalettePopup
59+
property double horizontalOffset: 0
60+
property double verticalOffset: 0
61+
x: (window.width - implicitWidth) / 2 + horizontalOffset
62+
y: titleBarArea.height + verticalOffset
63+
emptyText: qsTr("Empty")
64+
}
65+
InputPalette {
66+
id: inputPalettePopup
67+
property double horizontalOffset: 0
68+
property double verticalOffset: 0
69+
x: (window.width - implicitWidth) / 2 + horizontalOffset
70+
y: titleBarArea.height + verticalOffset
71+
}
72+
5473
RecentFilesProxyModel {
5574
id: recentFilesProxyModel
5675
sourceModel: window.recentFilesModel

src/plugins/coreplugin/core/quickinput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ namespace Core {
108108
}
109109
}
110110

111-
IProjectWindow *QuickInput::windowHandle() const {
111+
IWindow *QuickInput::windowHandle() const {
112112
Q_D(const QuickInput);
113113
return d->windowHandle;
114114
}
115115

116-
void QuickInput::setWindowHandle(IProjectWindow *windowHandle) {
116+
void QuickInput::setWindowHandle(IWindow *windowHandle) {
117117
Q_D(QuickInput);
118118
if (d->windowHandle != windowHandle) {
119119
// If currently visible, need to clean up InputPalette in old window first

src/plugins/coreplugin/core/quickinput.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Core {
1313

1414
class QuickInputPrivate;
15-
class IProjectWindow;
15+
class IWindow;
1616

1717
class CORE_EXPORT QuickInput : public QObject {
1818
Q_OBJECT
@@ -24,7 +24,7 @@ namespace Core {
2424
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
2525
Q_PROPERTY(SVS::SVSCraft::ControlType status READ status WRITE setStatus NOTIFY statusChanged)
2626
Q_PROPERTY(bool acceptable READ acceptable WRITE setAcceptable NOTIFY acceptableChanged)
27-
Q_PROPERTY(IProjectWindow *windowHandle READ windowHandle WRITE setWindowHandle NOTIFY windowHandleChanged)
27+
Q_PROPERTY(IWindow *windowHandle READ windowHandle WRITE setWindowHandle NOTIFY windowHandleChanged)
2828
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
2929

3030
public:
@@ -46,8 +46,8 @@ namespace Core {
4646
bool acceptable() const;
4747
void setAcceptable(bool acceptable);
4848

49-
IProjectWindow *windowHandle() const;
50-
void setWindowHandle(IProjectWindow *windowHandle);
49+
IWindow *windowHandle() const;
50+
void setWindowHandle(IWindow *windowHandle);
5151

5252
bool visible() const;
5353
void setVisible(bool visible);
@@ -65,7 +65,7 @@ namespace Core {
6565
void textChanged(const QString &text);
6666
void statusChanged(SVS::SVSCraft::ControlType status);
6767
void acceptableChanged(bool acceptable);
68-
void windowHandleChanged(IProjectWindow *windowHandle);
68+
void windowHandleChanged(Core::IWindow *windowHandle);
6969
void visibleChanged(bool visible);
7070

7171
void accepted();

src/plugins/coreplugin/core/quickinput_p.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <QPointer>
77

8-
#include <coreplugin/iprojectwindow.h>
8+
#include <CoreApi//iwindow.h>
99

1010
namespace Core {
1111

@@ -18,7 +18,7 @@ namespace Core {
1818
QString text;
1919
SVS::SVSCraft::ControlType status{SVS::SVSCraft::CT_Normal};
2020
bool acceptable{true};
21-
QPointer<IProjectWindow> windowHandle;
21+
QPointer<IWindow> windowHandle;
2222
bool visible{false};
2323
QPointer<QObject> inputPalette;
2424

src/plugins/coreplugin/core/quickpick.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ namespace Core {
8989
}
9090
}
9191

92-
IProjectWindow *QuickPick::windowHandle() const {
92+
IWindow *QuickPick::windowHandle() const {
9393
Q_D(const QuickPick);
9494
return d->windowHandle;
9595
}
9696

97-
void QuickPick::setWindowHandle(IProjectWindow *windowHandle) {
97+
void QuickPick::setWindowHandle(IWindow *windowHandle) {
9898
Q_D(QuickPick);
9999
if (d->windowHandle != windowHandle) {
100100
// If currently visible, need to clean up CommandPalette in old window first

src/plugins/coreplugin/core/quickpick.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class QAbstractItemModel;
1111
namespace Core {
1212

1313
class QuickPickPrivate;
14-
class IProjectWindow;
14+
class IWindow;
1515

1616
class CORE_EXPORT QuickPick : public QObject {
1717
Q_OBJECT
@@ -22,7 +22,7 @@ namespace Core {
2222
Q_PROPERTY(QString filterText READ filterText WRITE setFilterText NOTIFY filterTextChanged)
2323
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged)
2424
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
25-
Q_PROPERTY(IProjectWindow *windowHandle READ windowHandle WRITE setWindowHandle NOTIFY windowHandleChanged)
25+
Q_PROPERTY(IWindow *windowHandle READ windowHandle WRITE setWindowHandle NOTIFY windowHandleChanged)
2626
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
2727

2828
public:
@@ -41,8 +41,8 @@ namespace Core {
4141
int currentIndex() const;
4242
void setCurrentIndex(int currentIndex);
4343

44-
IProjectWindow *windowHandle() const;
45-
void setWindowHandle(IProjectWindow *windowHandle);
44+
IWindow *windowHandle() const;
45+
void setWindowHandle(IWindow *windowHandle);
4646

4747
bool visible() const;
4848
void setVisible(bool visible);
@@ -59,7 +59,7 @@ namespace Core {
5959
void filterTextChanged(const QString &filterText);
6060
void placeholderTextChanged(const QString &placeholderText);
6161
void currentIndexChanged(int currentIndex);
62-
void windowHandleChanged(IProjectWindow *windowHandle);
62+
void windowHandleChanged(Core::IWindow *windowHandle);
6363
void visibleChanged(bool visible);
6464

6565
void accepted();

src/plugins/coreplugin/core/quickpick_p.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <QPointer>
77

8-
#include <coreplugin/iprojectwindow.h>
8+
#include <CoreApi/iwindow.h>
99

1010
namespace Core {
1111

@@ -17,7 +17,7 @@ namespace Core {
1717
QString filterText;
1818
QString placeholderText;
1919
int currentIndex{-1};
20-
QPointer<IProjectWindow> windowHandle;
20+
QPointer<IWindow> windowHandle;
2121
bool visible{false};
2222
QPointer<QObject> commandPalette;
2323

src/plugins/coreplugin/internal/addon/findactionsaddon.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <CoreApi/plugindatabase.h>
1010

11-
#include <coreplugin/iprojectwindow.h>
11+
#include <coreplugin/iactionwindowbase.h>
1212
#include <coreplugin/internal/findactionsmodel.h>
1313
#include <coreplugin/internal/behaviorpreference.h>
1414

@@ -23,7 +23,7 @@ namespace Core::Internal {
2323
saveSettings();
2424
}
2525
void FindActionsAddOn::initialize() {
26-
auto iWin = windowHandle()->cast<IProjectWindow>();
26+
auto iWin = windowHandle()->cast<IActionWindowBase>();
2727
QQmlComponent component(PluginDatabase::qmlEngine(), "DiffScope.CorePlugin", "FindActionsAddOnActions");
2828
if (component.isError()) {
2929
qFatal() << component.errorString();
@@ -36,7 +36,7 @@ namespace Core::Internal {
3636
loadSettings();
3737
}
3838
void FindActionsAddOn::extensionsInitialized() {
39-
auto actionContext = windowHandle()->cast<IProjectWindow>()->actionContext();
39+
auto actionContext = windowHandle()->cast<IActionWindowBase>()->actionContext();
4040
m_model->setActions(actionContext->actions());
4141
connect(actionContext, &QAK::QuickActionContext::actionsChanged, this, [=, this] {
4242
m_model->setActions(actionContext->actions());
@@ -48,13 +48,13 @@ namespace Core::Internal {
4848
return IWindowAddOn::delayedInitialize();
4949
}
5050
void FindActionsAddOn::findActions() {
51-
auto iWin = windowHandle()->cast<IProjectWindow>();
51+
auto iWin = windowHandle()->cast<IActionWindowBase>();
5252
while (m_priorityActions.size() > BehaviorPreference::commandPaletteHistoryCount()) {
5353
m_priorityActions.removeLast();
5454
}
5555
m_model->setPriorityActions(m_priorityActions);
5656
m_model->refresh(iWin->actionContext());
57-
int i = windowHandle()->cast<IProjectWindow>()->execQuickPick(m_model, tr("Find actions"));
57+
int i = windowHandle()->cast<IActionWindowBase>()->execQuickPick(m_model, tr("Find actions"));
5858
if (i == -1)
5959
return;
6060
auto actionId = m_model->index(i, 0).data().toString();
@@ -68,13 +68,13 @@ namespace Core::Internal {
6868
void FindActionsAddOn::loadSettings() {
6969
auto settings = PluginDatabase::settings();
7070
settings->beginGroup(staticMetaObject.className());
71-
m_priorityActions = settings->value("priorityActions").value<QStringList>();
71+
m_priorityActions = settings->value(QStringLiteral("priorityActions_") + windowHandle()->metaObject()->className()).value<QStringList>();
7272
settings->endGroup();
7373
}
7474
void FindActionsAddOn::saveSettings() const {
7575
auto settings = PluginDatabase::settings();
7676
settings->beginGroup(staticMetaObject.className());
77-
settings->setValue("priorityActions", m_priorityActions);
77+
settings->setValue(QStringLiteral("priorityActions_") + windowHandle()->metaObject()->className(), m_priorityActions);
7878
settings->endGroup();
7979
}
8080
}

src/plugins/coreplugin/internal/coreplugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ namespace Core::Internal {
118118
IProjectWindowRegistry::instance()->attach<WorkspaceAddOn>();
119119
IProjectWindowRegistry::instance()->attach<ViewVisibilityAddOn>();
120120
IProjectWindowRegistry::instance()->attach<NotificationAddOn>();
121+
IHomeWindowRegistry::instance()->attach<FindActionsAddOn>();
121122
IProjectWindowRegistry::instance()->attach<FindActionsAddOn>();
122123
IProjectWindowRegistry::instance()->attach<TimelineAddOn>();
123124
}

0 commit comments

Comments
 (0)