Qt6 (#669)
* update qt6 upgrade progress * add flawed addition for QRenderTarget and link needed libs * update to better logging format * move many assets and qml files into qrc * get rid of deprecation messages * remove additional deprecation notices * make Qt6 finally render on desktop with some progress on vr * initialize QRhi with QQuickRenderControl * use default values to stop SegFaults * fix compilation on windows * add windows files for aiding in running exe * fix formatting of testing qt.conf * first attempt on using textures instead of files in AudioTabController * Fix public/private access issue --------- Co-authored-by: RTUnreal <unreal@rtinf.net>
This commit is contained in:
+39
-99
@@ -1,10 +1,15 @@
|
||||
#include "setup.h"
|
||||
#include <QtLogging>
|
||||
#include <QtDebug>
|
||||
#ifdef ENABLE_DEBUG_LOGGING
|
||||
constexpr auto debugLoggingEnabled = true;
|
||||
#else
|
||||
constexpr auto debugLoggingEnabled = false;
|
||||
#endif
|
||||
|
||||
QtMessageHandler originalMessageHandler = nullptr;
|
||||
static FILE* f;
|
||||
|
||||
// The default Qt message handler prints to stdout on X11 and to the debugger on
|
||||
// Windows. That is borderline useless for us, therefore we create our own
|
||||
// message handler.
|
||||
@@ -12,29 +17,11 @@ void mainQtMessageHandler( QtMsgType type,
|
||||
const QMessageLogContext& context,
|
||||
const QString& msg )
|
||||
{
|
||||
// context contains null pointers on release builds. Cast to get rid of
|
||||
// unreferenced formal parameter warnings.
|
||||
static_cast<void>( context );
|
||||
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
switch ( type )
|
||||
{
|
||||
case QtDebugMsg:
|
||||
LOG( DEBUG ) << "QTMSGH: " << localMsg.constData();
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
LOG( INFO ) << "QTMSGH: " << localMsg.constData();
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
LOG( WARNING ) << "QTMSGH: " << localMsg.constData();
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
LOG( ERROR ) << "QTMSGH: " << localMsg.constData();
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
LOG( FATAL ) << "QTMSGH: " << localMsg.constData();
|
||||
break;
|
||||
}
|
||||
QString message = qFormatLogMessage( type, context, msg );
|
||||
fprintf( f, "%s\n", qPrintable( message ) );
|
||||
fflush( f );
|
||||
if ( originalMessageHandler )
|
||||
( *originalMessageHandler )( type, context, msg );
|
||||
}
|
||||
|
||||
namespace argument
|
||||
@@ -74,25 +61,28 @@ CommandLineOptions returnCommandLineParser( const MyQApplication& application )
|
||||
parser.process( application );
|
||||
|
||||
const bool desktopModeEnabled = parser.isSet( desktopMode );
|
||||
LOG_IF( desktopModeEnabled, INFO ) << "Desktop mode enabled.";
|
||||
if ( desktopModeEnabled )
|
||||
qInfo() << "Desktop mode enabled.";
|
||||
|
||||
const bool forceNoSoundEnabled = parser.isSet( forceNoSound );
|
||||
LOG_IF( forceNoSoundEnabled, INFO ) << "Sound effects disabled.";
|
||||
if ( forceNoSoundEnabled )
|
||||
qInfo() << "Sound effects disabled.";
|
||||
|
||||
const bool forceNoManifestEnabled = parser.isSet( forceNoManifest );
|
||||
LOG_IF( forceNoManifestEnabled, INFO )
|
||||
<< "Running without applications manifest.";
|
||||
if ( forceNoManifestEnabled )
|
||||
qInfo() << "Running without applications manifest.";
|
||||
|
||||
const bool forceInstallManifestEnabled
|
||||
= parser.isSet( forceInstallManifest );
|
||||
LOG_IF( forceInstallManifestEnabled, INFO )
|
||||
<< "Forcing install of applications manifest.";
|
||||
if ( forceInstallManifestEnabled )
|
||||
qInfo() << "Forcing install of applications manifest.";
|
||||
|
||||
const bool forceRemoveManifestEnabled = parser.isSet( forceRemoveManifest );
|
||||
LOG_IF( forceRemoveManifestEnabled, INFO )
|
||||
<< "Forcing removal of applications manifest.";
|
||||
if ( forceRemoveManifestEnabled )
|
||||
qInfo() << "Forcing removal of applications manifest.";
|
||||
const bool resetSettingsEnabled = parser.isSet( resetSettings );
|
||||
LOG_IF( resetSettingsEnabled, INFO ) << "Reset SteamVR Settings.";
|
||||
if ( resetSettingsEnabled )
|
||||
qInfo() << "Reset SteamVR Settings.";
|
||||
|
||||
const CommandLineOptions commandLineArgs{
|
||||
desktopModeEnabled, forceNoSoundEnabled,
|
||||
@@ -100,7 +90,7 @@ CommandLineOptions returnCommandLineParser( const MyQApplication& application )
|
||||
forceRemoveManifestEnabled, resetSettingsEnabled
|
||||
};
|
||||
|
||||
LOG( INFO ) << "Command line arguments processed.";
|
||||
qInfo() << "Command line arguments processed.";
|
||||
|
||||
return commandLineArgs;
|
||||
}
|
||||
@@ -131,14 +121,14 @@ void installApplicationManifest( const std::string manifestPath )
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
LOG( INFO ) << "Manifest Is already Installed for Key "
|
||||
<< application_strings::applicationKey;
|
||||
qInfo() << "Manifest Is already Installed for Key "
|
||||
<< application_strings::applicationKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto app_error = vr::VRApplications()->AddApplicationManifest(
|
||||
manifestPath.c_str() );
|
||||
LOG( INFO ) << "Manifest Installed at: " << manifestPath;
|
||||
qInfo() << "Manifest Installed at: " << manifestPath;
|
||||
if ( app_error != vr::VRApplicationError_None )
|
||||
{
|
||||
throw std::runtime_error(
|
||||
@@ -157,18 +147,18 @@ void removeApplicationManifest( const std::string manifestPath )
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
vr::VRApplications()->RemoveApplicationManifest( manifestPath.c_str() );
|
||||
LOG( INFO ) << "Attempting to Remove Manifest At: " << manifestPath;
|
||||
qInfo() << "Attempting to Remove Manifest At: " << manifestPath;
|
||||
}
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
LOG( ERROR ) << "Removal Failed, run Advanced Settings from previous "
|
||||
"install directory OR manually delete it in Steam "
|
||||
"install at Steam\\config\\appconfig.json";
|
||||
qCritical() << "Removal Failed, run Advanced Settings from previous "
|
||||
"install directory OR manually delete it in Steam "
|
||||
"install at Steam\\config\\appconfig.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( INFO ) << "Manifest Removed Successfully";
|
||||
qInfo() << "Manifest Removed Successfully";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +168,7 @@ void reinstallApplicationManifest( const std::string manifestPath )
|
||||
if ( vr::VRApplications()->IsApplicationInstalled(
|
||||
application_strings::applicationKey ) )
|
||||
{
|
||||
LOG( INFO ) << "Manifest Previously Installed";
|
||||
qInfo() << "Manifest Previously Installed";
|
||||
// String size was arbitrarily chosen by original author.
|
||||
constexpr auto kStringSize = 1024;
|
||||
char oldApplicationWorkingDir[kStringSize] = { 0 };
|
||||
@@ -246,7 +236,7 @@ void forceRemoveApplicationManifest()
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG( INFO ) << "No Manifest Installed";
|
||||
qInfo() << "No Manifest Installed";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,18 +268,18 @@ void forceRemoveApplicationManifest()
|
||||
{
|
||||
reinstallApplicationManifest( *manifestPath );
|
||||
enableApplicationAutostart();
|
||||
LOG( INFO ) << "Manifest reinstalled.";
|
||||
qInfo() << "Manifest reinstalled.";
|
||||
}
|
||||
else if ( removeManifest )
|
||||
{
|
||||
forceRemoveApplicationManifest();
|
||||
LOG( INFO ) << "Manifest removed.";
|
||||
qInfo() << "Manifest removed.";
|
||||
}
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
{
|
||||
exit_code = ReturnErrorCode::GENERAL_FAILURE;
|
||||
LOG( ERROR ) << e.what();
|
||||
qCritical() << e.what();
|
||||
}
|
||||
|
||||
vr::VR_Shutdown();
|
||||
@@ -299,57 +289,7 @@ void forceRemoveApplicationManifest()
|
||||
|
||||
void setUpLogging()
|
||||
{
|
||||
el::Loggers::addFlag( el::LoggingFlag::DisableApplicationAbortOnFatalLog );
|
||||
|
||||
el::Configurations conf;
|
||||
conf.setToDefault();
|
||||
|
||||
using el::ConfigurationType;
|
||||
using el::Level;
|
||||
|
||||
conf.set( Level::Global,
|
||||
ConfigurationType::Format,
|
||||
"[%level] %datetime{%Y-%M-%d %H:%m:%s}: %msg" );
|
||||
constexpr auto logFileName = "AdvancedSettings.log";
|
||||
conf.set( Level::Global, ConfigurationType::Filename, logFileName );
|
||||
|
||||
constexpr auto confEnabled = "true";
|
||||
conf.set( Level::Global, ConfigurationType::Enabled, confEnabled );
|
||||
conf.set( Level::Global, ConfigurationType::ToFile, confEnabled );
|
||||
conf.set( Level::Global, ConfigurationType::ToStandardOutput, confEnabled );
|
||||
|
||||
constexpr auto TwoMegabytesInBytes = "2097152";
|
||||
conf.set(
|
||||
Level::Global, ConfigurationType::MaxLogFileSize, TwoMegabytesInBytes );
|
||||
|
||||
constexpr auto confDisabled = "false";
|
||||
conf.set( Level::Trace, ConfigurationType::Enabled, confDisabled );
|
||||
|
||||
if constexpr ( debugLoggingEnabled )
|
||||
{
|
||||
conf.set( Level::Debug, ConfigurationType::Enabled, confEnabled );
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled );
|
||||
}
|
||||
|
||||
const auto appDataLocation
|
||||
= std::string( "/" ) + application_strings::applicationOrganizationName
|
||||
+ "/";
|
||||
const auto logFilePath
|
||||
= QDir( QString::fromStdString( *paths::settingsDirectory() )
|
||||
+ appDataLocation.c_str() )
|
||||
.absoluteFilePath( logFileName );
|
||||
conf.set( el::Level::Global,
|
||||
el::ConfigurationType::Filename,
|
||||
QDir::toNativeSeparators( logFilePath ).toStdString() );
|
||||
|
||||
conf.setRemainingToDefault();
|
||||
|
||||
el::Loggers::reconfigureAllLoggers( conf );
|
||||
|
||||
LOG( INFO ) << "Application started (Version "
|
||||
<< application_strings::applicationVersionString << ")";
|
||||
LOG( INFO ) << "Log File: " << logFilePath;
|
||||
f = fopen( "AdvancedSettings.log", "a" );
|
||||
qSetMessagePattern("[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{time process}: %{message}");
|
||||
originalMessageHandler = qInstallMessageHandler( mainQtMessageHandler );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user