Compare commits

...

2 Commits

Author SHA1 Message Date
Valentino Orlandi 565cd39bbd
Improvements
Code improvements.
Moved OS check to compile time.
2023-05-21 22:55:37 +02:00
Valentino Orlandi c55bd4f826
Fix
Fixed language menu entries check-state
2023-05-21 22:54:37 +02:00
4 changed files with 182 additions and 186 deletions

View File

@ -1,8 +1,12 @@
#include "mainwindow.h"
#include <QApplication> #include <QApplication>
#if !(defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 ) || defined( Q_OS_WINDOWS ) || defined( Q_OS_MACOS ))
# error "System not supported"
#endif
#include "mainwindow.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@ -73,6 +73,11 @@ MainWindow::~MainWindow()
delete this->installer_timer; delete this->installer_timer;
} }
void MainWindow::on_button_Close_clicked()
{
this->close();
}
/////////////// ///////////////
//// UTILS //// //// UTILS ////
@ -274,27 +279,31 @@ void MainWindow::Install()
} }
} }
if ( ok && this->OS != 3 ) { // mac .app contains it #if !defined( Q_OS_MACOS )
this->ui->progressBar_Install->setValue( 85 ); if ( ok ) { // mac .app contains it
this->ui->label_Install_Info->setText( MainWindow::tr( "Copying the uninstaller ..." ) ); this->ui->progressBar_Install->setValue( 85 );
// move the uninstaller this->ui->label_Install_Info->setText( MainWindow::tr( "Copying the uninstaller ..." ) );
ok = this->copyUninstaller(); // move the uninstaller
} ok = this->copyUninstaller();
}
#endif
} }
if ( ok && this->OS != 3 ) { // mac .app contains these #if !defined( Q_OS_MACOS )
this->ui->progressBar_Install->setValue( 90 ); if ( ok ) { // mac .app contains these
this->ui->label_Install_Info->setText( MainWindow::tr( "Copying the icon ..." ) ); this->ui->progressBar_Install->setValue( 90 );
// move the icon this->ui->label_Install_Info->setText( MainWindow::tr( "Copying the icon ..." ) );
ok = this->copyIcon(); // move the icon
ok = this->copyIcon();
// make the menu entry // make the menu entry
if ( ok && this->make_menu_entry ) { if ( ok && this->make_menu_entry ) {
this->ui->progressBar_Install->setValue( 95 ); this->ui->progressBar_Install->setValue( 95 );
this->ui->label_Install_Info->setText( MainWindow::tr( "Creating the menu entry ..." ) ); this->ui->label_Install_Info->setText( MainWindow::tr( "Creating the menu entry ..." ) );
ok = this->makeMenuEntry(); ok = this->makeMenuEntry();
}
} }
} #endif
// proocess finished // proocess finished
if ( ok ) { if ( ok ) {
@ -323,8 +332,21 @@ bool MainWindow::checkExecutablePath()
if ( ! std::filesystem::exists( this->exec_path ) ) { if ( ! std::filesystem::exists( this->exec_path ) ) {
this->ui->progressBar_Install->setValue( 10 ); this->ui->progressBar_Install->setValue( 10 );
// path does not exists // path does not exists
if ( this->OS != 2 ) { #if defined( Q_OS_WINDOWS )
// on unix/mac. path is (supposedly) always present // must create the new folder
ok = std::filesystem::create_directory( this->exec_path, err );
if ( !ok ) {
// failed to create
DialogMsg dialog = DialogMsg(
MainWindow::tr( "Installation failed" ),
QString("%1:\n%2").arg(
MainWindow::tr( "Failed to create the directory" ),
QString::fromStdString( this->exec_path.string() ) ),
QString::fromStdString( err.message() ), 2, nullptr );
std::ignore = dialog.exec();
}
#else
// unix-like. path is (supposedly) always present
ok = false; ok = false;
DialogMsg dialog = DialogMsg( DialogMsg dialog = DialogMsg(
MainWindow::tr( "Installation failed" ), MainWindow::tr( "Installation failed" ),
@ -333,27 +355,14 @@ bool MainWindow::checkExecutablePath()
QString::fromStdString( this->exec_path.string() ) ), QString::fromStdString( this->exec_path.string() ) ),
QString::fromStdString( err.message() ), 2, nullptr ); QString::fromStdString( err.message() ), 2, nullptr );
std::ignore = dialog.exec(); std::ignore = dialog.exec();
} else { #endif
// on windows. must create the new folder
ok = std::filesystem::create_directory( this->exec_path, err );
if ( !ok ) {
// failed to create
DialogMsg dialog = DialogMsg(
MainWindow::tr( "Installation failed" ),
QString("%1:\n%2").arg(
MainWindow::tr( "Failed to create the directory" ),
QString::fromStdString( this->exec_path.string() ) ),
QString::fromStdString( err.message() ), 2, nullptr );
std::ignore = dialog.exec();
}
}
} else { } else {
this->ui->progressBar_Install->setValue( 5 ); this->ui->progressBar_Install->setValue( 5 );
// path exists // path exists
if ( this->OS == 1 ) { #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
// on unix. check if the executable already exists // check if the executable already exists
const std::filesystem::path path = this->exec_path.string() + "/logdoctor"; const std::filesystem::path path = this->exec_path / "logdoctor";
if ( std::filesystem::exists( path ) ) { if ( std::filesystem::exists( path ) ) {
// an entry already exists, ask to overwrite it // an entry already exists, ask to overwrite it
{ {
@ -385,7 +394,7 @@ bool MainWindow::checkExecutablePath()
} }
} }
} }
} else { #else
// on windows/mac // on windows/mac
if ( ! std::filesystem::is_directory( this->exec_path ) ) { if ( ! std::filesystem::is_directory( this->exec_path ) ) {
// not a directory, ask to overwrite it // not a directory, ask to overwrite it
@ -430,13 +439,13 @@ bool MainWindow::checkExecutablePath()
} else { } else {
this->ui->progressBar_Install->setValue( 5 ); this->ui->progressBar_Install->setValue( 5 );
// installation altready exists, check the executable // installation altready exists, check the executable
const std::string ext = (this->OS==2) ? ".exe" : ".app"; #if defined( Q_OS_WINDOWS )
std::vector<std::string> names = {"/LogDoctor","/uninstall"}; const std::vector<std::string> names = {"LogDoctor.exe","uninstall.exe"};
if ( this->OS == 3 ) { #elif defined( Q_OS_MACOS )
names.pop_back(); const std::vector<std::string> names = {"LogDoctor.app"};
} #endif
for ( const auto& name : names ) { for ( const auto& name : names ) {
const std::filesystem::path path = this->exec_path.string() + name + ext; const std::filesystem::path path = this->exec_path / name;
if ( std::filesystem::exists( path ) ) { if ( std::filesystem::exists( path ) ) {
// an entry already exists, ask to overwrite it // an entry already exists, ask to overwrite it
{ {
@ -470,7 +479,7 @@ bool MainWindow::checkExecutablePath()
} }
} }
} }
} #endif
} }
return ok; return ok;
} }
@ -541,7 +550,7 @@ bool MainWindow::checkConfigsPath()
} else { } else {
this->ui->progressBar_Install->setValue( 20 ); this->ui->progressBar_Install->setValue( 20 );
// is a directory: probably an installation already exists, check if a cofiguration file is present // is a directory: probably an installation already exists, check if a cofiguration file is present
const std::filesystem::path path = this->conf_path.string() + "/logdoctor.conf"; const std::filesystem::path path = this->conf_path / "logdoctor.conf";
if ( std::filesystem::exists( path ) ) { if ( std::filesystem::exists( path ) ) {
// a configuration file already exists, ask to overwrite it or not // a configuration file already exists, ask to overwrite it or not
{ {
@ -663,11 +672,14 @@ bool MainWindow::checkAppdataPath()
if ( ok ) { if ( ok ) {
this->ui->progressBar_Install->setValue( 40 ); this->ui->progressBar_Install->setValue( 40 );
// agreed on overwriting content, remove it // agreed on overwriting content, remove it
std::vector<std::filesystem::path> paths = { #if defined( Q_OS_MACOS )
this->data_path.string() + "/help" }; const std::vector<std::filesystem::path> paths = {
if ( this->OS != 3 ) { // mac .app already contains it this->data_path / "help" };
paths.push_back( this->data_path.string() + "/licenses" ); #else
} const std::vector<std::filesystem::path> paths = {
this->data_path / "help",
this->data_path / "licenses" }; // mac .app already contains it
#endif
for ( const auto& path : paths ) { for ( const auto& path : paths ) {
// remove the entries // remove the entries
if ( !std::filesystem::exists( path ) ) { if ( !std::filesystem::exists( path ) ) {
@ -698,29 +710,25 @@ bool MainWindow::copyExecutable()
bool ok = true; bool ok = true;
std::error_code err; std::error_code err;
std::string exec_name; #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
switch ( this->OS ) { const std::string exec_name = "logdoctor";
case 1: #elif defined( Q_OS_WINDOWS )
exec_name = "logdoctor"; break; const std::string exec_name = "LogDoctor.exe";
case 2: #elif defined( Q_OS_MACOS )
exec_name = "LogDoctor.exe"; break; const std::string exec_name = "LogDoctor.app";
case 3: #endif
exec_name = "LogDoctor.app"; break;
default:
throw( "LogDoctor: copyExecutable(): Unexpected OS: "[this->OS] );
}
const std::filesystem::path src_path = "installation_stuff/"+exec_name; const std::filesystem::path src_path = "installation_stuff/"+exec_name;
const std::filesystem::path dst_path = this->exec_path.string()+"/"+exec_name; const std::filesystem::path dst_path = this->exec_path / exec_name;
if ( this->OS == 3 ) { #if defined( Q_OS_MACOS )
std::filesystem::copy( src_path, dst_path, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive, err ); std::filesystem::copy( src_path, dst_path, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive, err );
if ( err.value() != 0 ) { if ( err.value() != 0 ) {
ok = false; ok = false;
} }
} else { #else
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err ); ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
} #endif
if ( !ok ) { if ( !ok ) {
// failed to copy // failed to copy
@ -740,21 +748,18 @@ bool MainWindow::copyExecutable()
std::filesystem::permissions( dst_path, std::filesystem::perms::group_all, std::filesystem::perm_options::remove ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_all, std::filesystem::perm_options::remove );
std::filesystem::permissions( dst_path, std::filesystem::perms::group_read, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_read, std::filesystem::perm_options::add );
std::filesystem::permissions( dst_path, std::filesystem::perms::others_all, std::filesystem::perm_options::remove ); std::filesystem::permissions( dst_path, std::filesystem::perms::others_all, std::filesystem::perm_options::remove );
switch ( this->OS ) { #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
case 1: // 7 5 5
// 7 5 5 std::filesystem::permissions( dst_path, std::filesystem::perms::group_exec, std::filesystem::perm_options::add );
std::filesystem::permissions( dst_path, std::filesystem::perms::others_exec, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::others_read, std::filesystem::perm_options::add );
case 3: std::filesystem::permissions( dst_path, std::filesystem::perms::others_exec, std::filesystem::perm_options::add );
// 7 5 4 #elif defined( Q_OS_MACOS )
std::filesystem::permissions( dst_path, std::filesystem::perms::group_exec, std::filesystem::perm_options::add ); // 7 5 4
std::filesystem::permissions( dst_path, std::filesystem::perms::others_read, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_exec, std::filesystem::perm_options::add );
break; std::filesystem::permissions( dst_path, std::filesystem::perms::others_read, std::filesystem::perm_options::add );
case 2: #elif defined( Q_OS_WINDOWS )
// rw r - // rw r -
break; #endif
default:
throw( "LogDoctor: copyExecutable(): Unexpected OS: "[this->OS] );
}
} catch (...) { } catch (...) {
ok = false; ok = false;
@ -778,7 +783,7 @@ bool MainWindow::copyConfigfile()
std::error_code err; std::error_code err;
const std::filesystem::path src_path = "installation_stuff/logdoctor.conf"; const std::filesystem::path src_path = "installation_stuff/logdoctor.conf";
const std::filesystem::path dst_path = this->conf_path.string()+"/logdoctor.conf"; const std::filesystem::path dst_path = this->conf_path / "logdoctor.conf";
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err ); ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
if ( !ok ) { if ( !ok ) {
@ -800,14 +805,18 @@ bool MainWindow::copyResources()
bool ok = true; bool ok = true;
std::error_code err; std::error_code err;
std::vector<std::string> names = { "help" }; #if defined( Q_OS_MACOS )
if ( this->OS != 3 ) { // mac .app already contains it const std::vector<std::string> names = {
names.push_back( "licenses" ); "help" };
} #else
const std::vector<std::string> names = {
"help",
"licenses" }; // mac .app already contains it
#endif
for ( const auto& name : names ) { for ( const auto& name : names ) {
// remove the entries // remove the entries
const std::filesystem::path src_path = "installation_stuff/logdocdata/"+name; const std::filesystem::path src_path = "installation_stuff/logdocdata/"+name;
const std::filesystem::path dst_path = this->data_path.string()+"/"+name; const std::filesystem::path dst_path = this->data_path / name;
std::filesystem::copy( src_path, dst_path, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive, err ); std::filesystem::copy( src_path, dst_path, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive, err );
if ( err.value() != 0 ) { if ( err.value() != 0 ) {
// failed to move // failed to move
@ -831,20 +840,16 @@ bool MainWindow::copyUninstaller()
bool ok = true; bool ok = true;
std::error_code err; std::error_code err;
std::filesystem::path src_path; #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
std::filesystem::path dst_path; const std::filesystem::path src_path = "installation_stuff/uninstall";
switch ( this->OS ) { const std::filesystem::path dst_path = this->data_path / "uninstall";
case 1: #elif defined( Q_OS_WINDOWS )
src_path = "installation_stuff/uninstall"; const std::filesystem::path src_path = "installation_stuff/uninstall.exe";
dst_path = this->data_path.string()+"/uninstall"; const std::filesystem::path dst_path = this->exec_path / "uninstall.exe";
break; #else
case 2: // macOS should not run this method
src_path = "installation_stuff/uninstall.exe"; throw( "LogDoctor: copyUninstaller(): Unexpected OS" );
dst_path = this->exec_path.string()+"/uninstall.exe"; #endif
break;
default:
throw( "LogDoctor: copyUninstaller(): Unexpected OS: "[this->OS] );
}
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err ); ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
if ( !ok ) { if ( !ok ) {
@ -864,18 +869,14 @@ bool MainWindow::copyUninstaller()
std::filesystem::permissions( dst_path, std::filesystem::perms::group_all, std::filesystem::perm_options::remove ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_all, std::filesystem::perm_options::remove );
std::filesystem::permissions( dst_path, std::filesystem::perms::group_read, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_read, std::filesystem::perm_options::add );
std::filesystem::permissions( dst_path, std::filesystem::perms::others_all, std::filesystem::perm_options::remove ); std::filesystem::permissions( dst_path, std::filesystem::perms::others_all, std::filesystem::perm_options::remove );
switch ( this->OS ) { #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
case 1: // 7 5 5
// 7 5 4
std::filesystem::permissions( dst_path, std::filesystem::perms::group_exec, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::group_exec, std::filesystem::perm_options::add );
std::filesystem::permissions( dst_path, std::filesystem::perms::others_read, std::filesystem::perm_options::add ); std::filesystem::permissions( dst_path, std::filesystem::perms::others_read, std::filesystem::perm_options::add );
break; std::filesystem::permissions( dst_path, std::filesystem::perms::others_exec, std::filesystem::perm_options::add );
case 2: #elif defined( Q_OS_WINDOWS )
// rw r - // rw r -
break; #endif
default:
throw( "LogDoctor: copyUninstaller(): Unexpected OS: "[this->OS] );
}
} catch (...) { } catch (...) {
ok = false; ok = false;
@ -899,19 +900,14 @@ bool MainWindow::copyIcon()
std::error_code err; std::error_code err;
const std::filesystem::path src_path = "installation_stuff/LogDoctor.svg"; const std::filesystem::path src_path = "installation_stuff/LogDoctor.svg";
std::filesystem::path dst_path; #if defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
switch ( this->OS ) { const std::filesystem::path dst_path = "/usr/share/LogDoctor/LogDoctor.svg";
case 1: #elif defined( Q_OS_WINDOWS )
// unix const std::filesystem::path dst_path = this->exec_path / "LogDoctor.svg";
dst_path = "/usr/share/LogDoctor/LogDoctor.svg"; #else
break; // macOS should not run this method
case 2: throw( "LogDoctor: copyIcon(): Unexpected OS" );
// windows #endif
dst_path = this->exec_path.string() + "/LogDoctor.svg";
break;
default:
throw( "LogDoctor: copyIcon(): Unexpected OS: "[this->OS] );
}
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err ); ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
if ( !ok ) { if ( !ok ) {
@ -933,37 +929,33 @@ bool MainWindow::makeMenuEntry()
bool ok = true; bool ok = true;
std::error_code err; std::error_code err;
std::filesystem::path src_path; #if defined( Q_OS_LINUX )
std::filesystem::path dst_path; const std::filesystem::path src_path = "installation_stuff/LogDoctor.desktop";
switch ( this->OS ) { const std::filesystem::path dst_path = "/usr/share/applications/LogDoctor.desktop";
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
case 1: #elif defined( Q_OS_BSD4 )
// unix const std::filesystem::path src_path = "installation_stuff/LogDoctor.desktop";
src_path = "installation_stuff/LogDoctor.desktop"; const std::filesystem::path dst_path = "/usr/local/share/applications/LogDoctor.desktop";
dst_path = this->home_path+"/.local/share/applications/LogDoctor.desktop"; ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err );
ok = std::filesystem::copy_file( src_path, dst_path, std::filesystem::copy_options::overwrite_existing, err ); #elif defined( Q_OS_WINDOWS )
break; const std::filesystem::path src_path = this->exec_path / "LogDoctor.exe";
const std::filesystem::path dst_path = this->home_path.substr(0,2) + "/ProgramData/Microsoft/Windows/Start Menu/Programs/LogDoctor.exe";
case 2: if ( std::filesystem::exists( dst_path ) ) {
// windows // an old entry already exists, remove it
src_path = this->exec_path.string()+"/LogDoctor.exe"; std::ignore = std::filesystem::remove( dst_path, err );
dst_path = this->home_path.substr(0,2) + "/ProgramData/Microsoft/Windows/Start Menu/Programs/LogDoctor.exe"; ok = ! std::filesystem::exists( dst_path );
if ( std::filesystem::exists( dst_path ) ) { }
// an old entry already exists, remove it if ( ok ) {
std::ignore = std::filesystem::remove( dst_path, err ); std::filesystem::create_symlink( src_path, dst_path, err );
ok = ! std::filesystem::exists( dst_path ); if ( !std::filesystem::exists( dst_path ) ) {
// failed to create
ok = false;
} }
if ( ok ) { }
std::filesystem::create_symlink( src_path, dst_path, err ); #else
if ( !std::filesystem::exists( dst_path ) ) { // macOS should not run this method
// failed to create throw( "LogDoctor: makeMenuEntry(): Unexpected OS" );
ok = false; #endif
}
}
break;
default:
throw( "LogDoctor: makeMenuEntry(): Unexpected OS: "[this->OS] );
}
if ( !ok ) { if ( !ok ) {
// failed // failed
@ -977,12 +969,3 @@ bool MainWindow::makeMenuEntry()
} }
return ok; return ok;
} }
void MainWindow::on_button_Close_clicked()
{
this->close();
}

View File

@ -20,7 +20,7 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
private slots: private slots:
@ -57,33 +57,27 @@ private:
// operating system // operating system
const std::string cleanPath( const QString& path ); const std::string cleanPath( const QString& path );
// 1: linux, 2:windows, 3:mac
const std::string home_path = this->cleanPath( QStandardPaths::locate( QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory ) ); const std::string home_path{ this->cleanPath( QStandardPaths::locate( QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory ) ) };
#if defined( Q_OS_DARWIN ) #if defined( Q_OS_MACOS )
// Darwin-based systems: macOS, macOS, iOS, watchOS and tvOS. const std::filesystem::path exec_path{ "/Applications" };
const unsigned int OS = 3; const std::filesystem::path conf_path{ home_path + "/Lybrary/Preferences/LogDoctor" };
const std::filesystem::path exec_path = "/Applications"; const std::filesystem::path data_path{ home_path + "/Lybrary/Application Support/LogDoctor" };
const std::filesystem::path conf_path = home_path + "/Lybrary/Preferences/LogDoctor"; #elif defined( Q_OS_WINDOWS )
const std::filesystem::path data_path = home_path + "/Lybrary/Application Support/LogDoctor"; const std::filesystem::path exec_path{ home_path.substr(0,2) + "/Program Files/LogDoctor" };
#elif defined( Q_OS_WIN ) const std::filesystem::path conf_path{ home_path + "/AppData/Local/LogDoctor" };
// Microsoft Windows systems const std::filesystem::path data_path{ home_path + "/AppData/Local/LogDoctor" };
const unsigned int OS = 2; #elif defined( Q_OS_LINUX ) || defined( Q_OS_BSD4 )
const std::filesystem::path exec_path = home_path.substr(0,2) + "/Program Files/LogDoctor"; const std::filesystem::path exec_path{ "/usr/bin" };
const std::filesystem::path conf_path = home_path + "/AppData/Local/LogDoctor"; const std::filesystem::path conf_path{ home_path + "/.config/LogDoctor" };
const std::filesystem::path data_path = home_path + "/AppData/Local/LogDoctor"; const std::filesystem::path data_path{ "/usr/share/LogDoctor" };
#elif defined( Q_OS_UNIX )
// Unix-like systems: Linux, BSD and SysV
const unsigned int OS = 1;
const std::filesystem::path exec_path = "/usr/bin";
const std::filesystem::path conf_path = home_path + "/.config/LogDoctor";
const std::filesystem::path data_path = "/usr/share/LogDoctor";
#else #else
#error "System not supported" #error "System not supported"
#endif #endif
// language // language
QTranslator translator; QTranslator translator;
std::string language = "en"; std::string language{ "en" };
void updateUiLanguage(); void updateUiLanguage();
// fonts // fonts

View File

@ -1019,6 +1019,12 @@
<addaction name="menuLanguage"/> <addaction name="menuLanguage"/>
</widget> </widget>
<action name="actionEnglish"> <action name="actionEnglish">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="resources/resources.qrc"> <iconset resource="resources/resources.qrc">
<normaloff>:/flags/flags/en.png</normaloff>:/flags/flags/en.png</iconset> <normaloff>:/flags/flags/en.png</normaloff>:/flags/flags/en.png</iconset>
@ -1031,6 +1037,9 @@
</property> </property>
</action> </action>
<action name="actionEspanol"> <action name="actionEspanol">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="resources/resources.qrc"> <iconset resource="resources/resources.qrc">
<normaloff>:/flags/flags/es.png</normaloff>:/flags/flags/es.png</iconset> <normaloff>:/flags/flags/es.png</normaloff>:/flags/flags/es.png</iconset>
@ -1043,6 +1052,9 @@
</property> </property>
</action> </action>
<action name="actionFrancais"> <action name="actionFrancais">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="resources/resources.qrc"> <iconset resource="resources/resources.qrc">
<normaloff>:/flags/flags/fr.png</normaloff>:/flags/flags/fr.png</iconset> <normaloff>:/flags/flags/fr.png</normaloff>:/flags/flags/fr.png</iconset>
@ -1055,6 +1067,9 @@
</property> </property>
</action> </action>
<action name="actionItaliano"> <action name="actionItaliano">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="resources/resources.qrc"> <iconset resource="resources/resources.qrc">
<normaloff>:/flags/flags/it.png</normaloff>:/flags/flags/it.png</iconset> <normaloff>:/flags/flags/it.png</normaloff>:/flags/flags/it.png</iconset>