Skip to content

Commit

Permalink
refresh devices; peakmeter; better startup; system changes
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Apr 19, 2021
1 parent e81894c commit 2590311
Show file tree
Hide file tree
Showing 29 changed files with 326 additions and 63 deletions.
1 change: 1 addition & 0 deletions archiso/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CHROOT_DIR=liveusb/airootfs
MOD_LIVE_DIR=${CHROOT_DIR}/root/.mod-live

mkdir -p cache output workdir
mkdir -p ${CHROOT_DIR}/mnt/mod-os
mkdir -p ${CHROOT_DIR}/mnt/pedalboards
mkdir -p ${CHROOT_DIR}/mnt/plugins
mkdir -p ${CHROOT_DIR}/root/rwdata/root
Expand Down
1 change: 1 addition & 0 deletions archiso/liveusb/airootfs/etc/default/cpupower
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
governor='performance'
2 changes: 2 additions & 0 deletions archiso/liveusb/airootfs/etc/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/root/.mod-live/rootfs.ext2 /mnt/mod-os ext2 loop,ro 0 0
14 changes: 14 additions & 0 deletions archiso/liveusb/airootfs/etc/systemd/system/mod-live-audio.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

[Unit]
Description=MOD Live Audio

[Service]
Type=notify
Environment=SYSTEMD_SECCOMP=0
Environment=AUDIO_USING_SYSTEMD=1
EnvironmentFile=/root/.mod-live/config/environment.sh
EnvironmentFile=/root/.mod-live/config/soundcard.sh
ExecStart=/root/.mod-live/start.sh
Restart=always
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ After=livecd-alsa-unmuter.service

[Service]
Type=simple
Environment=USING_SYSTEMD=1
ExecStart=/root/.mod-live/mod-live-usb-welcome -platform linuxfb -style Breeze --no-sandbox
Restart=always
WorkingDirectory=/root/
Expand Down
3 changes: 3 additions & 0 deletions documentation/notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a space dedicated to writing text, feel free to reuse as copy & paste area.

PS: You can use Ctrl+Alt+T keyboard combination to open a terminal in a new tab.
2 changes: 1 addition & 1 deletion live-welcome/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ endif
all: $(TARGETS)

mod-live-usb-welcome: $(OBJECTS)
$(CXX) $^ $(KF5_LIBS) $(QT5_LIBS) $(ALSA_LIBS) -ldl $(LDFLAGS) -o $@
$(CXX) $^ $(KF5_LIBS) $(QT5_LIBS) $(ALSA_LIBS) -ldl -lrt $(LDFLAGS) -o $@

welcome.cpp.o: welcome.cpp src/KioskWindow.hpp src/KioskTabs.hpp src/KioskSettingsPopup.hpp src/AudioDiscovery.hpp
$(CXX) $< -c $(KF5_CFLAGS) $(QT5_CFLAGS) $(CXXFLAGS) -o $@
Expand Down
39 changes: 24 additions & 15 deletions live-welcome/src/KioskSettingsPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QVBoxLayout>

Expand Down Expand Up @@ -112,6 +113,7 @@ class KioskSettingsPopup : public QDialog
QHBoxLayout deviceLayout;
QLabel deviceLabel;
QComboBox deviceBox;
QPushButton deviceButton;

CollapsibleBox advancedBox;
QGridLayout advancedLayout;
Expand Down Expand Up @@ -139,6 +141,7 @@ class KioskSettingsPopup : public QDialog
deviceLayout(),
deviceLabel(this),
deviceBox(this),
deviceButton(this),
advancedBox("Advanced", this),
advancedLayout(),
sampleRateLabel(this),
Expand All @@ -160,6 +163,7 @@ class KioskSettingsPopup : public QDialog
labelWelcome.setText("Welcome to MOD Live-USB");
labelStart.setText("Please select your audio device from the list below.");
deviceLabel.setText("Device:");
deviceButton.setText("(R)");
sampleRateLabel.setText("Sample Rate:");
bufferSizeLabel.setText("Buffer Size:");
okBox.setCenterButtons(true);
Expand All @@ -168,6 +172,7 @@ class KioskSettingsPopup : public QDialog

// no focus please
deviceBox.setFocusPolicy(Qt::FocusPolicy::NoFocus);
deviceButton.setFocusPolicy(Qt::FocusPolicy::NoFocus);
sampleRateBox.setFocusPolicy(Qt::FocusPolicy::NoFocus);
bufferSizeBox.setFocusPolicy(Qt::FocusPolicy::NoFocus);
okBox.setFocusPolicy(Qt::FocusPolicy::NoFocus);
Expand All @@ -176,8 +181,10 @@ class KioskSettingsPopup : public QDialog
deviceLabel.setAlignment(Qt::AlignRight);
deviceLabel.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
deviceBox.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
deviceButton.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
deviceLayout.addWidget(&deviceLabel);
deviceLayout.addWidget(&deviceBox);
deviceLayout.addWidget(&deviceButton);

// setup advanced box layout
sampleRateLabel.setAlignment(Qt::AlignRight);
Expand All @@ -198,6 +205,7 @@ class KioskSettingsPopup : public QDialog

// connections
connect(&deviceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(deviceIndexChanged()));
connect(&deviceButton, SIGNAL(clicked()), this, SLOT(reenumerateSoundcards()));
connect(&okBox, SIGNAL(accepted()), this, SLOT(setupDone()));
connect(&okBox, SIGNAL(rejected()), this, SLOT(reject()));

Expand Down Expand Up @@ -263,7 +271,22 @@ class KioskSettingsPopup : public QDialog
return true;
}

void reenumerateSoundcards(bool restore)
void setCancellable(const bool cancellable)
{
if (cancellable)
{
allowClose = true;
firstRun = false;
okBox.setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
}
else
{
okBox.setStandardButtons(QDialogButtonBox::Ok);
}
}

public Q_SLOTS:
void reenumerateSoundcards(bool restore = true)
{
validRates = false;

Expand Down Expand Up @@ -374,20 +397,6 @@ class KioskSettingsPopup : public QDialog
refillDeviceOptions(restore);
}

void setCancellable(const bool cancellable)
{
if (cancellable)
{
allowClose = true;
firstRun = false;
okBox.setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
}
else
{
okBox.setStandardButtons(QDialogButtonBox::Ok);
}
}

private:
void refillDeviceOptions(const bool restore)
{
Expand Down
39 changes: 25 additions & 14 deletions live-welcome/src/KioskTabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ static const char* const initial_html = "<html><body><style>body { background: b
#include "../resources/watermark.txt"
") no-repeat scroll calc(100vw - 506px) calc(100vh - 145px) }</style></body></html>";

static const char* const initial_notes = ""
"This is a space dedicated to writing text, feel free to reuse as copy & paste area.\n"
"\n"
"PS: You can use Ctrl+Alt+T keyboard combination to open a terminal in a new tab.\n"
"\n";

KioskTabs::KioskTabs(QWidget* const parent)
: QTabWidget(parent),
fileBrowser(nullptr),
Expand All @@ -38,22 +44,27 @@ KioskTabs::KioskTabs(QWidget* const parent)
addTab(documentation, "Documentation");
}

#if 0
if (const KService::Ptr service = KService::serviceByDesktopName("okular_part"))
{
if (KParts::ReadOnlyPart* const p = service->createInstance<KParts::ReadOnlyPart>(nullptr))
{
p->openUrl(QUrl("file:///home/falktx/Documents/LU_04-15_DigiSub.pdf"));
addTab(p->widget(), "Documentation");
}
}
#endif

if (const KService::Ptr service = KService::serviceByDesktopName("katepart"))
{
if (KParts::ReadWritePart* const p = service->createInstance<KParts::ReadWritePart>(nullptr, {}))
{
// p->openUrl(QUrl("file:///tmp/notes.txt"));
if (!documentationPath.isEmpty())
{
QDir notesDir(documentationPath);
notesDir.cdUp();

const QString notesFilename(notesDir.absoluteFilePath("notes.txt"));

QFile notesFile(notesFilename);
if (!notesFile.exists() && notesFile.open(QFile::WriteOnly))
{
notesFile.write(initial_notes);
notesFile.close();
}

p->openUrl(QUrl::fromLocalFile(notesFilename));
}

addTab(p->widget(), "Notes");
}
}
Expand All @@ -73,11 +84,11 @@ KioskTabs::KioskTabs(QWidget* const parent)
#endif
}

void KioskTabs::openKonsole()
void KioskTabs::openTerminal()
{
if (const KService::Ptr service = KService::serviceByDesktopName("konsolepart"))
if (KParts::ReadOnlyPart* const p = service->createInstance<KParts::ReadOnlyPart>(nullptr))
setCurrentIndex(addTab(p->widget(), "Konsole"));
setCurrentIndex(addTab(p->widget(), "Terminal"));
}

void KioskTabs::reloadPage()
Expand Down
2 changes: 1 addition & 1 deletion live-welcome/src/KioskTabs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class KioskTabs : public QTabWidget
public:
explicit KioskTabs(QWidget* const parent);

void openKonsole();
void openTerminal();
void reloadPage();
};
Loading

0 comments on commit 2590311

Please sign in to comment.