Commit a4a235c8 authored by Dennis Rassmann's avatar Dennis Rassmann

add check for update & autoupdate skeleton

Signed-off-by: Dennis Rassmann's avatarshowp1984 <showp1984@gmail.com>
parent d3aa57c4
......@@ -16,50 +16,52 @@ SOURCES += main.cpp \
info.cpp \
detect.cpp \
flasher.cpp \
openfile.cpp
openfile.cpp \
update_notif.cpp \
database.cpp
HEADERS += mainwindow.h \
dragons.h \
info.h \
detect.h \
flasher.h \
openfile.h
openfile.h \
update_notif.h
FORMS += mainwindow.ui \
dragons.ui \
info.ui \
detect.ui \
flasher.ui \
openfile.ui
openfile.ui \
update_notif.ui
RESOURCES += res/res_loc.qrc
unix {
SOURCES += quazip/unzip.c \
quazip/zip.c \
quazip/JlCompress.cpp \
quazip/qioapi.cpp \
quazip/quaadler32.cpp \
quazip/quacrc32.cpp \
quazip/quazip.cpp \
quazip/quazipfile.cpp \
quazip/quazipnewinfo.cpp
HEADERS += quazip/crypt.h \
quazip/ioapi.h \
quazip/JlCompress.h \
quazip/quaadler32.h \
quazip/quachecksum32.h \
quazip/quacrc32.h \
quazip/quazipfile.h \
quazip/quazipfileinfo.h \
quazip/quazip_global.h \
quazip/quazip.h \
quazip/quazipnewinfo.h \
quazip/unzip.h \
quazip/zip.h
unix {
SOURCES += quazip/unzip.c \
quazip/zip.c \
quazip/JlCompress.cpp \
quazip/qioapi.cpp \
quazip/quaadler32.cpp \
quazip/quacrc32.cpp \
quazip/quazip.cpp \
quazip/quazipfile.cpp \
quazip/quazipnewinfo.cpp
HEADERS += quazip/crypt.h \
quazip/ioapi.h \
quazip/JlCompress.h \
quazip/quaadler32.h \
quazip/quachecksum32.h \
quazip/quacrc32.h \
quazip/quazipfile.h \
quazip/quazipfileinfo.h \
quazip/quazip_global.h \
quazip/quazip.h \
quazip/quazipnewinfo.h \
quazip/unzip.h \
quazip/zip.h
}
win32 {
win32 {
INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
DEFINES += QUAZIP_BUILD
CONFIG(staticlib): DEFINES += QUAZIP_STATIC
CONFIG(staticlib):DEFINES += QUAZIP_STATIC
LIBS += -Lquazip/libs
LIBS += -lquazip
}
......@@ -50,7 +50,7 @@
</data>
<data>
<variable>activebuildconfiguration</variable>
<value type="QString">Debug</value>
<value type="QString">Release</value>
</data>
<data>
<variable>buildConfiguration-Debug</variable>
......@@ -218,18 +218,142 @@
<variable>buildconfiguration-Release-buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-daaW22EhEn,guid=ac9d1ad5f8bfb833a93e21cc4ff0530e</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=de</value>
<value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-JbhyRt</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/showp1984</value>
<value type="QString">LANG=en_US.utf8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=showp1984</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-showp1984</value>
<value type="QString">PATH=/usr/bin:/home/showp1984/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/showp1984</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/jarvis:@/tmp/.ICE-unix/1496,unix/jarvis:/tmp/.ICE-unix/1496</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1530</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-JbhyRt/ssh</value>
<value type="QString">USER=showp1984</value>
<value type="QString">USERNAME=showp1984</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-showp1984-Rqzu0R/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=974fcb0734e21cc3b1c41ff34e9d5403-1341149966.587519-994636315</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/showp1984/_android/WORKDIRECTORY/Kernel_installer_Qt/Bricked-Installer/Bricked-Installer.pro</value>
<value type="QString">-spec</value>
<value type="QString">linux-g++</value>
<value type="QString">-r</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
<value key="abstractProcess.enabled" type="bool">false</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/showp1984/_android/WORKDIRECTORY/Kernel_installer_Qt/Bricked-Installer</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-daaW22EhEn,guid=ac9d1ad5f8bfb833a93e21cc4ff0530e</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=de</value>
<value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-JbhyRt</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/showp1984</value>
<value type="QString">LANG=en_US.utf8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=showp1984</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-showp1984</value>
<value type="QString">PATH=/usr/bin:/home/showp1984/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/showp1984</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/jarvis:@/tmp/.ICE-unix/1496,unix/jarvis:/tmp/.ICE-unix/1496</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1530</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-JbhyRt/ssh</value>
<value type="QString">USER=showp1984</value>
<value type="QString">USERNAME=showp1984</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-showp1984-Rqzu0R/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=974fcb0734e21cc3b1c41ff34e9d5403-1341149966.587519-994636315</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/showp1984/_android/WORKDIRECTORY/Kernel_installer_Qt/Bricked-Installer</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-daaW22EhEn,guid=ac9d1ad5f8bfb833a93e21cc4ff0530e</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=de</value>
<value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-JbhyRt</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/showp1984</value>
<value type="QString">LANG=en_US.utf8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=showp1984</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-showp1984</value>
<value type="QString">PATH=/usr/bin:/home/showp1984/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/showp1984</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/jarvis:@/tmp/.ICE-unix/1496,unix/jarvis:/tmp/.ICE-unix/1496</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1530</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-JbhyRt/ssh</value>
<value type="QString">USER=showp1984</value>
<value type="QString">USERNAME=showp1984</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-showp1984-Rqzu0R/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=974fcb0734e21cc3b1c41ff34e9d5403-1341149966.587519-994636315</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">true</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">clean</value>
<value type="QString">-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/showp1984/_android/WORKDIRECTORY/Kernel_installer_Qt/Bricked-Installer</value>
<value key="cleanConfig" type="bool">true</value>
<valuelist key="makeargs" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
</valuemap>
</data>
<data>
......
#############################################################################
# Makefile for building: Bricked-Installer
# Generated by qmake (2.01a) (Qt 4.6.2) on: Tue Jul 3 21:37:29 2012
# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Jul 6 04:08:17 2012
# Project: Bricked-Installer.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix -o Makefile Bricked-Installer.pro
......@@ -50,6 +50,8 @@ SOURCES = main.cpp \
detect.cpp \
flasher.cpp \
openfile.cpp \
update_notif.cpp \
database.cpp \
quazip/unzip.c \
quazip/zip.c \
quazip/JlCompress.cpp \
......@@ -64,6 +66,7 @@ SOURCES = main.cpp \
moc_detect.cpp \
moc_flasher.cpp \
moc_openfile.cpp \
moc_update_notif.cpp \
moc_quazipfile.cpp \
qrc_res_loc.cpp
OBJECTS = main.o \
......@@ -73,6 +76,8 @@ OBJECTS = main.o \
detect.o \
flasher.o \
openfile.o \
update_notif.o \
database.o \
unzip.o \
zip.o \
JlCompress.o \
......@@ -88,6 +93,7 @@ OBJECTS = main.o \
moc_detect.o \
moc_flasher.o \
moc_openfile.o \
moc_update_notif.o \
moc_quazipfile.o \
qrc_res_loc.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
......@@ -138,7 +144,7 @@ first: all
all: Makefile $(TARGET)
$(TARGET): ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h $(OBJECTS)
$(TARGET): ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h ui_update_notif.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: Bricked-Installer.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
......@@ -191,7 +197,7 @@ qmake: FORCE
dist:
@$(CHK_DIR_EXISTS) .tmp/Bricked-Installer0.1 || $(MKDIR) .tmp/Bricked-Installer0.1
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents mainwindow.h dragons.h info.h detect.h flasher.h openfile.h quazip/crypt.h quazip/ioapi.h quazip/JlCompress.h quazip/quaadler32.h quazip/quachecksum32.h quazip/quacrc32.h quazip/quazipfile.h quazip/quazipfileinfo.h quazip/quazip_global.h quazip/quazip.h quazip/quazipnewinfo.h quazip/unzip.h quazip/zip.h .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents res/res_loc.qrc .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp dragons.cpp info.cpp detect.cpp flasher.cpp openfile.cpp quazip/unzip.c quazip/zip.c quazip/JlCompress.cpp quazip/qioapi.cpp quazip/quaadler32.cpp quazip/quacrc32.cpp quazip/quazip.cpp quazip/quazipfile.cpp quazip/quazipnewinfo.cpp .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents mainwindow.ui dragons.ui info.ui detect.ui flasher.ui openfile.ui .tmp/Bricked-Installer0.1/ && (cd `dirname .tmp/Bricked-Installer0.1` && $(TAR) Bricked-Installer0.1.tar Bricked-Installer0.1 && $(COMPRESS) Bricked-Installer0.1.tar) && $(MOVE) `dirname .tmp/Bricked-Installer0.1`/Bricked-Installer0.1.tar.gz . && $(DEL_FILE) -r .tmp/Bricked-Installer0.1
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents mainwindow.h dragons.h info.h detect.h flasher.h openfile.h update_notif.h quazip/crypt.h quazip/ioapi.h quazip/JlCompress.h quazip/quaadler32.h quazip/quachecksum32.h quazip/quacrc32.h quazip/quazipfile.h quazip/quazipfileinfo.h quazip/quazip_global.h quazip/quazip.h quazip/quazipnewinfo.h quazip/unzip.h quazip/zip.h .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents res/res_loc.qrc .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp dragons.cpp info.cpp detect.cpp flasher.cpp openfile.cpp update_notif.cpp database.cpp quazip/unzip.c quazip/zip.c quazip/JlCompress.cpp quazip/qioapi.cpp quazip/quaadler32.cpp quazip/quacrc32.cpp quazip/quazip.cpp quazip/quazipfile.cpp quazip/quazipnewinfo.cpp .tmp/Bricked-Installer0.1/ && $(COPY_FILE) --parents mainwindow.ui dragons.ui info.ui detect.ui flasher.ui openfile.ui update_notif.ui .tmp/Bricked-Installer0.1/ && (cd `dirname .tmp/Bricked-Installer0.1` && $(TAR) Bricked-Installer0.1.tar Bricked-Installer0.1 && $(COMPRESS) Bricked-Installer0.1.tar) && $(MOVE) `dirname .tmp/Bricked-Installer0.1`/Bricked-Installer0.1.tar.gz . && $(DEL_FILE) -r .tmp/Bricked-Installer0.1
clean:compiler_clean
......@@ -210,9 +216,9 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_mainwindow.cpp moc_dragons.cpp moc_info.cpp moc_detect.cpp moc_flasher.cpp moc_openfile.cpp moc_quazipfile.cpp
compiler_moc_header_make_all: moc_mainwindow.cpp moc_dragons.cpp moc_info.cpp moc_detect.cpp moc_flasher.cpp moc_openfile.cpp moc_update_notif.cpp moc_quazipfile.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp moc_dragons.cpp moc_info.cpp moc_detect.cpp moc_flasher.cpp moc_openfile.cpp moc_quazipfile.cpp
-$(DEL_FILE) moc_mainwindow.cpp moc_dragons.cpp moc_info.cpp moc_detect.cpp moc_flasher.cpp moc_openfile.cpp moc_update_notif.cpp moc_quazipfile.cpp
moc_mainwindow.cpp: info.h \
detect.h \
openfile.h \
......@@ -246,6 +252,9 @@ moc_openfile.cpp: info.h \
openfile.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) openfile.h -o moc_openfile.cpp
moc_update_notif.cpp: update_notif.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) update_notif.h -o moc_update_notif.cpp
moc_quazipfile.cpp: quazip/quazip_global.h \
quazip/quazip.h \
quazip/zip.h \
......@@ -268,9 +277,9 @@ compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h
compiler_uic_make_all: ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h ui_update_notif.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h
-$(DEL_FILE) ui_mainwindow.h ui_dragons.h ui_info.h ui_detect.h ui_flasher.h ui_openfile.h ui_update_notif.h
ui_mainwindow.h: mainwindow.ui
/usr/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
......@@ -289,6 +298,9 @@ ui_flasher.h: flasher.ui
ui_openfile.h: openfile.ui
/usr/bin/uic-qt4 openfile.ui -o ui_openfile.h
ui_update_notif.h: update_notif.ui
/usr/bin/uic-qt4 update_notif.ui -o ui_update_notif.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
......@@ -299,7 +311,8 @@ compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_uic_clean
####### Compile
main.o: main.cpp dragons.h \
main.o: main.cpp update_notif.h \
dragons.h \
mainwindow.h \
info.h \
detect.h \
......@@ -357,6 +370,13 @@ openfile.o: openfile.cpp openfile.h \
ui_openfile.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o openfile.o openfile.cpp
update_notif.o: update_notif.cpp update_notif.h \
ui_update_notif.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o update_notif.o update_notif.cpp
database.o: database.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o database.o database.cpp
unzip.o: quazip/unzip.c quazip/unzip.h \
quazip/ioapi.h \
quazip/crypt.h \
......@@ -434,6 +454,9 @@ moc_flasher.o: moc_flasher.cpp
moc_openfile.o: moc_openfile.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_openfile.o moc_openfile.cpp
moc_update_notif.o: moc_update_notif.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_update_notif.o moc_update_notif.cpp
moc_quazipfile.o: moc_quazipfile.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_quazipfile.o moc_quazipfile.cpp
......
/*
* database.cpp
*
* Copyright (c) 2012, Dennis Rassmann <showp1984@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QDebug>
QSqlDatabase connectDB(void) {
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
/* I won't give you my login data here :p */
db.setHostName("111.222.33.44");
db.setDatabaseName("dbstuffz");
db.setUserName("supersecretlogin");
db.setPassword("supersecretpw");
if (!db.open()) qDebug() << "Failed to connect to database";
return db;
}
void closeDB(QSqlDatabase db) {
db.close();
}
......@@ -18,17 +18,18 @@
#include <iostream>
#include <QtGui/QApplication>
#include <QTimer>
#include <QDebug>
#include "dragons.h"
#include "update_notif.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
update_notif un;
a.setApplicationVersion(APP_VERSION);
dragons d;
d.show();
un.show();
return a.exec();
}
/*
* update_notif.cpp
*
* Copyright (c) 2012, Dennis Rassmann <showp1984@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <QDebug>
#include <QTimer>
#include "update_notif.h"
#include "ui_update_notif.h"
extern QSqlDatabase connectDB(void);
extern void closeDB(QSqlDatabase);
update_notif::update_notif(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::update_notif)
{
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(closeupdnot()));
ui->setupUi(this);
timer->setSingleShot(true);
timer->setInterval(0);
timer->start();
}
update_notif::~update_notif()
{
delete timer;
delete ui;
}
void update_notif::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void update_notif::closeupdnot(void)
{
float version = 0;
QSqlDatabase db = connectDB();
QSqlQuery query;
QString branch;
QString changelog;
QString date;
QString url;
QString ver;
qDebug() << "Local: " << qApp->applicationVersion();
query.prepare("SELECT version, branch, changelog, date, url FROM versions WHERE version = (SELECT MAX(version) FROM versions) AND version > " + qApp->applicationVersion());
query.exec();
while (query.next()) {
version = query.value(0).toFloat();
branch = query.value(1).toString();
changelog = query.value(2).toString();
date = query.value(3).toString();
url = query.value(4).toString();
qDebug() << version << branch << date << url;// << changelog;
}
if (version > qApp->applicationVersion().toFloat()) {
qDebug() << "Update found!";
ver = QString::number(version);
ui->lbl_edt_vers->setText(ver);
ui->lbl_edt_branch->setText(branch);
ui->lbl_edt_date->setText(date);
ui->txt_change->setText(changelog);
url = url;
} else {
qDebug() << "No update found.";
closeDB(db);
this->close();
d = new dragons();
d->show();
}
closeDB(db);
}
void update_notif::on_btn_quit_clicked()
{
this->close();
}
void update_notif::on_btn_later_clicked()
{
this->close();
d = new dragons();
d->show();
}
/*
* update_notif.h
*
* Copyright (c) 2012, Dennis Rassmann <showp1984@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef UPDATE_NOTIF_H
#define UPDATE_NOTIF_H
#include <QMainWindow>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "dragons.h"
namespace Ui {
class update_notif;
}
class update_notif : public QMainWindow {
Q_OBJECT
public:
update_notif(QWidget *parent = 0);
~update_notif();
protected:
void changeEvent(QEvent *e);
private:
Ui::update_notif *ui;
dragons *d;
QTimer *timer;
QString url;
private slots:
void on_btn_later_clicked();
void on_btn_quit_clicked();
void closeupdnot(void);
};
#endif // UPDATE_NOTIF_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>update_notif</class>
<widget class="QMainWindow" name="update_notif">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>730</width>
<height>516</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>730</width>
<height>516</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>730</width>
<height>516</height>
</size>
</property>
<property name="windowTitle">
<string>Auto-Updater</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="lbl_updnot">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>401</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>There is an update available for this program.</string>
</property>
</widget>
<widget class="QLabel" name="lbl_vers">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>61</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Version:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="lbl_branch">
<property name="geometry">
<rect>
<x>30</x>
<y>60</y>
<width>62</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Branch:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="lbl_date">
<property name="geometry">
<rect>
<x>30</x>
<y>80</y>
<width>62</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Date:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="lbl_change">
<property name="geometry">
<rect>
<x>30</x>
<y>100</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Changelog:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QLabel" name="lbl_edt_vers">
<property name="geometry">
<rect>
<x>430</x>
<y>40</y>
<width>271</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
<widget class="QLabel" name="lbl_edt_branch">
<property name="geometry">
<rect>
<x>430</x>
<y>60</y>
<width>271</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
<widget class="QLabel" name="lbl_edt_date">
<property name="geometry">
<rect>
<x>430</x>
<y>80</y>
<width>271</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
<widget class="QTextEdit" name="txt_change">
<property name="geometry">
<rect>
<x>30</x>
<y>120</y>
<width>671</width>
<height>351</height>
</rect>
</property>