Improved lamexp_themes_enabled() function.
This commit is contained in:
parent
c71f535c35
commit
a69a1f6dbe
@ -3304,23 +3304,23 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="855"/>
|
||||
<location filename="../../src/Global.cpp" line="864"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1109"/>
|
||||
<location filename="../../src/Global.cpp" line="1118"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1114"/>
|
||||
<location filename="../../src/Global.cpp" line="1123"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1127"/>
|
||||
<location filename="../../src/Global.cpp" line="1154"/>
|
||||
<location filename="../../src/Global.cpp" line="1136"/>
|
||||
<location filename="../../src/Global.cpp" line="1163"/>
|
||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -3341,23 +3341,23 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="855"/>
|
||||
<location filename="../../src/Global.cpp" line="864"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation type="unfinished">Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1109"/>
|
||||
<location filename="../../src/Global.cpp" line="1118"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation type="unfinished">Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1114"/>
|
||||
<location filename="../../src/Global.cpp" line="1123"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation type="unfinished">Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1127"/>
|
||||
<location filename="../../src/Global.cpp" line="1154"/>
|
||||
<location filename="../../src/Global.cpp" line="1136"/>
|
||||
<location filename="../../src/Global.cpp" line="1163"/>
|
||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||
<translation type="unfinished">Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
|
||||
</message>
|
||||
|
@ -3324,23 +3324,23 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="855"/>
|
||||
<location filename="../../src/Global.cpp" line="864"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation>EXE-filen '%1' stöder inte Windows kompatibilitetsläge.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1109"/>
|
||||
<location filename="../../src/Global.cpp" line="1118"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation>EXE-filen '%1' kräver Qt v%2, du har Qt v%3.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1114"/>
|
||||
<location filename="../../src/Global.cpp" line="1123"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation>EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="1127"/>
|
||||
<location filename="../../src/Global.cpp" line="1154"/>
|
||||
<location filename="../../src/Global.cpp" line="1136"/>
|
||||
<location filename="../../src/Global.cpp" line="1163"/>
|
||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||
<translation>EXE-filen '%1' kräver Windows 2000 eller senare.</translation>
|
||||
</message>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 7
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 7
|
||||
#define VER_LAMEXP_BUILD 1248
|
||||
#define VER_LAMEXP_BUILD 1250
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tool versions (minimum expected versions!)
|
||||
|
@ -247,7 +247,7 @@ void CueImportDialog::browseButtonClicked(void)
|
||||
if(pos > 0) currentDir.left(pos - 1); else break;
|
||||
}
|
||||
|
||||
if(lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
newOutDir = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory"), currentDir);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ while(0)
|
||||
|
||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
|
||||
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "−"))
|
||||
#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
||||
//#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
||||
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
|
||||
|
||||
static const DWORD IDM_ABOUTBOX = 0xEFF0;
|
||||
@ -1931,7 +1931,7 @@ void MainWindow::importCueSheetActionTriggered(bool checked)
|
||||
int result = 0;
|
||||
QString selectedCueFile;
|
||||
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), m_settings->mostRecentInputPath(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
|
||||
}
|
||||
@ -2155,7 +2155,7 @@ void MainWindow::addFilesButtonClicked(void)
|
||||
|
||||
TEMP_HIDE_DROPBOX
|
||||
(
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
|
||||
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), m_settings->mostRecentInputPath(), fileTypeFilters.join(";;"));
|
||||
@ -2197,7 +2197,7 @@ void MainWindow::openFolderActionActivated(void)
|
||||
{
|
||||
TEMP_HIDE_DROPBOX
|
||||
(
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add Folder"), m_settings->mostRecentInputPath());
|
||||
}
|
||||
@ -2459,7 +2459,7 @@ void MainWindow::exportCsvContextActionTriggered(void)
|
||||
(
|
||||
QString selectedCsvFile;
|
||||
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
selectedCsvFile = QFileDialog::getSaveFileName(this, tr("Save CSV file"), m_settings->mostRecentInputPath(), QString("%1 (*.csv)").arg(tr("CSV File")));
|
||||
}
|
||||
@ -2510,7 +2510,7 @@ void MainWindow::importCsvContextActionTriggered(void)
|
||||
(
|
||||
QString selectedCsvFile;
|
||||
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
selectedCsvFile = QFileDialog::getOpenFileName(this, tr("Open CSV file"), m_settings->mostRecentInputPath(), QString("%1 (*.csv)").arg(tr("CSV File")));
|
||||
}
|
||||
@ -3853,7 +3853,7 @@ void MainWindow::browseCustomTempFolderButtonClicked(void)
|
||||
{
|
||||
QString newTempFolder;
|
||||
|
||||
if(USE_NATIVE_FILE_DIALOG)
|
||||
if(lamexp_themes_enabled())
|
||||
{
|
||||
newTempFolder = QFileDialog::getExistingDirectory(this, QString(), m_settings->customTempPath());
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ static struct
|
||||
}
|
||||
g_lamexp_argv;
|
||||
|
||||
//CLI Arguments
|
||||
//OS Version
|
||||
static struct
|
||||
{
|
||||
bool bInitialized;
|
||||
@ -274,6 +274,15 @@ static struct
|
||||
}
|
||||
g_lamexp_os_version;
|
||||
|
||||
//Win32 Theme support
|
||||
static struct
|
||||
{
|
||||
bool bInitialized;
|
||||
bool bThemesEnabled;
|
||||
QReadWriteLock lock;
|
||||
}
|
||||
g_lamexp_themes_enabled;
|
||||
|
||||
//Shared memory
|
||||
static const struct
|
||||
{
|
||||
@ -2001,10 +2010,20 @@ bool lamexp_themes_enabled(void)
|
||||
{
|
||||
typedef int (WINAPI *IsAppThemedFun)(void);
|
||||
|
||||
static bool isAppThemed = false;
|
||||
static bool isAppThemed_initialized = false;
|
||||
QReadLocker readLock(&g_lamexp_themes_enabled.lock);
|
||||
if(g_lamexp_themes_enabled.bInitialized)
|
||||
{
|
||||
return g_lamexp_themes_enabled.bThemesEnabled;
|
||||
}
|
||||
|
||||
if(!isAppThemed_initialized)
|
||||
readLock.unlock();
|
||||
QWriteLocker writeLock(&g_lamexp_themes_enabled.lock);
|
||||
|
||||
if(!g_lamexp_themes_enabled.bInitialized)
|
||||
{
|
||||
g_lamexp_themes_enabled.bThemesEnabled = false;
|
||||
const lamexp_os_version_t * osVersion = lamexp_get_os_version();
|
||||
if(LAMEXP_MIN_OS_VER(osVersion, 5, 1))
|
||||
{
|
||||
IsAppThemedFun IsAppThemedPtr = NULL;
|
||||
QLibrary uxTheme(QString("%1/UxTheme.dll").arg(lamexp_known_folder(lamexp_folder_systemfolder)));
|
||||
@ -2014,16 +2033,17 @@ bool lamexp_themes_enabled(void)
|
||||
}
|
||||
if(IsAppThemedPtr)
|
||||
{
|
||||
isAppThemed = IsAppThemedPtr();
|
||||
if(!isAppThemed)
|
||||
g_lamexp_themes_enabled.bThemesEnabled = IsAppThemedPtr();
|
||||
if(!g_lamexp_themes_enabled.bThemesEnabled)
|
||||
{
|
||||
qWarning("Theme support is disabled for this process!");
|
||||
}
|
||||
}
|
||||
isAppThemed_initialized = true;
|
||||
}
|
||||
g_lamexp_themes_enabled.bInitialized = true;
|
||||
}
|
||||
|
||||
return isAppThemed;
|
||||
return g_lamexp_themes_enabled.bThemesEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2372,6 +2392,7 @@ extern "C"
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_folder);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_os_version);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled);
|
||||
|
||||
//Make sure we will pass the check
|
||||
g_lamexp_entry_check_flag = ~g_lamexp_entry_check_flag;
|
||||
|
Loading…
Reference in New Issue
Block a user