parent
ee86b9d47a
commit
2e64a01ea5
|
@ -18,10 +18,6 @@ Child_entry::Child_entry(const char *name, int quota_kb, int max_quota_kb,
|
||||||
ui.quotaBar->setValue(quota_kb);
|
ui.quotaBar->setValue(quota_kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
Child_entry::~Child_entry()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Child_entry::on_exitButton_clicked()
|
void Child_entry::on_exitButton_clicked()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,20 +24,22 @@ class Child_entry : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
|
||||||
Child_entry(const char *name, int quota_kb, int max_quota_kb,
|
|
||||||
Launchpad *launchpad, Launchpad_child *launchpad_child,
|
|
||||||
QWidget *parent = 0);
|
|
||||||
~Child_entry();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::Child_entryClass ui;
|
Ui::Child_entryClass ui;
|
||||||
|
|
||||||
Launchpad *_launchpad;
|
Launchpad *_launchpad;
|
||||||
Launchpad_child *_launchpad_child;
|
Launchpad_child *_launchpad_child;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_exitButton_clicked();
|
void on_exitButton_clicked();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Child_entry(const char *name, int quota_kb, int max_quota_kb,
|
||||||
|
Launchpad *launchpad, Launchpad_child *launchpad_child,
|
||||||
|
QWidget *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHILD_ENTRY_H
|
#endif /* CHILD_ENTRY_H */
|
||||||
|
|
|
@ -6,19 +6,13 @@
|
||||||
|
|
||||||
#include "kbyte_loadbar.h"
|
#include "kbyte_loadbar.h"
|
||||||
|
|
||||||
|
|
||||||
Kbyte_loadbar::Kbyte_loadbar(QWidget *parent)
|
Kbyte_loadbar::Kbyte_loadbar(QWidget *parent)
|
||||||
: QProgressBar(parent)
|
: QProgressBar(parent) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Kbyte_loadbar::~Kbyte_loadbar()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Kbyte_loadbar::text() const
|
QString Kbyte_loadbar::text() const
|
||||||
{
|
{
|
||||||
return QString::number(value()) + " KByte / " +
|
return QString::number(value()) + " KByte / " +
|
||||||
QString::number(maximum()) + " KByte";
|
QString::number(maximum()) + " KByte";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,10 @@ class Kbyte_loadbar : public QProgressBar
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Kbyte_loadbar(QWidget *parent = 0);
|
Kbyte_loadbar(QWidget *parent = 0);
|
||||||
~Kbyte_loadbar();
|
|
||||||
|
|
||||||
virtual QString text() const;
|
virtual QString text() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KBYTE_LOADBAR_H
|
#endif /* KBYTE_LOADBAR_H */
|
||||||
|
|
|
@ -7,9 +7,14 @@
|
||||||
#include "launch_entry.h"
|
#include "launch_entry.h"
|
||||||
|
|
||||||
Launch_entry::Launch_entry(const char *filename, unsigned long default_quota,
|
Launch_entry::Launch_entry(const char *filename, unsigned long default_quota,
|
||||||
unsigned long max_quota, Launchpad *launchpad,
|
unsigned long max_quota,
|
||||||
|
Genode::Dataspace_capability config_ds,
|
||||||
|
Launchpad *launchpad,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent), _filename(filename), _launchpad(launchpad)
|
: QWidget(parent),
|
||||||
|
_filename(filename),
|
||||||
|
_config_ds(config_ds),
|
||||||
|
_launchpad(launchpad)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -20,12 +25,10 @@ Launch_entry::Launch_entry(const char *filename, unsigned long default_quota,
|
||||||
ui.quotaDial->setValue(default_quota);
|
ui.quotaDial->setValue(default_quota);
|
||||||
}
|
}
|
||||||
|
|
||||||
Launch_entry::~Launch_entry()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Launch_entry::on_launchButton_clicked()
|
void Launch_entry::on_launchButton_clicked()
|
||||||
{
|
{
|
||||||
_launchpad->start_child(_filename, 1024 * ui.quotaDial->value(), Genode::Dataspace_capability());
|
_launchpad->start_child(_filename,
|
||||||
|
1024 * ui.quotaDial->value(),
|
||||||
|
_config_ds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,20 +24,26 @@ class Launch_entry : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
|
||||||
Launch_entry(const char *filename, unsigned long default_quota,
|
|
||||||
unsigned long max_quota, Launchpad *launchpad,
|
|
||||||
QWidget *parent = 0);
|
|
||||||
~Launch_entry();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::Launch_entryClass ui;
|
Ui::Launch_entryClass ui;
|
||||||
|
|
||||||
const char *_filename;
|
const char *_filename;
|
||||||
|
Genode::Dataspace_capability _config_ds;
|
||||||
Launchpad *_launchpad;
|
Launchpad *_launchpad;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_launchButton_clicked();
|
void on_launchButton_clicked();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Launch_entry(const char *filename,
|
||||||
|
unsigned long default_quota,
|
||||||
|
unsigned long max_quota,
|
||||||
|
Genode::Dataspace_capability config_ds,
|
||||||
|
Launchpad *launchpad,
|
||||||
|
QWidget *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAUNCH_ENTRY_H
|
#endif /* LAUNCH_ENTRY_H */
|
||||||
|
|
|
@ -25,22 +25,24 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
QApplication *a = new QApplication(argc, argv);
|
static QApplication a(argc, argv);
|
||||||
|
|
||||||
Qt_launchpad *launchpad = new Qt_launchpad(Genode::env()->ram_session()->quota());
|
static Qt_launchpad launchpad(Genode::env()->ram_session()->quota());
|
||||||
|
|
||||||
launchpad->add_launcher("calculatorform", 30*1024*1024);
|
launchpad.add_launcher("calculatorform",
|
||||||
launchpad->add_launcher("tetrix", 40*1024*1024);
|
30*1024*1024,
|
||||||
|
Genode::Dataspace_capability());
|
||||||
|
|
||||||
launchpad->move(300,100);
|
launchpad.add_launcher("tetrix",
|
||||||
launchpad->show();
|
40*1024*1024,
|
||||||
|
Genode::Dataspace_capability());
|
||||||
|
|
||||||
a->connect(a, SIGNAL(lastWindowClosed()), a, SLOT(quit()));
|
launchpad.move(300,100);
|
||||||
|
launchpad.show();
|
||||||
|
|
||||||
result = a->exec();
|
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
||||||
|
|
||||||
delete launchpad;
|
result = a.exec();
|
||||||
delete a;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,16 +47,12 @@ Qt_launchpad::Qt_launchpad(unsigned long initial_quota, QWidget *parent)
|
||||||
|
|
||||||
// update the available quota bar every 200ms
|
// update the available quota bar every 200ms
|
||||||
QTimer *avail_quota_timer = new QTimer(this);
|
QTimer *avail_quota_timer = new QTimer(this);
|
||||||
connect(avail_quota_timer, SIGNAL(timeout()), this, SLOT(avail_quota_update()));
|
connect(avail_quota_timer, SIGNAL(timeout()), this, SLOT(_avail_quota_update()));
|
||||||
avail_quota_timer->start(200);
|
avail_quota_timer->start(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt_launchpad::~Qt_launchpad()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
void Qt_launchpad::_avail_quota_update()
|
||||||
|
|
||||||
void Qt_launchpad::avail_quota_update()
|
|
||||||
{
|
{
|
||||||
static Genode::size_t _avail = 0;
|
static Genode::size_t _avail = 0;
|
||||||
|
|
||||||
|
@ -68,22 +64,29 @@ void Qt_launchpad::avail_quota_update()
|
||||||
_avail = new_avail;
|
_avail = new_avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt_launchpad::quota(unsigned long quota)
|
void Qt_launchpad::quota(unsigned long quota)
|
||||||
{
|
{
|
||||||
totalQuotaProgressBar->setMaximum(initial_quota() / 1024);
|
totalQuotaProgressBar->setMaximum(initial_quota() / 1024);
|
||||||
totalQuotaProgressBar->setValue(quota / 1024);
|
totalQuotaProgressBar->setValue(quota / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt_launchpad::add_launcher(const char *filename,
|
void Qt_launchpad::add_launcher(const char *filename,
|
||||||
unsigned long default_quota)
|
unsigned long default_quota,
|
||||||
|
Genode::Dataspace_capability config_ds)
|
||||||
{
|
{
|
||||||
Launch_entry *launch_entry = new Launch_entry(filename, default_quota / 1024,
|
Launch_entry *launch_entry = new Launch_entry(filename,
|
||||||
initial_quota() / 1024, this);
|
default_quota / 1024,
|
||||||
|
initial_quota() / 1024,
|
||||||
|
config_ds,
|
||||||
|
this);
|
||||||
launcherDockWidgetContents->layout()->addWidget(launch_entry);
|
launcherDockWidgetContents->layout()->addWidget(launch_entry);
|
||||||
launch_entry->show();
|
launch_entry->show();
|
||||||
launcherDockWidgetContents->adjustSize();
|
launcherDockWidgetContents->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt_launchpad::add_child(const char *unique_name,
|
void Qt_launchpad::add_child(const char *unique_name,
|
||||||
unsigned long quota,
|
unsigned long quota,
|
||||||
Launchpad_child *launchpad_child,
|
Launchpad_child *launchpad_child,
|
||||||
|
@ -98,6 +101,7 @@ void Qt_launchpad::add_child(const char *unique_name,
|
||||||
childrenDockWidgetContents->adjustSize();
|
childrenDockWidgetContents->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt_launchpad::remove_child(const char *name, Genode::Allocator *alloc)
|
void Qt_launchpad::remove_child(const char *name, Genode::Allocator *alloc)
|
||||||
{
|
{
|
||||||
Child_entry *child_entry =
|
Child_entry *child_entry =
|
||||||
|
|
|
@ -23,24 +23,26 @@ class Qt_launchpad : public QMainWindow, public Launchpad, private Ui::Qt_launch
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
private slots:
|
||||||
Qt_launchpad(unsigned long initial_quota, QWidget *parent = 0);
|
|
||||||
~Qt_launchpad();
|
|
||||||
|
|
||||||
virtual void quota(unsigned long quota);
|
void _avail_quota_update();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Qt_launchpad(unsigned long initial_quota, QWidget *parent = 0);
|
||||||
|
|
||||||
|
virtual void quota(unsigned long quota) override;
|
||||||
|
|
||||||
virtual void add_launcher(const char *filename,
|
virtual void add_launcher(const char *filename,
|
||||||
unsigned long default_quota);
|
unsigned long default_quota,
|
||||||
|
Genode::Dataspace_capability config_ds) override;
|
||||||
|
|
||||||
virtual void add_child(const char *unique_name,
|
virtual void add_child(const char *unique_name,
|
||||||
unsigned long quota,
|
unsigned long quota,
|
||||||
Launchpad_child *launchpad_child,
|
Launchpad_child *launchpad_child,
|
||||||
Genode::Allocator *alloc);
|
Genode::Allocator *alloc) override;
|
||||||
|
|
||||||
virtual void remove_child(const char *name, Genode::Allocator *alloc);
|
virtual void remove_child(const char *name, Genode::Allocator *alloc) override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void avail_quota_update();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_LAUNCHPAD_H
|
#endif /* QT_LAUNCHPAD_H */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user