Skip to content

Commit

Permalink
Merge branch 'main' of github.com:zhulik/deckfm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhulik committed Jun 21, 2023
2 parents 809dad6 + 7f1e933 commit bad9d55
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 16 deletions.
5 changes: 4 additions & 1 deletion deckfm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

set -eu

QSG_INFO=1 QSG_RENDER_LOOP=basic QT_QPA_PLATFORM=wayland LD_LIBRARY_PATH=$(pwd) ./build/deckfm
#export QT_SCALE_FACTOR=3

export LD_LIBRARY_PATH=$(pwd)
./build/deckfm
6 changes: 0 additions & 6 deletions resources/qml/DebugOverlay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ Item {
opacity: 0.6
}

MouseArea {
anchors.fill: parent

onClicked: steam_input.actionSetLayer = "file_manager"
}

Steamworks.SteamInputScope {
id: input
onInputEvent: {
Expand Down
4 changes: 4 additions & 0 deletions resources/qml/Header.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ ToolBar {
onClicked: root.menuClicked()
}

BusyIndicator {
running: true
}

MDI.Button {
text: "DECKFM"
font.pointSize: 24
Expand Down
10 changes: 9 additions & 1 deletion resources/qml/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ApplicationWindow {
}

width: 1280
height: 800
height: 720

SteamUtils {
id: steamUtils
Expand Down Expand Up @@ -67,6 +67,7 @@ ApplicationWindow {

Shortcut {
sequence: "F2"

context: Qt.ApplicationShortcut

onActivated: drawer.visible = !drawer.visible
Expand All @@ -79,6 +80,13 @@ ApplicationWindow {
onActivated: debugOverlay.toggle()
}

Shortcut {
sequence: "F4"
context: Qt.ApplicationShortcut

onActivated: Qt.quit()
}

Steamworks.SteamInputScope {
pressHandlers: {
"debug": debugOverlay.toggle,
Expand Down
2 changes: 2 additions & 0 deletions src/QSteamworks/action.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "action.h"
#include "qglobal.h"

using namespace QSteamworks;

Action::Action(unsigned long long handle, ActionDefinition *definition, const QString &localizedName,
const QStringList &origins, const QStringList &glyphs)
: m_handle(handle), m_definition(definition), m_localizedName(localizedName), m_origins(origins), m_glyphs(glyphs) {
Q_ASSERT(m_definition != 0);
}

const ActionDefinition *Action::actionDefinition() const { return m_definition; }
Expand Down
2 changes: 1 addition & 1 deletion src/QSteamworks/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace QSteamworks {
class Action {
Q_GADGET
Q_PROPERTY(unsigned long long handle READ handle CONSTANT)
Q_PROPERTY(QSteamworks::ActionDefinition actionDefinition READ actionDefinition CONSTANT)
Q_PROPERTY(const QSteamworks::ActionDefinition *actionDefinition READ actionDefinition CONSTANT)
Q_PROPERTY(QString localizedName READ localizedName CONSTANT)
Q_PROPERTY(QStringList glyphs READ glyphs CONSTANT)
Q_PROPERTY(QStringList origins READ origins CONSTANT)
Expand Down
2 changes: 2 additions & 0 deletions src/QSteamworks/actionset.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "actionset.h"
#include "actionsetlayer.h"

#include <QDebug>

using namespace QSteamworks;

ActionSet::ActionSet(InputActionSetHandle_t handle, const QString &name, const QList<Action> &actions,
Expand Down
2 changes: 2 additions & 0 deletions src/QSteamworks/qsteamapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ QSteamAPI::QSteamAPI(QObject *parent) : QObject{parent} {
QSteamAPI::~QSteamAPI() { SteamAPI_Shutdown(); }

void QSteamAPI::runCallbacks() const { SteamAPI_RunCallbacks(); }

bool QSteamAPI::RestartAppIfNecessary() const { return SteamAPI_RestartAppIfNecessary(480); }
1 change: 1 addition & 0 deletions src/QSteamworks/qsteamapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ class QSteamAPI : public QObject {

Q_INVOKABLE
void runCallbacks() const;
bool RestartAppIfNecessary() const;
};
} // namespace QSteamworks
16 changes: 10 additions & 6 deletions src/QSteamworks/qsteaminput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ void QSteamInput::onConfigurationLoaded(SteamInputConfigurationLoaded_t *) {
updateActionSets();
setActionSet(m_defaultActionSet);
setActionSetLayer(m_defaultActionSetLayer);
auto cb = [](SteamInputActionEvent_t *event) {
QSteamInput::instance()->onActionEvent(event); // Dirty hack, but I didn't find a better way
};

SteamInput()->EnableActionEventCallbacks(cb);

emit configurationLoaded();
}

Expand Down Expand Up @@ -423,13 +429,9 @@ void QSteamInput::setIgaPath(const QString &newIgaPath) {
m_iga = new IGA(VDFParser().parse(vdfContent));
emit igaChanged();

SteamInput()->EnableDeviceCallbacks();
qDebug() << m_iga->actionSets().first()->layers().count();

auto cb = [](SteamInputActionEvent_t *event) {
QSteamInput::instance()->onActionEvent(event); // Dirty hack, but I didn't find a better way
};

SteamInput()->EnableActionEventCallbacks(cb);
SteamInput()->EnableDeviceCallbacks();
}

const QString &QSteamInput::defaultActionSet() const { return m_defaultActionSet; }
Expand Down Expand Up @@ -457,6 +459,8 @@ void QSteamInput::setActionSetLayer(const QString &newActionSetLayer) {
}

SteamInput()->DeactivateAllActionSetLayers(m_currentController.handle());
m_currentActionSetLayer = ActionSetLayer();
emit actionSetLayerChanged();

foreach (auto &layer, m_actionSet.layers()) {
if (layer.name() == newActionSetLayer) {
Expand Down
3 changes: 2 additions & 1 deletion src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ Application::Application(int &argc, char **argv) : QGuiApplication{argc, argv} {
QObject::connect(mainWindow, &QQuickWindow::frameSwapped, runCallbacks);
}

qDebug() << arguments().at(1);
if (arguments().count() > 1) {
mainWindow->setProperty("openFile", arguments()[1]);
mainWindow->setProperty("openFile", arguments().at(1));
}
});

Expand Down

0 comments on commit bad9d55

Please sign in to comment.