mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -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
|
||||
add_subdirectory(sdrbase)
|
||||
add_subdirectory(sdrgui)
|
||||
add_subdirectory(httpserver)
|
||||
add_subdirectory(logging)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/sdrbase
|
||||
${CMAKE_SOURCE_DIR}/sdrgui
|
||||
${CMAKE_SOURCE_DIR}/logging
|
||||
${OPENGL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
@ -211,6 +214,7 @@ add_executable(sdrangel
|
||||
target_link_libraries(sdrangel
|
||||
sdrbase
|
||||
sdrgui
|
||||
logging
|
||||
${QT_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
@ -242,8 +246,6 @@ if (BUILD_DEBIAN)
|
||||
add_subdirectory(libiio)
|
||||
endif (BUILD_DEBIAN)
|
||||
|
||||
add_subdirectory(httpserver)
|
||||
add_subdirectory(logging)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(plugins)
|
||||
|
||||
|
@ -12,6 +12,7 @@ TEMPLATE = app
|
||||
TARGET = sdrangel
|
||||
INCLUDEPATH += $$PWD/../sdrbase
|
||||
INCLUDEPATH += $$PWD/../sdrgui
|
||||
INCLUDEPATH += $$PWD/../logging
|
||||
|
||||
CONFIG(Release):build_subdir = release
|
||||
CONFIG(Debug):build_subdir = debug
|
||||
@ -19,6 +20,7 @@ CONFIG(Debug):build_subdir = debug
|
||||
SOURCES += main.cpp
|
||||
LIBS += -L../sdrgui/$${build_subdir} -lsdrgui
|
||||
LIBS += -L../sdrbase/$${build_subdir} -lsdrbase
|
||||
LIBS += -L../logging/$${build_subdir} -llogging
|
||||
|
||||
CONFIG(ANDROID):CONFIG += mobility
|
||||
CONFIG(ANDROID):MOBILITY =
|
||||
|
11
app/main.cpp
11
app/main.cpp
@ -20,9 +20,11 @@
|
||||
#include <QProxyStyle>
|
||||
#include <QStyleFactory>
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include "logger.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);
|
||||
/*
|
||||
@ -87,7 +89,8 @@ static int runQtApplication(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
#endif
|
||||
MainWindow w;
|
||||
|
||||
MainWindow w(logger);
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
@ -95,7 +98,9 @@ static int runQtApplication(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.");
|
||||
return res;
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <regex>
|
||||
#include <iio.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "deviceplutosdrbox.h"
|
||||
#include "deviceplutosdrscan.h"
|
||||
|
||||
@ -33,7 +35,7 @@ void DevicePlutoSDRScan::scan()
|
||||
|
||||
if (!scan_ctx)
|
||||
{
|
||||
std::cerr << "PlutoSDRScan::scan: could not create scan context" << std::endl;
|
||||
qCritical("PlutoSDRScan::scan: could not create scan context");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -41,7 +43,7 @@ void DevicePlutoSDRScan::scan()
|
||||
|
||||
if (num_contexts < 0)
|
||||
{
|
||||
std::cerr << "PlutoSDRScan::scan: could not get contexts" << std::endl;
|
||||
qCritical("PlutoSDRScan::scan: could not get contexts");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,7 +58,7 @@ void DevicePlutoSDRScan::scan()
|
||||
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");
|
||||
|
||||
if (pch)
|
||||
|
@ -43,20 +43,20 @@ QString LogMessage::toString(const QString& msgFormat, const QString& timestampF
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
decorated.replace("{type}","DEBUG ");
|
||||
decorated.replace("{type}","(D)");
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
decorated.replace("{type}","WARNING ");
|
||||
decorated.replace("{type}","(W)");
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
decorated.replace("{type}","CRITICAL");
|
||||
decorated.replace("{type}","(C)");
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
decorated.replace("{type}","FATAL ");
|
||||
decorated.replace("{type}","(F)");
|
||||
break;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||
case QtInfoMsg:
|
||||
decorated.replace("{type}","INFO ");
|
||||
decorated.replace("{type}","(I)");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -9,6 +9,8 @@ TEMPLATE = subdirs
|
||||
SUBDIRS = serialdv
|
||||
SUBDIRS += sdrbase
|
||||
SUBDIRS += sdrgui
|
||||
SUBDIRS += httpserver
|
||||
SUBDIRS += logging
|
||||
CONFIG(MINGW64)SUBDIRS += nanomsg
|
||||
SUBDIRS += fcdhid
|
||||
SUBDIRS += fcdlib
|
||||
@ -22,8 +24,6 @@ SUBDIRS += libiio
|
||||
SUBDIRS += devices
|
||||
SUBDIRS += mbelib
|
||||
SUBDIRS += dsdcc
|
||||
SUBDIRS += httpserver
|
||||
SUBDIRS += logging
|
||||
CONFIG(MINGW64)SUBDIRS += cm256cc
|
||||
SUBDIRS += plugins/samplesource/filesource
|
||||
CONFIG(MINGW64)SUBDIRS += plugins/samplesource/sdrdaemonsource
|
||||
|
@ -194,7 +194,7 @@ void DeviceSourceAPI::loadSourceSettings(const Preset* preset)
|
||||
}
|
||||
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(QWidget* parent) :
|
||||
MainWindow::MainWindow(qtwebapp::Logger *logger, QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_settings(),
|
||||
@ -70,11 +70,9 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
m_inputGUI(0),
|
||||
m_sampleRate(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";
|
||||
|
||||
m_instance = this;
|
||||
|
@ -62,7 +62,7 @@ class SDRANGEL_API MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent = 0);
|
||||
explicit MainWindow(qtwebapp::Logger *logger, QWidget* parent = 0);
|
||||
~MainWindow();
|
||||
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