Major port Qt4 to Qt6
- Updated header inclusions from QtGui to QtWidgets for consistency and compatibility with Qt 5 and later. - Replaced deprecated QApplication::desktop() with QApplication::primaryScreen() for obtaining screen DPI. - Modified MyOutputHandler to use QMessageLogContext and QString for improved logging. - Changed QMatrix to QTransform for image rotation in ImageCutout class. - Updated various debug statements to use toLocal8Bit() instead of toAscii() for better string handling. - Refactored several classes to use QElapsedTimer instead of QTime for performance measurement. - Ensured all operator overloads in Section and Tag classes are marked as const for better const-correctness.
This commit is contained in:
@@ -167,23 +167,27 @@ int download(CURL* curlhandle, const char * remotepath, const char * localpath,
|
||||
}
|
||||
|
||||
|
||||
void MyOutputHandler(QtMsgType type, const char *msg) {
|
||||
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
|
||||
Q_UNUSED(context)
|
||||
if(!g_debug)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Debug: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Debug: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Critical: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Critical: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
//g_logfile << QTime::currentTime().toString().toAscii().data() << " Warning: \t" << msg << "\n";
|
||||
//g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Warning: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
g_logfile << QTime::currentTime().toString().toAscii().data() << " Fatal: \t" << msg << "\n";
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Fatal: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
abort();
|
||||
case QtInfoMsg:
|
||||
g_logfile << QTime::currentTime().toString().toLocal8Bit().data() << " Info: \t" << msg.toLocal8Bit().data() << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
g_logfile.flush();
|
||||
|
||||
Reference in New Issue
Block a user