mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Moved logger to QtApplication level. Corrections to some messages
This commit is contained in:
parent
5f22045abb
commit
d110a3749d
@ -188,11 +188,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmax-errors=10 -ffast-mat
|
|||||||
# base libraries
|
# base libraries
|
||||||
add_subdirectory(sdrbase)
|
add_subdirectory(sdrbase)
|
||||||
add_subdirectory(sdrgui)
|
add_subdirectory(sdrgui)
|
||||||
|
add_subdirectory(httpserver)
|
||||||
|
add_subdirectory(logging)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/sdrbase
|
${CMAKE_SOURCE_DIR}/sdrbase
|
||||||
${CMAKE_SOURCE_DIR}/sdrgui
|
${CMAKE_SOURCE_DIR}/sdrgui
|
||||||
|
${CMAKE_SOURCE_DIR}/logging
|
||||||
${OPENGL_INCLUDE_DIR}
|
${OPENGL_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -211,6 +214,7 @@ add_executable(sdrangel
|
|||||||
target_link_libraries(sdrangel
|
target_link_libraries(sdrangel
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
|
logging
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
@ -242,8 +246,6 @@ if (BUILD_DEBIAN)
|
|||||||
add_subdirectory(libiio)
|
add_subdirectory(libiio)
|
||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
|
|
||||||
add_subdirectory(httpserver)
|
|
||||||
add_subdirectory(logging)
|
|
||||||
add_subdirectory(devices)
|
add_subdirectory(devices)
|
||||||
add_subdirectory(plugins)
|
add_subdirectory(plugins)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ TEMPLATE = app
|
|||||||
TARGET = sdrangel
|
TARGET = sdrangel
|
||||||
INCLUDEPATH += $$PWD/../sdrbase
|
INCLUDEPATH += $$PWD/../sdrbase
|
||||||
INCLUDEPATH += $$PWD/../sdrgui
|
INCLUDEPATH += $$PWD/../sdrgui
|
||||||
|
INCLUDEPATH += $$PWD/../logging
|
||||||
|
|
||||||
CONFIG(Release):build_subdir = release
|
CONFIG(Release):build_subdir = release
|
||||||
CONFIG(Debug):build_subdir = debug
|
CONFIG(Debug):build_subdir = debug
|
||||||
@ -19,6 +20,7 @@ CONFIG(Debug):build_subdir = debug
|
|||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
LIBS += -L../sdrgui/$${build_subdir} -lsdrgui
|
LIBS += -L../sdrgui/$${build_subdir} -lsdrgui
|
||||||
LIBS += -L../sdrbase/$${build_subdir} -lsdrbase
|
LIBS += -L../sdrbase/$${build_subdir} -lsdrbase
|
||||||
|
LIBS += -L../logging/$${build_subdir} -llogging
|
||||||
|
|
||||||
CONFIG(ANDROID):CONFIG += mobility
|
CONFIG(ANDROID):CONFIG += mobility
|
||||||
CONFIG(ANDROID):MOBILITY =
|
CONFIG(ANDROID):MOBILITY =
|
||||||
|
11
app/main.cpp
11
app/main.cpp
@ -20,9 +20,11 @@
|
|||||||
#include <QProxyStyle>
|
#include <QProxyStyle>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
|
||||||
|
#include "logger.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
static int runQtApplication(int argc, char* argv[])
|
static int runQtApplication(int argc, char* argv[], qtwebapp::Logger *logger)
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
/*
|
/*
|
||||||
@ -87,7 +89,8 @@ static int runQtApplication(int argc, char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
MainWindow w;
|
|
||||||
|
MainWindow w(logger);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
@ -95,7 +98,9 @@ static int runQtApplication(int argc, char* argv[])
|
|||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int res = runQtApplication(argc, argv);
|
qtwebapp::Logger *logger = new qtwebapp::Logger(qApp);
|
||||||
|
logger->installMsgHandler();
|
||||||
|
int res = runQtApplication(argc, argv, logger);
|
||||||
qWarning("SDRangel quit.");
|
qWarning("SDRangel quit.");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <iio.h>
|
#include <iio.h>
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "deviceplutosdrbox.h"
|
#include "deviceplutosdrbox.h"
|
||||||
#include "deviceplutosdrscan.h"
|
#include "deviceplutosdrscan.h"
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ void DevicePlutoSDRScan::scan()
|
|||||||
|
|
||||||
if (!scan_ctx)
|
if (!scan_ctx)
|
||||||
{
|
{
|
||||||
std::cerr << "PlutoSDRScan::scan: could not create scan context" << std::endl;
|
qCritical("PlutoSDRScan::scan: could not create scan context");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ void DevicePlutoSDRScan::scan()
|
|||||||
|
|
||||||
if (num_contexts < 0)
|
if (num_contexts < 0)
|
||||||
{
|
{
|
||||||
std::cerr << "PlutoSDRScan::scan: could not get contexts" << std::endl;
|
qCritical("PlutoSDRScan::scan: could not get contexts");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ void DevicePlutoSDRScan::scan()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("PlutoSDRScan::scan: %d: %s [%s]\n", i, description, uri);
|
qDebug("PlutoSDRScan::scan: %d: %s [%s]", i, description, uri);
|
||||||
char *pch = strstr(const_cast<char*>(description), "PlutoSDR");
|
char *pch = strstr(const_cast<char*>(description), "PlutoSDR");
|
||||||
|
|
||||||
if (pch)
|
if (pch)
|
||||||
|
@ -43,20 +43,20 @@ QString LogMessage::toString(const QString& msgFormat, const QString& timestampF
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
decorated.replace("{type}","DEBUG ");
|
decorated.replace("{type}","(D)");
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
decorated.replace("{type}","WARNING ");
|
decorated.replace("{type}","(W)");
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
decorated.replace("{type}","CRITICAL");
|
decorated.replace("{type}","(C)");
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
decorated.replace("{type}","FATAL ");
|
decorated.replace("{type}","(F)");
|
||||||
break;
|
break;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
decorated.replace("{type}","INFO ");
|
decorated.replace("{type}","(I)");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -9,6 +9,8 @@ TEMPLATE = subdirs
|
|||||||
SUBDIRS = serialdv
|
SUBDIRS = serialdv
|
||||||
SUBDIRS += sdrbase
|
SUBDIRS += sdrbase
|
||||||
SUBDIRS += sdrgui
|
SUBDIRS += sdrgui
|
||||||
|
SUBDIRS += httpserver
|
||||||
|
SUBDIRS += logging
|
||||||
CONFIG(MINGW64)SUBDIRS += nanomsg
|
CONFIG(MINGW64)SUBDIRS += nanomsg
|
||||||
SUBDIRS += fcdhid
|
SUBDIRS += fcdhid
|
||||||
SUBDIRS += fcdlib
|
SUBDIRS += fcdlib
|
||||||
@ -22,8 +24,6 @@ SUBDIRS += libiio
|
|||||||
SUBDIRS += devices
|
SUBDIRS += devices
|
||||||
SUBDIRS += mbelib
|
SUBDIRS += mbelib
|
||||||
SUBDIRS += dsdcc
|
SUBDIRS += dsdcc
|
||||||
SUBDIRS += httpserver
|
|
||||||
SUBDIRS += logging
|
|
||||||
CONFIG(MINGW64)SUBDIRS += cm256cc
|
CONFIG(MINGW64)SUBDIRS += cm256cc
|
||||||
SUBDIRS += plugins/samplesource/filesource
|
SUBDIRS += plugins/samplesource/filesource
|
||||||
CONFIG(MINGW64)SUBDIRS += plugins/samplesource/sdrdaemonsource
|
CONFIG(MINGW64)SUBDIRS += plugins/samplesource/sdrdaemonsource
|
||||||
|
@ -194,7 +194,7 @@ void DeviceSourceAPI::loadSourceSettings(const Preset* preset)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("DeviceSourceAPI::loadSourceSettings: Loading preset [%s | %s] is not a source preset\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
qDebug("DeviceSourceAPI::loadSourceSettings: Loading preset [%s | %s] is not a source preset", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
MainWindow *MainWindow::m_instance = 0;
|
MainWindow *MainWindow::m_instance = 0;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) :
|
MainWindow::MainWindow(qtwebapp::Logger *logger, QWidget* parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
@ -70,11 +70,9 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
m_inputGUI(0),
|
m_inputGUI(0),
|
||||||
m_sampleRate(0),
|
m_sampleRate(0),
|
||||||
m_centerFrequency(0),
|
m_centerFrequency(0),
|
||||||
m_sampleFileName(std::string("./test.sdriq"))
|
m_sampleFileName(std::string("./test.sdriq")),
|
||||||
|
m_logger(logger)
|
||||||
{
|
{
|
||||||
m_logger = new qtwebapp::Logger(this);
|
|
||||||
m_logger->installMsgHandler();
|
|
||||||
|
|
||||||
qDebug() << "MainWindow::MainWindow: start";
|
qDebug() << "MainWindow::MainWindow: start";
|
||||||
|
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
@ -62,7 +62,7 @@ class SDRANGEL_API MainWindow : public QMainWindow {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget* parent = 0);
|
explicit MainWindow(qtwebapp::Logger *logger, QWidget* parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
|
static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user