Compare commits
2 Commits
2d8c97b5f0
...
7fa8612313
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fa8612313 | |||
| 8dbceabb8a |
@ -27,7 +27,7 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|||||||
qt_add_executable(${TARGET_APP}
|
qt_add_executable(${TARGET_APP}
|
||||||
MANUAL_FINALIZATION
|
MANUAL_FINALIZATION
|
||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
utils/messagehandler.h
|
|
||||||
assets/icons.qrc
|
assets/icons.qrc
|
||||||
dialogs/abstractdialog.h dialogs/abstractdialog.cpp
|
dialogs/abstractdialog.h dialogs/abstractdialog.cpp
|
||||||
dialogs/newitemdialog.h dialogs/newitemdialog.cpp
|
dialogs/newitemdialog.h dialogs/newitemdialog.cpp
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
@ -1,7 +1,6 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>software-application.png</file>
|
<file>software-application.png</file>
|
||||||
<file>feature.png</file>
|
|
||||||
<file>no-picture-taking.png</file>
|
<file>no-picture-taking.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 22 KiB |
@ -33,12 +33,14 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
setWindowTitle(QCoreApplication::applicationName() + " [*]");
|
setWindowTitle(QCoreApplication::applicationName() + " [*]");
|
||||||
|
|
||||||
/// application icon
|
/// application icon
|
||||||
const QString iconString = "://feature.png";
|
const QString iconString = "://software-application.png";
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
QPixmap pixmap = QPixmap(iconString);
|
QPixmap pixmap = QPixmap(iconString);
|
||||||
QTransform transform = QTransform();
|
QTransform transform = QTransform();
|
||||||
transform.rotate(180);
|
transform.rotate(180);
|
||||||
QPixmap rotated = pixmap.transformed(transform);
|
QPixmap rotated = pixmap.transformed(transform);
|
||||||
|
QIcon appIcon = QIcon(rotated);
|
||||||
|
qWarning() << "appIcon.availableSizes():" << appIcon.availableSizes();
|
||||||
setWindowIcon(QIcon(rotated));
|
setWindowIcon(QIcon(rotated));
|
||||||
#else
|
#else
|
||||||
setWindowIcon(QIcon(iconString));
|
setWindowIcon(QIcon(iconString));
|
||||||
|
|||||||
@ -1,164 +0,0 @@
|
|||||||
#ifndef MESSAGEHANDLER_H
|
|
||||||
#define MESSAGEHANDLER_H
|
|
||||||
/**
|
|
||||||
* Color and formatting codes
|
|
||||||
* @see: http://misc.flogisoft.com/bash/tip_colors_and_formatting
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
// qSetMessagePattern("%{file}(%{line}): %{message}");
|
|
||||||
// qSetMessagePattern("%{type}(%{line}):\t%{message}");
|
|
||||||
// qSetMessagePattern("%{type}%{file}(%{line}):\t%{message}");
|
|
||||||
|
|
||||||
void consoleHandlerColoredVerbose(QtMsgType type,
|
|
||||||
const QMessageLogContext& context,
|
|
||||||
const QString& msg) {
|
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
// fprintf(stderr, "\033[1;30mDebug: (%s:%u, %s) \t%s\n\033[0m", context.file,
|
|
||||||
// context.line, context.function, localMsg.constData()); // bold
|
|
||||||
fprintf(stderr, "\033[107;30mDebug: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtInfoMsg:
|
|
||||||
fprintf(stderr, "\033[107;32mInfo: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
fprintf(stderr, "\033[43;30mWarning: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
fprintf(stderr, "\033[41;30mCritical: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
fprintf(stderr, "\033[41;30mFatal: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void consoleHandlerColoredVerboseInDarkTheme(QtMsgType type,
|
|
||||||
const QMessageLogContext& context,
|
|
||||||
const QString& msg) {
|
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
// fprintf(stderr, "\033[1;30mDebug: (%s:%u, %s) \t%s\n\033[0m", context.file,
|
|
||||||
// context.line, context.function, localMsg.constData()); // bold
|
|
||||||
fprintf(stderr, "\033[107;37mDebug: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtInfoMsg:
|
|
||||||
fprintf(stderr, "\033[107;32mInfo: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
fprintf(stderr, "\033[43;30mWarning: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
fprintf(stderr, "\033[41;30mCritical: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
fprintf(stderr, "\033[41;30mFatal: (%s:%u, %s) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
context.function, localMsg.constData());
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void consoleHandlerColored(QtMsgType type, const QMessageLogContext& context, const QString& msg) {
|
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
fprintf(stderr, "\033[1;30mDebug: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtInfoMsg:
|
|
||||||
fprintf(stderr, "\033[0;30mInfo: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
fprintf(stderr, "\033[1;33mWarning: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
fprintf(stderr, "\033[31mCritical: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
fprintf(stderr, "\033[31mFatal: (%s:%u) \t%s\n\033[0m", context.file, context.line,
|
|
||||||
localMsg.constData());
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void myMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg) {
|
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
|
|
||||||
context.function);
|
|
||||||
break;
|
|
||||||
case QtInfoMsg:
|
|
||||||
fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
|
|
||||||
context.function);
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
|
|
||||||
context.function);
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file,
|
|
||||||
context.line, context.function);
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
|
|
||||||
context.function);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
#include <android/log.h>
|
|
||||||
|
|
||||||
const char* const applicationName = "Pensieve";
|
|
||||||
void androidMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) {
|
|
||||||
QString report = msg;
|
|
||||||
if (context.file && !QString(context.file).isEmpty()) {
|
|
||||||
report += " in file ";
|
|
||||||
report += QString(context.file);
|
|
||||||
report += " line ";
|
|
||||||
report += QString::number(context.line);
|
|
||||||
}
|
|
||||||
if (context.function && !QString(context.function).isEmpty()) {
|
|
||||||
report += +" function ";
|
|
||||||
report += QString(context.function);
|
|
||||||
}
|
|
||||||
const char* const local = report.toLocal8Bit().constData();
|
|
||||||
switch (type) {
|
|
||||||
case QtDebugMsg:
|
|
||||||
__android_log_write(ANDROID_LOG_DEBUG, applicationName, local);
|
|
||||||
break;
|
|
||||||
case QtInfoMsg:
|
|
||||||
__android_log_write(ANDROID_LOG_INFO, applicationName, local);
|
|
||||||
break;
|
|
||||||
case QtWarningMsg:
|
|
||||||
__android_log_write(ANDROID_LOG_WARN, applicationName, local);
|
|
||||||
break;
|
|
||||||
case QtCriticalMsg:
|
|
||||||
__android_log_write(ANDROID_LOG_ERROR, applicationName, local);
|
|
||||||
break;
|
|
||||||
case QtFatalMsg:
|
|
||||||
default:
|
|
||||||
__android_log_write(ANDROID_LOG_FATAL, applicationName, local);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MESSAGEHANDLER_H
|
|
||||||
Reference in New Issue
Block a user