Permalink
Browse files

Added:

    - New System Config interface;
    - Winetricks database cache;
    - Merge Wintricks core;
Fixed:
    - Error if Desktop path is empty;
  • Loading branch information...
1 parent c938c25 commit b6bce49aee96230c7ffa52f9941da79617d972f4 @brezerk committed Mar 4, 2012
View
@@ -1,12 +1,16 @@
Version 1.0
Added:
+ - Winetricks database cache;
+ - Merge Wintricks core;
+ - New System Config interface;
- Mac OS X support;
- Icon and Prefix sorting (name, date);
- Version string to About page;
- Handler for wrong URL in wine app db;
- Add Logging subsystem activation\deactivation button to Logging tab toolbar;
Fixed:
+ - Error is Desktop paths are empty;
- Desktop Paths are wrongly labeled [3491775];
- Win32 prefix creation while prefix directory exists;
- Unite Icon\Detail toolbar actions;
View
@@ -34,6 +34,16 @@
#define D_TREE_COLLAPSE 1
#define D_TREE_EXPAND 2
+#define D_PROVIDER_SYSTEM 1
+#define D_PROVIDER_WINETRICKS 2
+
+#define D_VIEW_MODE_ICON 0
+#define D_VIEW_MODE_LIST 1
+#define D_SORT_TYPE_BY_NAME_ASC 1
+#define D_SORT_TYPE_BY_NAME_DSC 2
+#define D_SORT_TYPE_BY_DATE_ASC 3
+#define D_SORT_TYPE_BY_DATE_DSC 4
+
#define APP_NAME "Q4Wine"
#define APP_SHORT_NAME "q4wine"
#define APP_WEBSITTE "q4wine.brezblock.org.ua"
@@ -58,7 +58,7 @@ bool DataBase::checkDb(){
QTextStream QErr(stderr);
QStringList tables;
- tables << "prefix" << "dir" << "icon" << "images" << "last_run_icon"<<"logging";
+ tables << "prefix" << "dir" << "icon" << "images" << "last_run_icon" << "logging" << "providers" << "sysconfig";
QSqlDatabase db = QSqlDatabase::database();
@@ -87,26 +87,68 @@ bool DataBase::checkDb(){
if (!query.exec())
return false;
query.clear();
- }
- if (table == "dir"){
+ } else if (table == "dir"){
if(!query.exec("CREATE TABLE dir (id INTEGER PRIMARY KEY, name TEXT, prefix_id NUMERIC);"))
return false;
- }
- if (table == "icon"){
+ } else if (table == "icon"){
if(!query.exec("CREATE TABLE icon (wrkdir TEXT, override TEXT, winedebug TEXT, useconsole NUMERIC, display TEXT, cmdargs TEXT, exec TEXT, icon_path TEXT, desc TEXT, desktop TEXT, nice TEXT, dir_id NUMERIC, id INTEGER PRIMARY KEY, name TEXT, prefix_id NUMERIC);"))
return false;
- }
- if (table == "images"){
+ } else if (table == "images"){
if(!query.exec("CREATE TABLE images (id INTEGER PRIMARY KEY, name TEXT, path TEXT);"))
return false;
- }
- if (table == "last_run_icon"){
+ } else if (table == "last_run_icon"){
if(!query.exec("CREATE TABLE last_run_icon (wrkdir TEXT, override TEXT, winedebug TEXT, useconsole NUMERIC, display TEXT, cmdargs TEXT, exec TEXT, desktop TEXT, nice TEXT, id INTEGER PRIMARY KEY);"))
return false;
- }
- if (table == "logging"){
+ } else if (table == "logging"){
if(!query.exec("CREATE TABLE logging (id INTEGER PRIMARY KEY, name TEXT, exit NUMERIC, stdout TEXT, prefix_id NUMERIC, date NUMERIC);"))
return false;
+ } else if (table == "providers"){
+ if(!query.exec("CREATE TABLE providers (id INTEGER PRIMARY KEY, name TEXT, icon TEXT);"))
+ return false;
+
+ query.prepare("INSERT INTO providers(id, name, icon) VALUES(NULL, :name, :icon);");
+ query.bindValue(":name", "System");
+ query.bindValue(":icon", "wine.png");
+ if (!query.exec())
+ return false;
+
+ query.bindValue(":name", "Winetricks");
+ query.bindValue(":icon", "regedit.png");
+ if (!query.exec())
+ return false;
+ } else if (table == "sysconfig"){
+ if(!query.exec("CREATE TABLE sysconfig (id INTEGER PRIMARY KEY, name TEXT, type TEXT, icon TEXT, desc TEXT, provider_id INTEGER);"))
+ return false;
+
+ // System items
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, NULL, :desc, 1);");
+ query.bindValue(":name", "%CREATE_FAKE%");
+ query.bindValue(":icon", "fakedrive-new.png");
+ query.bindValue(":desc", "%CREATE_FAKE_DESC%");
+ if (!query.exec())
+ return false;
+
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, NULL, :desc, 1);");
+ query.bindValue(":name", "%UPDATE_FAKE%");
+ query.bindValue(":icon", "fakedrive-update.png");
+ query.bindValue(":desc", "%UPDATE_FAKE_DESC%");
+ if (!query.exec())
+ return false;
+
+ // Wintricks base
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, NULL, :desc, 2);");
+ query.bindValue(":name", "%INSTALL_WINETRICKS%");
+ query.bindValue(":icon", "winetricks-install.png");
+ query.bindValue(":desc", "%UPDATE_WINETRICKS_DESC%");
+ if (!query.exec())
+ return false;
+
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, NULL, :desc, 2);");
+ query.bindValue(":name", "%REFRESH_WINETRICKS%");
+ query.bindValue(":icon", "folder-downloads.png");
+ query.bindValue(":desc", "%REFRESH_WINETRICKS_DESC%");
+ if (!query.exec())
+ return false;
}
}
}
@@ -30,13 +30,6 @@
#include <QDebug>
#include <QVariant>
-#define D_VIEW_MODE_ICON 0
-#define D_VIEW_MODE_LIST 1
-#define D_SORT_TYPE_BY_NAME_ASC 1
-#define D_SORT_TYPE_BY_NAME_DSC 2
-#define D_SORT_TYPE_BY_DATE_ASC 3
-#define D_SORT_TYPE_BY_DATE_DSC 4
-
/*!
* \class Icon
* \ingroup database
@@ -0,0 +1,127 @@
+/***************************************************************************
+ * Copyright (C) 2008, 2009, 2010, 2011 by Malakhov Alexey *
+ * brezerk@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 3 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. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
+ * *
+ ***************************************************************************/
+
+#include "sysconfig.h"
+
+Sysconfig::Sysconfig()
+{
+
+}
+
+QList<ProviderItem> Sysconfig::getProviders(void) const{
+ QList<ProviderItem> providers;
+ QSqlQuery query;
+ query.prepare("SELECT id, name, icon FROM providers");
+
+ if (query.exec()){
+ while (query.next()) {
+ ProviderItem provider;
+ provider.id = query.value(0).toInt();
+ provider.name = query.value(1).toString();
+ provider.icon = query.value(2).toString();
+ providers.append(provider);
+ }
+ }
+ query.clear();
+ return providers;
+}
+
+QStringList Sysconfig::getProviderSubtypes(int provider_id) const{
+ QStringList subtypes;
+ QSqlQuery query;
+ query.prepare("SELECT type FROM sysconfig WHERE provider_id=:provider_id GROUP BY type");
+ query.bindValue(":provider_id", provider_id);
+ if (query.exec()){
+ while (query.next()) {
+ subtypes.append(query.value(0).toString());
+ }
+ }
+ query.clear();
+ return subtypes;
+}
+
+QList<SysconfigItem> Sysconfig::getItems(QString provider, QString type, int sort_order, QString filter) const{
+ QList<SysconfigItem> items;
+ QSqlQuery query;
+ QString sql, order;
+
+ if (sort_order == D_SORT_TYPE_BY_NAME_ASC){
+ order = " ORDER BY name ASC ";
+ } else if (sort_order == D_SORT_TYPE_BY_NAME_DSC){
+ order = " ORDER BY name DESC ";
+ }
+
+ if (type.isEmpty()){
+ if (filter.isEmpty()){
+ sql = "SELECT id, name, icon, desc FROM sysconfig WHERE provider_id=(SELECT id FROM providers WHERE name=:provider) AND type IS NULL";
+ } else {
+ sql = QString("SELECT id, name, icon, desc FROM sysconfig WHERE provider_id=(SELECT id FROM providers WHERE name=:provider) AND type IS NULL AND name LIKE \"%%1%\"").arg(filter);
+ }
+ sql.append(order);
+ query.prepare(sql);
+ } else {
+ if (filter.isEmpty()){
+ sql = "SELECT id, name, icon, desc FROM sysconfig WHERE provider_id=(SELECT id FROM providers WHERE name=:provider) AND type=:type";
+ } else {
+ sql = QString("SELECT id, name, icon, desc FROM sysconfig WHERE provider_id=(SELECT id FROM providers WHERE name=:provider) AND type=:type AND name LIKE \"%%1%\"").arg(filter);
+ }
+ sql.append(order);
+ query.prepare(sql);
+ query.bindValue(":type", type);
+ }
+ query.bindValue(":provider", provider);
+ if (query.exec()){
+ while (query.next()) {
+ SysconfigItem item;
+ item.id = query.value(0).toInt();
+ item.name = query.value(1).toString();
+ item.icon = query.value(2).toString();
+ item.desc = query.value(3).toString();
+ items.append(item);
+ }
+ }
+ query.clear();
+ return items;
+}
+
+bool Sysconfig::add_item(QString name, QString icon, QString desc, QString type, int provider_id){
+ QSqlQuery query;
+ if (type.isEmpty()){
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, NULL, :desc, :provider);");
+ } else {
+ query.prepare("INSERT INTO sysconfig(id, name, icon, type, desc, provider_id) VALUES(NULL, :name, :icon, :type, :desc, :provider);");
+ query.bindValue(":type", type);
+ }
+ query.bindValue(":name", name);
+ query.bindValue(":icon", icon);
+ query.bindValue(":desc", desc);
+ query.bindValue(":provider_id", provider_id);
+ if (!query.exec())
+ return false;
+ return true;
+}
+
+bool Sysconfig::drop_items(int provider_id){
+ QSqlQuery query;
+ query.prepare("DELETE FROM sysconfig WHERE provider_id=:provider_id AND type IS NOT NULL");
+ query.bindValue(":provider_id", provider_id);
+ if (!query.exec())
+ return false;
+ return true;
+}
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * Copyright (C) 2008, 2009, 2010, 2011 by Malakhov Alexey *
+ * brezerk@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 3 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. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
+ * *
+ ***************************************************************************/
+
+#ifndef SYSCONFIG_H
+#define SYSCONFIG_H
+
+#include <config.h>
+
+#include <memory>
+
+#include <QList>
+#include <QString>
+#include <QStringList>
+#include <QSqlQuery>
+#include <QSqlError>
+#include <QDebug>
+#include <QDir>
+#include <QVariant>
+#include <QSettings>
+
+/*!
+ * \class Sysconfig
+ * \ingroup database
+ * \brief This class provide database functions for sysconfig table.
+ *
+ */
+struct ProviderItem {
+ int id;
+ QString name;
+ QString icon;
+};
+
+struct SysconfigItem {
+ int id;
+ QString name;
+ QString icon;
+ QString type;
+ QString desc;
+ int provider_id;
+};
+
+class Sysconfig
+{
+
+ public:
+ /*! \brief This is calss constructor.
+ */
+ Sysconfig();
+
+ QList<ProviderItem> getProviders(void) const;
+ QStringList getProviderSubtypes(int provider_id) const;
+ QList<SysconfigItem> getItems(QString provider, QString type, int sort_order, QString filter) const;
+ bool add_item(QString name, QString icon, QString desc, QString type, int provider_id);
+ bool drop_items(int provider_id);
+
+protected:
+ /*! \brief This function executes requested query.
+ *
+ * \param SQL Query
+ * \return Return true on success
+ */
+ bool updateQuery(QSqlQuery *sqlQuery) const;
+
+};
+
+#endif // SYSCONFIG_H
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -4,14 +4,10 @@ SET ( PLUGINS_GUI_MOC_HEADEDRS
${CMAKE_SOURCE_DIR}/src/plugins/winetricks.h
)
-SET ( PLUGINS_GUI_UI_SOURCES
- ${CMAKE_SOURCE_DIR}/src/plugins/winetricks.ui
-)
-
SET( PLUGINS_GUI_SOURCES
${CMAKE_SOURCE_DIR}/src/plugins/winetricks.cpp
)
SET ( PLUGINS_GUI_HEADERS
${CMAKE_SOURCE_DIR}/src/plugins/winetricks.h
-)
+)
Oops, something went wrong.

0 comments on commit b6bce49

Please sign in to comment.