Skip to content

Commit

Permalink
Renamed logger widget
Browse files Browse the repository at this point in the history
  • Loading branch information
redtide committed Feb 17, 2020
1 parent c767331 commit e3da357
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 72 deletions.
60 changes: 30 additions & 30 deletions JACKSettings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += src/main.cpp \
src/device.cpp \
src/driver.cpp \
src/sysinfo.cpp \
src/servicecontrol.cpp \
src/settings.cpp \
src/ui/debuglogger.cpp \
src/ui/mainwindow.cpp \
src/userinfo.cpp
src/device.cpp \
src/driver.cpp \
src/sysinfo.cpp \
src/servicecontrol.cpp \
src/settings.cpp \
src/ui/servicelogger.cpp \
src/ui/mainwindow.cpp \
src/userinfo.cpp
HEADERS += src/ui/mainwindow.h \
src/device.h \
src/driver.h \
src/sysinfo.h \
src/servicecontrol.h \
src/settings.h \
src/ui/debuglogger.h \
src/userinfo.h
src/device.h \
src/driver.h \
src/sysinfo.h \
src/servicecontrol.h \
src/settings.h \
src/ui/servicelogger.h \
src/userinfo.h
FORMS += src/ui/mainwindow.ui

INCLUDEPATH += $$_PRO_FILE_PWD_/external/CLI11/include
Expand All @@ -50,30 +50,30 @@ TRANSLATIONS += resources/translations/jacksettings_it.ts

# Default rules for deployment.
qnx {
target.path = /tmp/$${TARGET}/bin
target.path = /tmp/$${TARGET}/bin
}
unix:!android {
desktop.files = resources/linux/$${TARGET}.desktop
desktop.path = /usr/share/applications/
desktop.files = resources/linux/$${TARGET}.desktop
desktop.path = /usr/share/applications/

icon.files = resources/icons/icon.png
icon.path = /usr/share/$${TARGET}/icons/
icon.files = resources/icons/icon.png
icon.path = /usr/share/$${TARGET}/icons/

translations.files = resources/translations/*.qm
translations.path = /usr/share/$${TARGET}/translations/
translations.files = resources/translations/*.qm
translations.path = /usr/share/$${TARGET}/translations/

target.files = $${TARGET}
target.path = /usr/bin
target.files = $${TARGET}
target.path = /usr/bin

INSTALLS += desktop icon translations target
INSTALLS += desktop icon translations target
}
win32 {
RC_FILE = resources/icons/icon.rc
RC_FILE = resources/icons/icon.rc
}
mac {
CONFIG += app_bundle
ICON = resources/icons/icon.icns
CONFIG += app_bundle
ICON = resources/icons/icon.icns
}
DISTFILES += .editorconfig \
README.md \
TODO.md
README.md \
TODO.md
Binary file modified resources/translations/jacksettings_it.qm
Binary file not shown.
44 changes: 22 additions & 22 deletions resources/translations/jacksettings_it.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="it_IT">
<context>
<name>DebugLogger</name>
<message>
<location filename="../../src/ui/debuglogger.cpp" line="25"/>
<source>Clear</source>
<translation>Pulisci</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
Expand Down Expand Up @@ -472,63 +464,71 @@
<translation>&amp;Esci</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="296"/>
<location filename="../../src/ui/mainwindow.cpp" line="304"/>
<source>JACK Settings</source>
<translation>Impostazioni JACK</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="418"/>
<location filename="../../src/ui/mainwindow.cpp" line="450"/>
<location filename="../../src/ui/mainwindow.cpp" line="426"/>
<location filename="../../src/ui/mainwindow.cpp" line="458"/>
<source>Started</source>
<translation>Avviato</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="421"/>
<location filename="../../src/ui/mainwindow.cpp" line="453"/>
<location filename="../../src/ui/mainwindow.cpp" line="429"/>
<location filename="../../src/ui/mainwindow.cpp" line="461"/>
<source>Stop</source>
<translation>Ferma</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="424"/>
<location filename="../../src/ui/mainwindow.cpp" line="432"/>
<source>Stop JACK Server</source>
<translation>Ferma Server JACK</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="432"/>
<location filename="../../src/ui/mainwindow.cpp" line="460"/>
<location filename="../../src/ui/mainwindow.cpp" line="440"/>
<location filename="../../src/ui/mainwindow.cpp" line="468"/>
<source>Stopped</source>
<translation>Fermato</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="435"/>
<location filename="../../src/ui/mainwindow.cpp" line="463"/>
<location filename="../../src/ui/mainwindow.cpp" line="443"/>
<location filename="../../src/ui/mainwindow.cpp" line="471"/>
<source>Start</source>
<translation>Avvia</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="438"/>
<location filename="../../src/ui/mainwindow.cpp" line="446"/>
<source>Start JACK Server</source>
<translation>Avvia Server JACK</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="456"/>
<location filename="../../src/ui/mainwindow.cpp" line="464"/>
<source>Stop ALSA Bridge</source>
<translation>Ferma ALSA Bridge</translation>
</message>
<message>
<location filename="../../src/ui/mainwindow.cpp" line="466"/>
<location filename="../../src/ui/mainwindow.cpp" line="474"/>
<source>Start ALSA Bridge</source>
<translation>Avvia ALSA Bridge</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../../src/main.cpp" line="39"/>
<location filename="../../src/main.cpp" line="37"/>
<source>I couldn&apos;t detect any system tray on this system.</source>
<translation>Non riesco a rilevare alcuna system tray in questo sistema.</translation>
</message>
</context>
<context>
<name>ServiceLogger</name>
<message>
<location filename="../../src/ui/servicelogger.cpp" line="24"/>
<source>Clear</source>
<translation>Pulisci</translation>
</message>
</context>
<context>
<name>SysInfo</name>
<message>
Expand Down
10 changes: 6 additions & 4 deletions src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
For a full copy of the GNU General Public License see the LICENSE file
*/
#include "mainwindow.h"
#include "debuglogger.h"
#include "servicelogger.h"
#include "ui_mainwindow.h"
#include "src/servicecontrol.h"
#include "src/userinfo.h"
Expand Down Expand Up @@ -222,8 +222,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),

updateJackStatus();
}
jackService = new ServiceControl("jack@" + settings->profileName() + ".service", this);
a2jService = new ServiceControl("a2jmidi@" + settings->profileName() + ".service", this);
QString jackSvcName = "jack@" + settings->profileName() + ".service";
QString a2jSvcName = "a2jmidi@" + settings->profileName() + ".service";
jackService = new ServiceControl(jackSvcName, this);
a2jService = new ServiceControl(a2jSvcName, this);
enumerateProfiles();
updateJackSettingsUI();
updateDriverSettingsUI();
Expand Down Expand Up @@ -292,7 +294,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
connect(ui->sbxLatencyIn, QOverload<int>::of(&QSpinBox::valueChanged), this, &MainWindow::onSettingsChanged);
connect(ui->sbxLatencyOut, QOverload<int>::of(&QSpinBox::valueChanged), this, &MainWindow::onSettingsChanged);

txtLog = new DebugLogger(this, settings->profileName());
txtLog = new ServiceLogger(jackSvcName, this);
txtLog->setReadOnly(true);
txtLog->setParent(ui->tabLog);
txtLog->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class ServiceControl;
class DebugLogger;
class ServiceLogger;
class QRadioButton;
class QSystemTrayIcon;
class MainWindow : public QMainWindow
Expand Down Expand Up @@ -83,7 +83,7 @@ class MainWindow : public QMainWindow
QAction *actQuit;
QMenu *mnuTray;
QSystemTrayIcon *icoTray;
DebugLogger *txtLog;
ServiceLogger *txtLog;

std::array<QRadioButton *, 2> grpClockSource;
std::array<QRadioButton *, 5> grpAutoConnect;
Expand Down
22 changes: 11 additions & 11 deletions src/ui/debuglogger.cpp → src/ui/servicelogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
For a full copy of the GNU General Public License see the LICENSE file
*/
#include "debuglogger.h"
#include "servicelogger.h"

#include <QContextMenuEvent>
#include <QCoreApplication>
#include <QMenu>

DebugLogger::DebugLogger(QWidget *parent, QString settingsProfileName)
ServiceLogger::ServiceLogger(QString unitName, QWidget *parent)
: QPlainTextEdit(parent),
actClear(new QAction(QIcon::fromTheme("edit-clear"), tr("Clear"), this)),
journalProcess(new QProcess(this))
{
QString cmd = QString("journalctl -f -S today --user-unit jack@%1").arg(settingsProfileName);
QString cmd = QString("journalctl -f -S today --user-unit %1").arg(unitName);
journalProcess->start(cmd);

setLineWrapMode(QPlainTextEdit::NoWrap);

connect(actClear, &QAction::triggered, this, &DebugLogger::onClearTriggered);
connect(journalProcess, &QProcess::readyRead, this, &DebugLogger::onReadyRead);
connect(actClear, &QAction::triggered, this, &ServiceLogger::onClearTriggered);
connect(journalProcess, &QProcess::readyRead, this, &ServiceLogger::onReadyRead);
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
this, &DebugLogger::onAboutToQuit);
this, &ServiceLogger::onAboutToQuit);
}
DebugLogger::~DebugLogger()
ServiceLogger::~ServiceLogger()
{
}
void DebugLogger::contextMenuEvent(QContextMenuEvent *event)
void ServiceLogger::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = createStandardContextMenu();

Expand All @@ -49,15 +49,15 @@ void DebugLogger::contextMenuEvent(QContextMenuEvent *event)
menu->exec(event->globalPos());
delete menu;
}
void DebugLogger::onAboutToQuit()
void ServiceLogger::onAboutToQuit()
{
delete journalProcess;
}
void DebugLogger::onClearTriggered()
void ServiceLogger::onClearTriggered()
{
clear();
}
void DebugLogger::onReadyRead()
void ServiceLogger::onReadyRead()
{
while (journalProcess->canReadLine())
{
Expand Down
6 changes: 3 additions & 3 deletions src/ui/debuglogger.h → src/ui/servicelogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
#include <QPlainTextEdit>
#include <QProcess>

class DebugLogger : public QPlainTextEdit
class ServiceLogger : public QPlainTextEdit
{
Q_OBJECT

public:
DebugLogger(QWidget *parent = nullptr, QString settingsProfileName = "default");
~DebugLogger();
ServiceLogger(QString unitName, QWidget *parent = nullptr);
~ServiceLogger();

private:
void contextMenuEvent(QContextMenuEvent *);
Expand Down

0 comments on commit e3da357

Please sign in to comment.