NOISSUE fix up translation selection in settings and add OS/sys arch reporting
This commit is contained in:
parent
722896d41f
commit
a666dc0a1a
@ -93,6 +93,7 @@ set(NBT_NAME MultiMC_nbt++)
|
|||||||
add_subdirectory(libraries/libnbtplusplus)
|
add_subdirectory(libraries/libnbtplusplus)
|
||||||
|
|
||||||
add_subdirectory(libraries/ganalytics) # google analytics library
|
add_subdirectory(libraries/ganalytics) # google analytics library
|
||||||
|
add_subdirectory(libraries/systeminfo) # system information library
|
||||||
add_subdirectory(libraries/hoedown) # markdown parser
|
add_subdirectory(libraries/hoedown) # markdown parser
|
||||||
add_subdirectory(libraries/launcher) # java based launcher part for Minecraft
|
add_subdirectory(libraries/launcher) # java based launcher part for Minecraft
|
||||||
add_subdirectory(libraries/javacheck) # java compatibility checker
|
add_subdirectory(libraries/javacheck) # java compatibility checker
|
||||||
|
@ -490,7 +490,7 @@ set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISI
|
|||||||
generate_export_header(MultiMC_logic)
|
generate_export_header(MultiMC_logic)
|
||||||
|
|
||||||
# Link
|
# Link
|
||||||
target_link_libraries(MultiMC_logic xz-embedded unpack200 ${QUAZIP_LIBRARIES} ${NBT_NAME} ${ZLIB_LIBRARIES})
|
target_link_libraries(MultiMC_logic xz-embedded unpack200 systeminfo ${QUAZIP_LIBRARIES} ${NBT_NAME} ${ZLIB_LIBRARIES})
|
||||||
qt5_use_modules(MultiMC_logic Core Xml Network Concurrent)
|
qt5_use_modules(MultiMC_logic Core Xml Network Concurrent)
|
||||||
add_dependencies(MultiMC_logic QuaZIP)
|
add_dependencies(MultiMC_logic QuaZIP)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <FileSystem.h>
|
#include <FileSystem.h>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <sys.h>
|
||||||
|
|
||||||
void CheckJava::executeTask()
|
void CheckJava::executeTask()
|
||||||
{
|
{
|
||||||
@ -83,6 +84,7 @@ void CheckJava::checkJavaFinished(JavaCheckResult result)
|
|||||||
emit logLine(tr("Could not start java:"), MessageLevel::Error);
|
emit logLine(tr("Could not start java:"), MessageLevel::Error);
|
||||||
emit logLines(result.errorLog.split('\n'), MessageLevel::Error);
|
emit logLines(result.errorLog.split('\n'), MessageLevel::Error);
|
||||||
emit logLine("\nCheck your MultiMC Java settings.", MessageLevel::MultiMC);
|
emit logLine("\nCheck your MultiMC Java settings.", MessageLevel::MultiMC);
|
||||||
|
printSystemInfo(false, false);
|
||||||
emitFailed(tr("Could not start java!"));
|
emitFailed(tr("Could not start java!"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -99,4 +101,22 @@ void CheckJava::checkJavaFinished(JavaCheckResult result)
|
|||||||
void CheckJava::printJavaInfo(const QString& version, const QString& architecture)
|
void CheckJava::printJavaInfo(const QString& version, const QString& architecture)
|
||||||
{
|
{
|
||||||
emit logLine(tr("Java is version %1, using %2-bit architecture.\n\n").arg(version, architecture), MessageLevel::MultiMC);
|
emit logLine(tr("Java is version %1, using %2-bit architecture.\n\n").arg(version, architecture), MessageLevel::MultiMC);
|
||||||
|
printSystemInfo(true, architecture == "64");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckJava::printSystemInfo(bool javaIsKnown, bool javaIs64bit)
|
||||||
|
{
|
||||||
|
auto cpu64 = Sys::isCPU64bit();
|
||||||
|
auto system64 = Sys::isSystem64bit();
|
||||||
|
if(cpu64 != system64)
|
||||||
|
{
|
||||||
|
emit logLine(tr("Your CPU architecture is not matching your system architecture. You might want to install a 64bit Operating System.\n\n"), MessageLevel::Error);
|
||||||
|
}
|
||||||
|
if(javaIsKnown)
|
||||||
|
{
|
||||||
|
if(javaIs64bit != system64)
|
||||||
|
{
|
||||||
|
emit logLine(tr("Your Java architecture is not matching your system architecture. You might want to install a 64bit Java version.\n\n"), MessageLevel::Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void printJavaInfo(const QString & version, const QString & architecture);
|
void printJavaInfo(const QString & version, const QString & architecture);
|
||||||
|
void printSystemInfo(bool javaIsKnown, bool javaIs64bit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_javaPath;
|
QString m_javaPath;
|
||||||
|
@ -55,6 +55,7 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
|
|||||||
|
|
||||||
defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat());
|
defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat());
|
||||||
|
|
||||||
|
m_languageModel = MMC->translations();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
if(BuildConfig.UPDATER_ENABLED)
|
if(BuildConfig.UPDATER_ENABLED)
|
||||||
@ -82,6 +83,7 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
|
|||||||
}
|
}
|
||||||
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
|
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
|
||||||
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
|
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
|
||||||
|
connect(ui->languageBox, SIGNAL(currentIndexChanged(int)), SLOT(languageIndexChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiMCPage::~MultiMCPage()
|
MultiMCPage::~MultiMCPage()
|
||||||
@ -190,6 +192,19 @@ void MultiMCPage::on_lwjglDirBrowseBtn_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultiMCPage::languageIndexChanged(int index)
|
||||||
|
{
|
||||||
|
auto languageCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString();
|
||||||
|
if(languageCode.isEmpty())
|
||||||
|
{
|
||||||
|
qWarning() << "Unknown language at index" << index;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto translations = MMC->translations();
|
||||||
|
translations->selectLanguage(languageCode);
|
||||||
|
translations->updateLanguage(languageCode);
|
||||||
|
}
|
||||||
|
|
||||||
void MultiMCPage::refreshUpdateChannelList()
|
void MultiMCPage::refreshUpdateChannelList()
|
||||||
{
|
{
|
||||||
// Stop listening for selection changes. It's going to change a lot while we update it and
|
// Stop listening for selection changes. It's going to change a lot while we update it and
|
||||||
@ -363,29 +378,7 @@ void MultiMCPage::loadSettings()
|
|||||||
auto s = MMC->settings();
|
auto s = MMC->settings();
|
||||||
// Language
|
// Language
|
||||||
{
|
{
|
||||||
using LanguageItem = std::pair<QString, QString>;
|
ui->languageBox->setModel(m_languageModel.get());
|
||||||
std::vector<LanguageItem> items;
|
|
||||||
|
|
||||||
QLocale english("en");
|
|
||||||
items.push_back(std::make_pair(english.nativeLanguageName(), "en"));
|
|
||||||
for(QString lang: QDir("translations").entryList(QStringList() << "*.qm", QDir::Files))
|
|
||||||
{
|
|
||||||
lang.remove(".qm");
|
|
||||||
lang.remove("mmc_");
|
|
||||||
QLocale locale(lang);
|
|
||||||
QString fullLangName = locale.nativeLanguageName();
|
|
||||||
qDebug() << fullLangName << lang;
|
|
||||||
items.push_back(std::make_pair(fullLangName, lang));
|
|
||||||
}
|
|
||||||
std::sort(items.begin(), items.end(), [](const LanguageItem & a, const LanguageItem & b)
|
|
||||||
{
|
|
||||||
return a.first.localeAwareCompare(b.first) < 0;
|
|
||||||
});
|
|
||||||
ui->languageBox->clear();
|
|
||||||
for(auto & item: items)
|
|
||||||
{
|
|
||||||
ui->languageBox->addItem(item.first, item.second);
|
|
||||||
}
|
|
||||||
ui->languageBox->setCurrentIndex(ui->languageBox->findData(s->get("Language").toString()));
|
ui->languageBox->setCurrentIndex(ui->languageBox->findData(s->get("Language").toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "pages/BasePage.h"
|
#include "pages/BasePage.h"
|
||||||
#include <MultiMC.h>
|
#include <MultiMC.h>
|
||||||
#include "ColorCache.h"
|
#include "ColorCache.h"
|
||||||
|
#include <translations/TranslationsModel.h>
|
||||||
|
|
||||||
class QTextCharFormat;
|
class QTextCharFormat;
|
||||||
class SettingsObject;
|
class SettingsObject;
|
||||||
@ -71,6 +72,8 @@ slots:
|
|||||||
void on_lwjglDirBrowseBtn_clicked();
|
void on_lwjglDirBrowseBtn_clicked();
|
||||||
void on_iconsDirBrowseBtn_clicked();
|
void on_iconsDirBrowseBtn_clicked();
|
||||||
|
|
||||||
|
void languageIndexChanged(int index);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Updates the list of update channels in the combo box.
|
* Updates the list of update channels in the combo box.
|
||||||
*/
|
*/
|
||||||
@ -100,4 +103,6 @@ private:
|
|||||||
QTextCharFormat *defaultFormat;
|
QTextCharFormat *defaultFormat;
|
||||||
|
|
||||||
std::unique_ptr<LogColorCache> m_colors;
|
std::unique_ptr<LogColorCache> m_colors;
|
||||||
|
|
||||||
|
std::shared_ptr<TranslationsModel> m_languageModel;
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>467</width>
|
||||||
<height>614</height>
|
<height>614</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -320,7 +320,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Language (needs restart):</string>
|
<string>Language:</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -67,7 +67,27 @@ public:
|
|||||||
languageView->setCurrentIndex(index);
|
languageView->setCurrentIndex(index);
|
||||||
connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageWizardPage::languageRowChanged);
|
connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageWizardPage::languageRowChanged);
|
||||||
}
|
}
|
||||||
virtual ~LanguageWizardPage() {};
|
|
||||||
|
virtual ~LanguageWizardPage()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
bool validatePage() override
|
||||||
|
{
|
||||||
|
auto settings = MMC->settings();
|
||||||
|
auto translations = MMC->translations();
|
||||||
|
QString key = translations->data(languageView->currentIndex(), Qt::UserRole).toString();
|
||||||
|
settings->set("Language", key);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isRequired()
|
||||||
|
{
|
||||||
|
auto settings = MMC->settings();
|
||||||
|
if (settings->get("Language").toString().isEmpty())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void retranslate() override
|
void retranslate() override
|
||||||
@ -116,7 +136,35 @@ public:
|
|||||||
verticalLayout_3->addWidget(checkBox);
|
verticalLayout_3->addWidget(checkBox);
|
||||||
retranslate();
|
retranslate();
|
||||||
}
|
}
|
||||||
virtual ~AnalyticsWizardPage() {};
|
|
||||||
|
virtual ~AnalyticsWizardPage()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
bool validatePage() override
|
||||||
|
{
|
||||||
|
auto settings = MMC->settings();
|
||||||
|
auto analytics = MMC->analytics();
|
||||||
|
auto status = checkBox->isChecked();
|
||||||
|
settings->set("AnalyticsSeen", analytics->version());
|
||||||
|
settings->set("Analytics", status);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isRequired()
|
||||||
|
{
|
||||||
|
auto settings = MMC->settings();
|
||||||
|
auto analytics = MMC->analytics();
|
||||||
|
if(!settings->get("Analytics").toBool())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(settings->get("AnalyticsSeen").toInt() < analytics->version())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void retranslate() override
|
void retranslate() override
|
||||||
@ -149,20 +197,12 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent)
|
|||||||
{
|
{
|
||||||
setObjectName(QStringLiteral("SetupWizard"));
|
setObjectName(QStringLiteral("SetupWizard"));
|
||||||
resize(615, 659);
|
resize(615, 659);
|
||||||
setOptions(QWizard::NoCancelButton);
|
setOptions(QWizard::NoCancelButton | QWizard::IndependentPages);
|
||||||
if (languageIsRequired())
|
if (LanguageWizardPage::isRequired())
|
||||||
{
|
{
|
||||||
setPage(Page::Language, new LanguageWizardPage(this));
|
setPage(Page::Language, new LanguageWizardPage(this));
|
||||||
}
|
}
|
||||||
if(javaIsRequired())
|
if(AnalyticsWizardPage::isRequired())
|
||||||
{
|
|
||||||
// set up java selection
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
removePage(Page::Java);
|
|
||||||
}
|
|
||||||
if(analyticsIsRequired())
|
|
||||||
{
|
{
|
||||||
setPage(Page::Analytics, new AnalyticsWizardPage(this));
|
setPage(Page::Analytics, new AnalyticsWizardPage(this));
|
||||||
}
|
}
|
||||||
@ -189,14 +229,7 @@ SetupWizard::~SetupWizard()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetupWizard::languageIsRequired()
|
/*
|
||||||
{
|
|
||||||
auto settings = MMC->settings();
|
|
||||||
if (settings->get("Language").toString().isEmpty())
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SetupWizard::javaIsRequired()
|
bool SetupWizard::javaIsRequired()
|
||||||
{
|
{
|
||||||
QString currentHostName = QHostInfo::localHostName();
|
QString currentHostName = QHostInfo::localHostName();
|
||||||
@ -214,25 +247,13 @@ bool SetupWizard::javaIsRequired()
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bool SetupWizard::analyticsIsRequired()
|
|
||||||
{
|
|
||||||
auto settings = MMC->settings();
|
|
||||||
auto analytics = MMC->analytics();
|
|
||||||
if(settings->get("AnalyticsSeen").toInt() < analytics->version())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SetupWizard::isRequired()
|
bool SetupWizard::isRequired()
|
||||||
{
|
{
|
||||||
if (languageIsRequired())
|
if (LanguageWizardPage::isRequired())
|
||||||
return true;
|
return true;
|
||||||
if (javaIsRequired())
|
if (AnalyticsWizardPage::isRequired())
|
||||||
return true;
|
|
||||||
if (analyticsIsRequired())
|
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,6 @@ public: /* con/destructors */
|
|||||||
|
|
||||||
public: /* methods */
|
public: /* methods */
|
||||||
static bool isRequired();
|
static bool isRequired();
|
||||||
static bool javaIsRequired();
|
|
||||||
static bool languageIsRequired();
|
|
||||||
static bool analyticsIsRequired();
|
|
||||||
|
|
||||||
private: /* methods */
|
private: /* methods */
|
||||||
void retranslate();
|
void retranslate();
|
||||||
|
@ -8,26 +8,10 @@ set(ganalytics_SOURCES
|
|||||||
src/ganalytics.cpp
|
src/ganalytics.cpp
|
||||||
src/ganalytics_worker.cpp
|
src/ganalytics_worker.cpp
|
||||||
src/ganalytics_worker.h
|
src/ganalytics_worker.h
|
||||||
include/sys.h
|
|
||||||
include/ganalytics.h
|
include/ganalytics.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
list(APPEND ganalytics_SOURCES src/sys_win32.cpp)
|
|
||||||
elseif (UNIX)
|
|
||||||
if(APPLE)
|
|
||||||
list(APPEND ganalytics_SOURCES src/sys_apple.cpp)
|
|
||||||
else()
|
|
||||||
list(APPEND ganalytics_SOURCES src/sys_unix.cpp)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(ganalytics STATIC ${ganalytics_SOURCES})
|
add_library(ganalytics STATIC ${ganalytics_SOURCES})
|
||||||
qt5_use_modules(ganalytics Core Gui Network)
|
qt5_use_modules(ganalytics Core Gui Network)
|
||||||
target_include_directories(ganalytics PUBLIC include)
|
target_include_directories(ganalytics PUBLIC include)
|
||||||
|
target_link_libraries(ganalytics systeminfo)
|
||||||
include (UnitTest)
|
|
||||||
add_unit_test(sys
|
|
||||||
SOURCES src/sys_test.cpp
|
|
||||||
LIBS ganalytics
|
|
||||||
)
|
|
||||||
|
27
libraries/systeminfo/CMakeLists.txt
Normal file
27
libraries/systeminfo/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
project(systeminfo)
|
||||||
|
|
||||||
|
find_package(Qt5Core)
|
||||||
|
|
||||||
|
set(systeminfo_SOURCES
|
||||||
|
include/sys.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
list(APPEND systeminfo_SOURCES src/sys_win32.cpp)
|
||||||
|
elseif (UNIX)
|
||||||
|
if(APPLE)
|
||||||
|
list(APPEND systeminfo_SOURCES src/sys_apple.cpp)
|
||||||
|
else()
|
||||||
|
list(APPEND systeminfo_SOURCES src/sys_unix.cpp)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(systeminfo STATIC ${systeminfo_SOURCES})
|
||||||
|
qt5_use_modules(systeminfo Core Gui Network)
|
||||||
|
target_include_directories(systeminfo PUBLIC include)
|
||||||
|
|
||||||
|
include (UnitTest)
|
||||||
|
add_unit_test(sys
|
||||||
|
SOURCES src/sys_test.cpp
|
||||||
|
LIBS systeminfo
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user