Working on updater.

This commit is contained in:
Martin Rotter 2014-08-21 17:58:12 +02:00
parent bdb156e28b
commit a11214c1de
10 changed files with 43 additions and 18 deletions

View File

@ -189,12 +189,11 @@ configure_file (
)
# Define some useful DEBUG for, ehrm, debug build.
string(TOLOWER CMAKE_BUILD_TYPE CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE STREQUAL "release")
if(CMAKE_BUILD_TYPE STREQUAL "release" OR CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RELEASE")
message(STATUS "[${APP_LOW_NAME}] A release build (non-debug) is chosen. Debugging outputs are silently ignored.")
set(CMAKE_BUILD_TYPE MinSizeRel)
message(STATUS "[${APP_LOW_NAME}] Output executable file is optimized for minimum size.")
else(CMAKE_BUILD_TYPE STREQUAL "release")
else(CMAKE_BUILD_TYPE STREQUAL "release" OR CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RELEASE")
message(STATUS "[${APP_LOW_NAME}] A debug build is chosen.")
add_definitions(-DDEBUG)
set(CMAKE_BUILD_TYPE Debug)
@ -208,7 +207,7 @@ endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Verbose compiling outputs.
set(CMAKE_VERBOSE_MAKEFILE ON)
endif(CMAKE_BUILD_TYPE STREQUAL "release")
endif(CMAKE_BUILD_TYPE STREQUAL "release" OR CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RELEASE")
# Force Qt to use string builders.
add_definitions(-DQT_USE_QSTRINGBUILDER)
@ -519,6 +518,9 @@ if(WIN32)
resources/binaries/windows/deployment/qt4-msvc2010/QtWebKit4.dll
resources/binaries/windows/deployment/qt4-msvc2010/QtXml4.dll
resources/binaries/windows/deployment/qt4-msvc2010/ssleay32.dll
resources/binaries/windows/deployment/qt4-msvc2010/libintl.dll
resources/binaries/windows/deployment/qt4-msvc2010/libmysql.dll
resources/binaries/windows/deployment/qt4-msvc2010/libpq.dll
)
set(APP_DLLS_QT4_MSVC2010_IMAGEFORMATS
@ -530,6 +532,12 @@ if(WIN32)
resources/binaries/windows/deployment/qt4-msvc2010/imageformats/qtga4.dll
resources/binaries/windows/deployment/qt4-msvc2010/imageformats/qtiff4.dll
)
set(APP_DLLS_QT4_MSVC2010_SQLDRIVERS
resources/binaries/windows/deployment/qt4-msvc2010/sqldrivers/qsqlite4.dll
resources/binaries/windows/deployment/qt4-msvc2010/sqldrivers/qsqlmysql4.dll
resources/binaries/windows/deployment/qt4-msvc2010/sqldrivers/qsqlpsql4.dll
)
endif(WIN32)
# Setup source & header files for "rssguard_updater".
@ -694,6 +702,8 @@ if(WIN32 OR OS2)
DESTINATION ./)
install(FILES ${APP_DLLS_QT4_MSVC2010_IMAGEFORMATS}
DESTINATION ./imageformats)
install(FILES ${APP_DLLS_QT4_MSVC2010_SQLDRIVERS}
DESTINATION ./sqldrivers)
install(FILES ${APP_DLLS_QT4_MSVC2010}
DESTINATION ./${UPDATER_SUBFOLDER})

View File

@ -89,7 +89,7 @@ void FormUpdate::checkForUpdates() {
m_ui->m_lblAvailableRelease->setText(update.first.m_availableVersion);
m_ui->m_txtChanges->setText(update.first.m_changes);
if (update.first.m_availableVersion > APP_VERSION) {
if (update.first.m_availableVersion != APP_VERSION) {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok,
tr("New release available."),
tr("This is new version which can be\ndownloaded and installed."));
@ -140,7 +140,7 @@ void FormUpdate::saveUpdateFile(const QByteArray &file_contents) {
if (output_file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qDebug("Storing update file to temporary location '%s'.",
qPrintable(output_file_name));
qPrintable(QDir::toNativeSeparators(output_file.fileName())));
output_file.write(file_contents);
output_file.flush();

View File

@ -68,8 +68,9 @@ IconFactory *IconFactory::instance() {
void IconFactory::setupSearchPaths() {
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
qDebug("Available icon theme paths: %s.",
qPrintable(QIcon::themeSearchPaths().replaceInStrings(QRegExp("^|$"),
"\'").join(", ")));
qPrintable(QIcon::themeSearchPaths()
.replaceInStrings(QRegExp("^|$"), "\'")
.replaceInStrings(QRegExp("/"), QDir::separator()).join(", ")));
}
void IconFactory::setCurrentIconTheme(const QString &theme_name) {

View File

@ -26,8 +26,8 @@ IOFactory::IOFactory() {
}
bool IOFactory::removeDirectory(const QString& directory_name,
const QStringList& exception_file_list,
const QStringList& exception_folder_list) {
const QStringList& exception_file_list,
const QStringList& exception_folder_list) {
bool result = true;
QDir dir(directory_name);
@ -37,34 +37,48 @@ bool IOFactory::removeDirectory(const QString& directory_name,
QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
if (info.isDir()) {
if (!exception_folder_list.contains(info.fileName())) {
result &= removeDirectory(info.absoluteFilePath(), exception_file_list);
result &= removeDirectory(info.absoluteFilePath(), exception_file_list, exception_folder_list);
}
}
else if (!exception_file_list.contains(info.fileName())) {
result &= QFile::remove(info.absoluteFilePath());
if (!QFile::remove(info.absoluteFilePath())) {
result &= false;
qDebug("Failed to remove file \'%s\'.", qPrintable(QDir::toNativeSeparators(info.absoluteFilePath())));
}
else {
result &= true;
}
}
}
result &= dir.rmdir(directory_name);
if (dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files).isEmpty()) {
result &= dir.rmdir(directory_name);
}
}
return result;
}
bool IOFactory::copyDirectory(QString source, QString destination) {
QDir dir(source);
QDir dir_source(source);
if (!dir.exists()) {
if (!dir_source.exists()) {
return false;
}
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
QDir dir_destination(destination);
if (!dir_destination.exists()) {
dir_destination.mkpath(destination);
}
foreach (QString d, dir_source.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
QString dst_path = destination + QDir::separator() + d;
dir.mkpath(dst_path);
dir_source.mkpath(dst_path);
copyDirectory(source + QDir::separator() + d, dst_path);
}
foreach (QString f, dir.entryList(QDir::Files)) {
foreach (QString f, dir_source.entryList(QDir::Files)) {
QString original_file = source + QDir::separator() + f;
QString destination_file = destination + QDir::separator() + f;