Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launcher Draft 1 #98

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/plugins/launcher_plugin.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#pragma once

#include <QWidget>
#include "plugins/plugin.hpp"

class LauncherPlugin : public Plugin {
Q_OBJECT

public:
LauncherPlugin() { this->settings.beginGroup("Launcher"); }
virtual ~LauncherPlugin() = default;
virtual void remove_widget(int idx) { this->loaded_widgets.removeAt(idx); }
virtual void add_widget(QWidget *widget){}

public slots:

signals:
void widget_added(QWidget *widget);

protected:
QList<QWidget *> loaded_widgets;
Expand Down
4 changes: 3 additions & 1 deletion include/plugins/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class Arbiter;

class Plugin {
class Plugin : public QObject {
Q_OBJECT

public:
Plugin() : settings(qApp->organizationName(), "plugins") {}
virtual ~Plugin() = default;
Expand Down
9 changes: 7 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,13 @@ else
exit 1
fi

echo Running Dash make
make

coreQ=$(grep 'cpu cores' /proc/cpuinfo | uniq)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id maybe not squeeze this in here... see #88 for a discussion on setting the number of cores programmatically like this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rsjudka I was hoping you'd have an opinion on that, it didn't feel right but It also didn't work when I tried to inherit lower down. Thanks for pointing me in the right direction, I'm still a little newer to qt so I appreciate the advice! Also I agree about not changing the install script here, I just did it because it speeds up my build on my dev machine but I don't think this would even work on the rpi as is. I'll try and remember to remove this, I'll let that be it's own issue

cores=${coreQ:12:1}
echo Running Dash make -j$cores
make -j$cores


if [[ $? -eq 0 ]]; then
echo -e Dash make ok, executable can be found ../bin/dash
echo
Expand Down
2 changes: 1 addition & 1 deletion plugins/brightness/mocked/mocked.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "plugins/brightness_plugin.hpp"

class Mocked : public QObject, BrightnessPlugin {
class Mocked : public BrightnessPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID BrightnessPlugin_iid FILE "mocked.json")
Q_INTERFACES(BrightnessPlugin)
Expand Down
2 changes: 1 addition & 1 deletion plugins/brightness/official_rpi/official_rpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "plugins/brightness_plugin.hpp"

class OfficialRPi : public QObject, BrightnessPlugin {
class OfficialRPi : public BrightnessPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID BrightnessPlugin_iid FILE "official_rpi.json")
Q_INTERFACES(BrightnessPlugin)
Expand Down
2 changes: 1 addition & 1 deletion plugins/brightness/x/x.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <QObject>
#include "plugins/brightness_plugin.hpp"

class X : public QObject, BrightnessPlugin {
class X : public BrightnessPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID BrightnessPlugin_iid FILE "x.json")
Q_INTERFACES(BrightnessPlugin)
Expand Down
8 changes: 7 additions & 1 deletion plugins/launcher/app/app.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <QElapsedTimer>
#include <unistd.h>
#include <typeinfo>

#include "app/config.hpp"
#include "app/arbiter.hpp"
Expand Down Expand Up @@ -134,7 +135,7 @@ Launcher::Launcher(Arbiter &arbiter, QSettings &settings, int idx, QWidget *pare
layout->addWidget(this->launcher_widget());
layout->addWidget(this->app);

if (this->auto_launch)
if (this->auto_launch)
this->app->start(launcher_app);
}

Expand Down Expand Up @@ -291,7 +292,12 @@ void App::remove_widget(int idx)

this->settings.remove(QString::number(idx));
for (int i = 0; i < this->loaded_widgets.size(); i++) {
auto typeStr(typeid(this->loaded_widgets[i]).name());
qDebug() << typeStr;

if (Launcher *launcher = qobject_cast<Launcher *>(this->loaded_widgets[i]))
launcher->update_idx(i);


}
}
2 changes: 1 addition & 1 deletion plugins/launcher/app/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Launcher : public QWidget {

};

class App : public QObject, LauncherPlugin {
class App : public LauncherPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID LauncherPlugin_iid FILE "app.json")
Q_INTERFACES(LauncherPlugin)
Expand Down
Loading