├── CMakeLists.txt ├── COPYING ├── README ├── changelog ├── cmake_uninstall.cmake.in ├── config.h.in ├── debian ├── changelog ├── compat ├── control ├── copyright ├── patches │ ├── 00list │ ├── 01su-to-root.dpatch │ ├── 02_gtkmm24.dpatch │ └── 03_libarchive_old.dpatch ├── rules ├── source │ └── format └── watch ├── misc ├── grub-customizer.desktop ├── icons │ ├── 128x128.png │ ├── 14x14.png │ ├── 16x16.png │ ├── 192x192.png │ ├── 22x22.png │ ├── 24x24.png │ ├── 32x32.png │ ├── 48x48.png │ └── 64x64.png ├── manpage.gz └── pkexec_policy.in ├── src ├── Controller │ ├── AboutController.h │ ├── AboutControllerImpl.cpp │ ├── AboutControllerImpl.h │ ├── ControllerAbstract.cpp │ ├── ControllerAbstract.h │ ├── ControllerCollection.h │ ├── EntryEditController.h │ ├── EntryEditControllerImpl.cpp │ ├── EntryEditControllerImpl.h │ ├── EnvEditorController.h │ ├── EnvEditorControllerImpl.cpp │ ├── EnvEditorControllerImpl.h │ ├── ErrorController.h │ ├── ErrorControllerImpl.cpp │ ├── ErrorControllerImpl.h │ ├── GLib │ │ ├── ThreadController.cpp │ │ └── ThreadController.h │ ├── Helper │ │ ├── DeviceInfo.cpp │ │ └── DeviceInfo.h │ ├── InstallerController.h │ ├── InstallerControllerImpl.cpp │ ├── InstallerControllerImpl.h │ ├── MainController.h │ ├── MainControllerImpl.cpp │ ├── MainControllerImpl.h │ ├── SettingsController.h │ ├── SettingsControllerImpl.cpp │ ├── SettingsControllerImpl.h │ ├── ThemeController.h │ ├── ThemeControllerImpl.cpp │ ├── ThemeControllerImpl.h │ ├── ThreadController.h │ ├── Trait │ │ ├── ControllerAware.h │ │ └── ThreadControllerAware.h │ ├── TrashController.h │ ├── TrashControllerImpl.cpp │ └── TrashControllerImpl.h ├── Mapper │ ├── EntryName.h │ ├── EntryNameImpl.cpp │ └── EntryNameImpl.h ├── Model │ ├── DeviceDataList.cpp │ ├── DeviceDataList.h │ ├── DeviceDataListInterface.h │ ├── DeviceMap.cpp │ ├── DeviceMap.h │ ├── Entry.cpp │ ├── Entry.h │ ├── EntryPathBuilder.h │ ├── EntryPathBuilderImpl.cpp │ ├── EntryPathBuilderImpl.h │ ├── EntryPathFollower.h │ ├── Env.cpp │ ├── Env.h │ ├── FbResolutionsGetter.cpp │ ├── FbResolutionsGetter.h │ ├── Installer.cpp │ ├── Installer.h │ ├── ListCfg.cpp │ ├── ListCfg.h │ ├── MountTable.cpp │ ├── MountTable.h │ ├── Proxy.cpp │ ├── Proxy.h │ ├── ProxyScriptData.cpp │ ├── ProxyScriptData.h │ ├── Proxylist.cpp │ ├── Proxylist.h │ ├── PscriptnameTranslator.cpp │ ├── PscriptnameTranslator.h │ ├── Repository.cpp │ ├── Repository.h │ ├── Rule.cpp │ ├── Rule.h │ ├── Script.cpp │ ├── Script.h │ ├── ScriptSourceMap.cpp │ ├── ScriptSourceMap.h │ ├── SettingsManagerData.cpp │ ├── SettingsManagerData.h │ ├── SettingsStore.cpp │ ├── SettingsStore.h │ ├── SmartFileHandle.cpp │ ├── SmartFileHandle.h │ ├── Theme.cpp │ ├── Theme.h │ ├── ThemeFile.cpp │ ├── ThemeFile.h │ ├── ThemeManager.cpp │ └── ThemeManager.h ├── View │ ├── About.h │ ├── ColorChooser.h │ ├── EntryEditor.h │ ├── EnvEditor.h │ ├── Error.h │ ├── Gtk │ │ ├── About.cpp │ │ ├── About.h │ │ ├── Element │ │ │ ├── List.h │ │ │ ├── PartitionChooser.cpp │ │ │ └── PartitionChooser.h │ │ ├── EntryEditor.cpp │ │ ├── EntryEditor.h │ │ ├── EnvEditor.cpp │ │ ├── EnvEditor.h │ │ ├── Error.cpp │ │ ├── Error.h │ │ ├── Installer.cpp │ │ ├── Installer.h │ │ ├── Main.cpp │ │ ├── Main.h │ │ ├── Settings.cpp │ │ ├── Settings.h │ │ ├── Theme.cpp │ │ ├── Theme.h │ │ ├── Trash.cpp │ │ └── Trash.h │ ├── Installer.h │ ├── Main.h │ ├── Model │ │ └── ListItem.h │ ├── Settings.h │ ├── Theme.h │ ├── Trait │ │ └── ViewAware.h │ └── Trash.h ├── lib │ ├── ArrayStructure.cpp │ ├── ArrayStructure.h │ ├── ContentParser.h │ ├── ContentParser │ │ ├── Abstract.cpp │ │ ├── Abstract.h │ │ ├── Chainloader.cpp │ │ ├── Chainloader.h │ │ ├── FactoryImpl.cpp │ │ ├── FactoryImpl.h │ │ ├── Linux.cpp │ │ ├── Linux.h │ │ ├── LinuxIso.cpp │ │ ├── LinuxIso.h │ │ ├── Memtest.cpp │ │ └── Memtest.h │ ├── ContentParserFactory.h │ ├── Exception.cpp │ ├── Exception.h │ ├── FileSystem.cpp │ ├── FileSystem.h │ ├── Logger.h │ ├── Logger │ │ ├── Stream.cpp │ │ └── Stream.h │ ├── Mutex.h │ ├── Mutex │ │ ├── GLib.cpp │ │ └── GLib.h │ ├── Trait │ │ ├── ActionLoggerAware.h │ │ └── LoggerAware.h │ ├── Type.h │ ├── assert.cpp │ ├── assert.h │ ├── csv.cpp │ ├── csv.h │ ├── md5.cpp │ ├── md5.h │ ├── regex.cpp │ ├── regex.h │ ├── str_replace.cpp │ ├── str_replace.h │ ├── trim.cpp │ └── trim.h └── main │ ├── gtk-client.cpp │ └── proxy.cpp └── translation ├── compile_all.sh ├── translation-ar.mo ├── translation-ar.po ├── translation-ast.mo ├── translation-ast.po ├── translation-bg.mo ├── translation-bg.po ├── translation-bs.mo ├── translation-bs.po ├── translation-ca.mo ├── translation-ca.po ├── translation-cs.mo ├── translation-cs.po ├── translation-cy.mo ├── translation-cy.po ├── translation-de.mo ├── translation-de.po ├── translation-el.mo ├── translation-el.po ├── translation-en_GB.mo ├── translation-en_GB.po ├── translation-es.mo ├── translation-es.po ├── translation-et.mo ├── translation-et.po ├── translation-eu.mo ├── translation-eu.po ├── translation-fi.mo ├── translation-fi.po ├── translation-fr.mo ├── translation-fr.po ├── translation-gl.mo ├── translation-gl.po ├── translation-hr.mo ├── translation-hr.po ├── translation-hu.mo ├── translation-hu.po ├── translation-it.mo ├── translation-it.po ├── translation-ja.mo ├── translation-ja.po ├── translation-kk.mo ├── translation-kk.po ├── translation-lt.mo ├── translation-lt.po ├── translation-nl.mo ├── translation-nl.po ├── translation-pl.mo ├── translation-pl.po ├── translation-pt_BR.mo ├── translation-pt_BR.po ├── translation-ru.mo ├── translation-ru.po ├── translation-sk.mo ├── translation-sk.po ├── translation-tr.mo ├── translation-tr.po ├── translation-uk.mo ├── translation-uk.po ├── translation-vi.mo ├── translation-vi.po ├── translation-zh_CN.mo ├── translation-zh_CN.po ├── translation-zh_TW.mo ├── translation-zh_TW.po └── translation.pot /README: -------------------------------------------------------------------------------- 1 | If you are not using Ubuntu (or one of its derivates) you cannot use the ppa to install Grub Customizer. To install it anyway, you have to download and compile the sources. All the following lines starting with $ are shell commands - open a terminal and execute them (but don't copy the $ ;-) )! 2 | 3 | Make sure your grub2 contains the grub-mkconfig script (included since version 1.97). 4 | 5 | # step one: Install these packages: 6 | 7 | * cmake 8 | * g++ OR gcc-c++ 9 | * libgtkmm-3.0-dev OR gtkmm30-devel [when using the gtk-2 version you need libgtkmm-2.4-dev OR gtkmm24-devel] 10 | * gettext 11 | * libssl-dev OR openssl-devel 12 | * libarchive-dev OR libarchive-devel 13 | 14 | (The package names may be different, depending on the distribution they are using on) 15 | 16 | # step two: download the sources: 17 | 18 | download the tar.gz-package here: https://launchpad.net/grub-customizer/+download 19 | …and extract its contents. 20 | 21 | # step three: compile the sources: 22 | 23 | Go into the source directory extracted from the tar.gz file, then run 24 | 25 | $ cmake . && make 26 | 27 | If you get a cmake version error, try to set the "cmake_minimum_required" value to your installed version - I only written down the lowest tested version, so older versions may be compatible too. 28 | 29 | # step four: install some (optional) runtime dependencies: 30 | 31 | * hwinfo 32 | 33 | # step five: install Grub Customizer 34 | 35 | $ sudo make install 36 | 37 | Then you can start Grub Customizer using the menu or by running `gksu grub-customizer` / `sudo grub-customizer` 38 | 39 | On some distributions, this may fail ("bootloader not found"), because some of the commands / directories doesn't exist on the expected names. Please make sure, these commands are accessible: 40 | 41 | grub-mkconfig 42 | grub-install 43 | 44 | and these pathes/files: 45 | 46 | /etc/grub.d 47 | /boot/grub 48 | /boot/grub/grub.cfg 49 | /etc/default/grub 50 | 51 | If not, there may be alternative commands/pathes, if Grub2 is installed. Please try to find them out and create a config file at /etc/grub-customizer/grub.cfg containing this content (the values of this example are valid on fedora 16 - change them, if they are different): 52 | 53 | MKCONFIG_CMD=grub2-mkconfig 54 | INSTALL_CMD=grub2-install 55 | MKFONT_CMD=grub2-mkfont 56 | CFG_DIR=/etc/grub.d 57 | OUTPUT_DIR=/boot/grub2 58 | OUTPUT_FILE=/boot/grub2/grub.cfg 59 | SETTINGS_FILE=/etc/default/grub 60 | DEVICEMAP_FILE="/boot/grub2/device.map" 61 | MKDEVICEMAP_CMD="grub2-mkdevicemap --device-map=/dev/stdout" -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach (file ${files}) 8 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 9 | if (EXISTS "$ENV{DESTDIR}${file}") 10 | execute_process( 11 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" 12 | OUTPUT_VARIABLE rm_out 13 | RESULT_VARIABLE rm_retval 14 | ) 15 | if(NOT ${rm_retval} EQUAL 0) 16 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif (NOT ${rm_retval} EQUAL 0) 18 | else (EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 20 | endif (EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | 23 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #define BINDIR "${BINARY_INSTALL_DIR}" 2 | #define LIBDIR "${LIB_INSTALL_DIR}" 3 | #define LOCALEDIR "${LOCALE_INSTALL_DIR}" 4 | #define PARTCHOOSER_MOUNTPOINT "${PARTCHOOSER_MOUNTPOINT_DIR}" 5 | #define ERROR_LOG_FILE "${ERROR_LOG_FILE}" 6 | #define CUSTOM_SCRIPT_SHEBANG "#!/bin/sh" 7 | #define CUSTOM_SCRIPT_PREFIX "exec tail -n +3 $0" 8 | #define GC_VERSION "4.0.6" 9 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: grub-customizer 2 | Section: admin 3 | Priority: optional 4 | Maintainer: SteamOS-Tools Signing Key 5 | XSBC-Original-Maintainer: Daniel Richter 6 | Build-Depends: debhelper (>= 7.3), libgtkmm-3.0-dev (>= 2.20.0), libssl-dev, cmake (>=2.6.2), gettext (>=0.17), dpatch, libarchive-dev 7 | Standards-Version: 3.9.2 8 | Homepage: https://launchpad.net/grub-customizer 9 | 10 | Package: grub-customizer 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends}, policykit-1 13 | Recommends: hwinfo 14 | Description: Grub Customizer - A graphical Grub2/BURG configuration application 15 | Grub Customizer is a graphical configuration tool to modify the grub2/burg 16 | settings with focus on the individual list order - without losing the 17 | dynamical behavior of grub - also usable on live cds. 18 | Settings like the background or timeouts are also changeable using 19 | Grub Customizer. 20 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/ 2 | dep5.mdwn?op=file&rev=135 3 | 4 | Name: grub-customizer 5 | Maintainer: Daniel Richter 6 | Source: https://launchpad.net/grub-customizer 7 | 8 | Copyright: 2010-2011 Daniel Richter 9 | License: GPL-3+ 10 | 11 | Files: debian/* 12 | Copyright: 2010-2011 Daniel Richter 13 | License: GPL-3+ 14 | 15 | Files: translations/* 16 | Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 17 | License: GPL-3+ 18 | 19 | License: GPL-3+ 20 | This program is free software: you can redistribute it and/or modify 21 | it under the terms of the GNU General Public License as published by 22 | the Free Software Foundation, either version 3 of the License, or 23 | (at your option) any later version. 24 | 25 | This package is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | 30 | You should have received a copy of the GNU General Public License 31 | along with this program. If not, see . 32 | 33 | On Debian systems, the complete text of the GNU General 34 | Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. 35 | 36 | It is important to realize that this software comes 37 | without ANY form of warranty. 38 | -------------------------------------------------------------------------------- /debian/patches/00list: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/debian/patches/00list -------------------------------------------------------------------------------- /debian/patches/01su-to-root.dpatch: -------------------------------------------------------------------------------- 1 | #! /bin/sh /usr/share/dpatch/dpatch-run 2 | ## 01su-to-root.dpatch by 3 | ## 4 | ## All lines beginning with `## DP:' are a description of the patch. 5 | ## DP: No description. 6 | 7 | @DPATCH@ 8 | diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 3x~/CMakeLists.txt 3x/CMakeLists.txt 9 | --- 3x~/CMakeLists.txt 2012-08-30 23:32:31.000000000 +0200 10 | +++ 3x/CMakeLists.txt 2012-08-31 18:44:32.810543242 +0200 11 | @@ -131,10 +131,6 @@ 12 | 13 | configure_file ("config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h") 14 | 15 | -configure_file ("misc/pkexec_policy.in" "${CMAKE_CURRENT_BINARY_DIR}/net.launchpad.danielrichter2007.pkexec.grub-customizer.policy") 16 | -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/net.launchpad.danielrichter2007.pkexec.grub-customizer.policy 17 | - DESTINATION /usr/share/polkit-1/actions) 18 | - 19 | 20 | install(TARGETS grubcfg-proxy 21 | DESTINATION ${LIB_INSTALL_DIR} ) 22 | diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 3x~/debian/control 3x/debian/control 23 | --- 3x~/debian/control 2012-04-30 10:34:01.000000000 +0200 24 | +++ 3x/debian/control 2012-08-31 18:46:38.746542943 +0200 25 | @@ -9,7 +9,7 @@ 26 | 27 | Package: grub-customizer 28 | Architecture: any 29 | -Depends: ${shlibs:Depends}, ${misc:Depends}, policykit-1 30 | +Depends: ${shlibs:Depends}, ${misc:Depends}, menu 31 | Recommends: hwinfo 32 | Description: Grub Customizer - A graphical Grub2/BURG configuration application 33 | Grub Customizer is a graphical configuration tool to modify the grub2/burg 34 | diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 3x~/misc/grub-customizer.desktop 3x/misc/grub-customizer.desktop 35 | --- 3x~/misc/grub-customizer.desktop 2012-08-30 22:57:36.000000000 +0200 36 | +++ 3x/misc/grub-customizer.desktop 2012-08-31 18:47:03.466542884 +0200 37 | @@ -1,7 +1,7 @@ 38 | [Desktop Entry] 39 | Name=Grub Customizer 40 | Comment=Customize the bootloader (GRUB2 or BURG) 41 | -Exec=grub-customizer 42 | +Exec=su-to-root -X -c grub-customizer 43 | Terminal=false 44 | X-MultipleArgs=false 45 | Type=Application 46 | diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 3x~/src/main/gtk-client.cpp 3x/src/main/gtk-client.cpp 47 | --- 3x~/src/main/gtk-client.cpp 2012-08-30 22:57:36.000000000 +0200 48 | +++ 3x/src/main/gtk-client.cpp 2012-08-31 18:47:32.498542816 +0200 49 | @@ -49,9 +49,6 @@ 50 | 51 | 52 | int main(int argc, char** argv){ 53 | - if (getuid() != 0 && (argc == 1 || argv[1] != std::string("no-fork"))) { 54 | - return system((std::string("pkexec ") + argv[0] + (argc == 2 ? std::string(" ") + argv[1] : "") + " no-fork").c_str()); 55 | - } 56 | setlocale( LC_ALL, ""); 57 | bindtextdomain( "grub-customizer", LOCALEDIR); 58 | textdomain( "grub-customizer" ); 59 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | include /usr/share/dpatch/dpatch.make 8 | 9 | %: 10 | dpatch apply-all 11 | dh $@ 12 | 13 | clean: 14 | dpatch deapply-all 15 | dh $@ 16 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=3 2 | https://launchpad.net/grub-customizer/+download http://launchpad.net/grub-customizer/.*/grub-customizer_(.+).tar.gz 3 | -------------------------------------------------------------------------------- /misc/grub-customizer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Grub Customizer 3 | Comment=Customize the bootloader (GRUB2 or BURG) 4 | Exec=grub-customizer 5 | Terminal=false 6 | X-MultipleArgs=false 7 | Type=Application 8 | StartupNotify=false 9 | Categories=System;Settings; 10 | Icon=grub-customizer 11 | X-Ubuntu-Gettext-Domain=grub-customizer 12 | X-KDE-SubstituteUID=true 13 | -------------------------------------------------------------------------------- /misc/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/128x128.png -------------------------------------------------------------------------------- /misc/icons/14x14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/14x14.png -------------------------------------------------------------------------------- /misc/icons/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/16x16.png -------------------------------------------------------------------------------- /misc/icons/192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/192x192.png -------------------------------------------------------------------------------- /misc/icons/22x22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/22x22.png -------------------------------------------------------------------------------- /misc/icons/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/24x24.png -------------------------------------------------------------------------------- /misc/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/32x32.png -------------------------------------------------------------------------------- /misc/icons/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/48x48.png -------------------------------------------------------------------------------- /misc/icons/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/icons/64x64.png -------------------------------------------------------------------------------- /misc/manpage.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/misc/manpage.gz -------------------------------------------------------------------------------- /misc/pkexec_policy.in: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Authentication is required to run Grub Customizer 9 | grub-customizer 10 | 11 | auth_admin 12 | auth_admin 13 | auth_admin 14 | 15 | ${CMAKE_INSTALL_PREFIX}/bin/grub-customizer 16 | true 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Controller/AboutController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ABOUTCONTROLLER_H_ 20 | #define ABOUTCONTROLLER_H_ 21 | 22 | class AboutController { 23 | public: 24 | virtual inline ~AboutController(){} 25 | virtual void showAction() = 0; 26 | }; 27 | 28 | 29 | #endif /* ABOUTCONTROLLER_H_ */ 30 | -------------------------------------------------------------------------------- /src/Controller/AboutControllerImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "AboutControllerImpl.h" 20 | 21 | AboutControllerImpl::AboutControllerImpl() 22 | : ControllerAbstract("about") 23 | { 24 | } 25 | 26 | void AboutControllerImpl::showAction(){ 27 | this->logActionBegin("show"); 28 | try { 29 | this->view->show(); 30 | } catch (Exception const& e) { 31 | this->getAllControllers().errorController->errorAction(e); 32 | } 33 | this->logActionEnd(); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Controller/AboutControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ABOUTCONTROLLERIMPL_H_ 20 | #define ABOUTCONTROLLERIMPL_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "../config.h" 26 | 27 | #include "../Model/Env.h" 28 | 29 | #include "../View/About.h" 30 | #include "../View/Trait/ViewAware.h" 31 | 32 | #include "../Controller/ControllerAbstract.h" 33 | 34 | #include "AboutController.h" 35 | 36 | class AboutControllerImpl : 37 | public ControllerAbstract, 38 | public AboutController, 39 | public View_Trait_ViewAware 40 | { 41 | public: 42 | AboutControllerImpl(); 43 | 44 | void showAction(); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/Controller/ControllerAbstract.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "ControllerAbstract.h" 20 | 21 | ControllerAbstract::ControllerAbstract(std::string const& controllerName) { 22 | this->setControllerName(controllerName); 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Controller/ControllerAbstract.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTROLLER_ABSTRACT_H_ 20 | #define CONTROLLER_ABSTRACT_H_ 21 | 22 | #include "ControllerCollection.h" 23 | #include "../lib/assert.h" 24 | #include "../lib/Trait/ActionLoggerAware.h" 25 | 26 | class ControllerAbstract : public Trait_ActionLoggerAware, public ControllerCollection_Connection { 27 | public: 28 | ControllerAbstract(std::string const& controllerName); 29 | }; 30 | 31 | 32 | #endif /* ABSTRACT_H_ */ 33 | -------------------------------------------------------------------------------- /src/Controller/ControllerCollection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTROLLERCOLLECTION_H_ 20 | #define CONTROLLERCOLLECTION_H_ 21 | #include "EntryEditController.h" 22 | #include "MainController.h" 23 | #include "SettingsController.h" 24 | #include "EnvEditorController.h" 25 | #include "TrashController.h" 26 | #include "InstallerController.h" 27 | #include "AboutController.h" 28 | #include "ErrorController.h" 29 | #include "ThemeController.h" 30 | #include "../lib/assert.h" 31 | 32 | struct ControllerCollection { 33 | EntryEditController* entryEditController; 34 | MainController* mainController; 35 | SettingsController* settingsController; 36 | EnvEditorController* envEditController; 37 | TrashController* trashController; 38 | InstallerController* installerController; 39 | AboutController* aboutController; 40 | ErrorController* errorController; 41 | ThemeController* themeController; 42 | }; 43 | 44 | class ControllerCollection_Connection { 45 | private: 46 | ControllerCollection* _controllerCollection; 47 | protected: 48 | ControllerCollection& getAllControllers() { 49 | assert(this->_controllerCollection != NULL); 50 | return *this->_controllerCollection; 51 | } 52 | public: 53 | ControllerCollection_Connection() : _controllerCollection(NULL) {} 54 | 55 | void setControllerCollection(ControllerCollection& controllerCollection) { 56 | this->_controllerCollection = &controllerCollection; 57 | } 58 | }; 59 | 60 | 61 | #endif /* CONTROLLERCOLLECTION_H_ */ 62 | -------------------------------------------------------------------------------- /src/Controller/EntryEditController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYEDITCONTROLLER_H_ 20 | #define ENTRYEDITCONTROLLER_H_ 21 | 22 | #include 23 | #include "../lib/Type.h" 24 | 25 | class EntryEditController { 26 | public: 27 | virtual inline ~EntryEditController() {}; 28 | virtual void showAction(Rule* rule) = 0; 29 | virtual void showCreatorAction() = 0; 30 | virtual void applyAction() = 0; 31 | virtual void syncOptionsAction() = 0; 32 | virtual void syncSourceAction() = 0; 33 | virtual void switchTypeAction(std::string const& newType) = 0; 34 | }; 35 | 36 | 37 | #endif /* ENTRYEDITCONTROLLER_H_ */ 38 | -------------------------------------------------------------------------------- /src/Controller/EntryEditControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRY_EDIT_CONTROLLER_INCLUDED 20 | #define ENTRY_EDIT_CONTROLLER_INCLUDED 21 | 22 | #include "../Model/ListCfg.h" 23 | #include "../View/Main.h" 24 | #include 25 | #include 26 | #include 27 | #include "../config.h" 28 | 29 | #include "../Model/Env.h" 30 | 31 | #include "../Model/Installer.h" 32 | #include "../View/EntryEditor.h" 33 | #include "../View/Trait/ViewAware.h" 34 | 35 | #include "../Model/ListCfg.h" 36 | #include "../Model/DeviceDataList.h" 37 | #include "../lib/ContentParserFactory.h" 38 | 39 | #include "../lib/Trait/LoggerAware.h" 40 | #include "../Controller/ControllerAbstract.h" 41 | #include "../Controller/Trait/ThreadControllerAware.h" 42 | 43 | #include "../lib/Exception.h" 44 | 45 | 46 | class EntryEditControllerImpl : 47 | public EntryEditController, 48 | public ControllerAbstract, 49 | public View_Trait_ViewAware, 50 | public Trait_ThreadControllerAware, 51 | public Model_ListCfg_Connection, 52 | public ContentParserFactory_Connection, 53 | public Model_DeviceDataListInterface_Connection, 54 | public Model_Env_Connection 55 | { 56 | ContentParser* currentContentParser; 57 | Model_Script* _createCustomScript(); 58 | public: 59 | EntryEditControllerImpl(); 60 | 61 | void showAction(Rule* rule); 62 | void showCreatorAction(); 63 | void syncOptionsAction(); 64 | void syncSourceAction(); 65 | void syncEntryEditDlg(bool useOptionsAsSource); 66 | void switchTypeAction(std::string const& newType); 67 | 68 | void applyAction(); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/Controller/EnvEditorController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENVEDITORCONTROLLER_H_ 20 | #define ENVEDITORCONTROLLER_H_ 21 | 22 | class EnvEditorController { 23 | public: 24 | virtual inline ~EnvEditorController(){}; 25 | 26 | virtual void showAction(bool resetPartitionChooser = false) = 0; 27 | virtual void mountSubmountpointAction(std::string const& submountpoint) = 0; 28 | virtual void umountSubmountpointAction(std::string const& submountpoint) = 0; 29 | virtual void switchPartitionAction(std::string const& newPartition) = 0; 30 | virtual void switchBootloaderTypeAction(int newTypeIndex) = 0; 31 | virtual void updateGrubEnvOptionsAction() = 0; 32 | virtual void applyAction(bool saveConfig) = 0; 33 | 34 | virtual void exitAction() = 0; 35 | }; 36 | 37 | 38 | #endif /* ENVEDITORCONTROLLER_H_ */ 39 | -------------------------------------------------------------------------------- /src/Controller/EnvEditorControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENVEDITORCONTROLLERIMPL_H_ 20 | #define ENVEDITORCONTROLLERIMPL_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "../config.h" 26 | 27 | #include "../Model/Env.h" 28 | 29 | #include "../Model/MountTable.h" 30 | 31 | #include "../View/EnvEditor.h" 32 | #include "../View/Trait/ViewAware.h" 33 | 34 | #include "ControllerAbstract.h" 35 | 36 | #include "EnvEditorController.h" 37 | #include "../Model/DeviceMap.h" 38 | 39 | 40 | class EnvEditorControllerImpl : 41 | public ControllerAbstract, 42 | public EnvEditorController, 43 | public View_Trait_ViewAware, 44 | public Model_Env_Connection 45 | { 46 | Model_MountTable* mountTable; 47 | Model_DeviceMap* deviceMap; 48 | 49 | public: 50 | void setMountTable(Model_MountTable& mountTable); 51 | void setDeviceMap(Model_DeviceMap& deviceMap); 52 | 53 | void showAction(bool resetPartitionChooser = false); 54 | 55 | EnvEditorControllerImpl(); 56 | 57 | //partition chooser 58 | void mountSubmountpointAction(std::string const& submountpoint); 59 | void umountSubmountpointAction(std::string const& submountpoint); 60 | void generateSubmountpointSelection(std::string const& prefix); 61 | 62 | // env editor 63 | void switchPartitionAction(std::string const& newPartition); 64 | void switchBootloaderTypeAction(int newTypeIndex); 65 | void updateGrubEnvOptionsAction(); 66 | void applyAction(bool saveConfig); 67 | 68 | void exitAction(); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/Controller/ErrorController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ERRORCONTROLLER_H_ 20 | #define ERRORCONTROLLER_H_ 21 | 22 | #include "../lib/Exception.h" 23 | 24 | class ErrorController { 25 | public: 26 | virtual inline ~ErrorController(){} 27 | virtual void errorAction(Exception const& e) = 0; 28 | virtual void errorThreadedAction(Exception const& e) = 0; 29 | virtual void quitAction() = 0; 30 | }; 31 | 32 | 33 | #endif /* ERRORCONTROLLER_H_ */ 34 | -------------------------------------------------------------------------------- /src/Controller/ErrorControllerImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "ErrorControllerImpl.h" 20 | #include "ThreadController.h" 21 | 22 | ErrorControllerImpl::ErrorControllerImpl() 23 | : ControllerAbstract("error"), 24 | applicationStarted(false) 25 | { 26 | } 27 | 28 | 29 | void ErrorControllerImpl::setApplicationStarted(bool val) { 30 | this->applicationStarted = val; 31 | } 32 | 33 | void ErrorControllerImpl::errorAction(Exception const& e){ 34 | this->log(e, Logger::EXCEPTION); 35 | this->view->showErrorMessage(e, this->applicationStarted); 36 | } 37 | 38 | void ErrorControllerImpl::errorThreadedAction(Exception const& e) { 39 | if (this->threadController) { 40 | this->threadController->showException(e); 41 | } else { 42 | this->log(e, Logger::EXCEPTION); 43 | exit(1); 44 | } 45 | } 46 | 47 | void ErrorControllerImpl::quitAction() { 48 | if (this->applicationStarted) { 49 | this->getAllControllers().mainController->exitAction(true); 50 | } else { 51 | exit(2); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Controller/ErrorControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ERRORCONTROLLERIMPL_H_ 20 | #define ERRORCONTROLLERIMPL_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "../config.h" 26 | 27 | #include "../Model/Env.h" 28 | 29 | #include "../View/Error.h" 30 | #include "../View/Trait/ViewAware.h" 31 | 32 | #include "../Controller/ControllerAbstract.h" 33 | #include "../Controller/Trait/ThreadControllerAware.h" 34 | 35 | #include "ErrorController.h" 36 | 37 | class ErrorControllerImpl : 38 | public ControllerAbstract, 39 | public ErrorController, 40 | public View_Trait_ViewAware, 41 | public Trait_ThreadControllerAware 42 | { 43 | bool applicationStarted; 44 | public: 45 | void setApplicationStarted(bool val); 46 | 47 | ErrorControllerImpl(); 48 | 49 | void errorAction(Exception const& e); 50 | void errorThreadedAction(Exception const& e); 51 | void quitAction(); 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/Controller/GLib/ThreadController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GLIBTHREADCONTROLLER_H_INCLUDED 20 | #define GLIBTHREADCONTROLLER_H_INCLUDED 21 | #include "../ThreadController.h" 22 | #include 23 | #include 24 | #include 25 | #include "../ControllerCollection.h" 26 | #include "../../lib/Trait/LoggerAware.h" 27 | #include "../../lib/assert.h" 28 | #include "../../lib/Type.h" 29 | 30 | class GLib_ThreadController : public ThreadController, public Trait_LoggerAware { 31 | ControllerCollection& _controllers; 32 | 33 | Glib::Dispatcher disp_sync_load, disp_sync_save, disp_thread_died, disp_updateSettingsDlgResolutionList, disp_settings_loaded, disp_exception, disp_postSaveActions, disp_config_saving_error; 34 | 35 | Exception _cachedException; 36 | Rule* _cachedRulePtr; 37 | std::string _cachedThemeFileName; 38 | std::string _cachedConfigSavingError; 39 | public: 40 | GLib_ThreadController(ControllerCollection& controllers); 41 | void syncEntryList(); 42 | void updateSaveProgress(); 43 | void updateSettingsDlgResolutionList(); 44 | void showThreadDiedError(); 45 | void enableSettings(); 46 | void startLoadThread(bool preserveConfig); 47 | void startSaveThread(); 48 | void startFramebufferResolutionLoader(); 49 | void startGrubInstallThread(std::string const& device); 50 | void stopApplication(); 51 | void showException(Exception const& e); 52 | void showConfigSavingError(std::string const& message); 53 | void startEdit(Rule* rule); 54 | void startThemeFileEdit(std::string const& fileName); 55 | void doPostSaveActions(); 56 | private: 57 | void _execLoadSync(); 58 | void _execSaveSync(); 59 | void _execLoad(bool preserveConfig); 60 | void _execSave(); 61 | void _execDie(); 62 | void _execActivateSettings(); 63 | void _execResolutionListUpdate(); 64 | void _execFbResolutionsGetter(); 65 | void _execInstallGrub(std::string const& device); 66 | void _execShowException(); 67 | void _execRuleEdit(); 68 | void _execThemeFileEdit(); 69 | void _execPostSaveActions(); 70 | void _execShowConfigSavingError(); 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/Controller/Helper/DeviceInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "DeviceInfo.h" 20 | 21 | std::map Controller_Helper_DeviceInfo::fetch(std::string const& menuEntryData, ContentParserFactory& contentParserFactory, Model_DeviceDataListInterface const& deviceDataList) { 22 | std::map options; 23 | try { 24 | options = contentParserFactory.create(menuEntryData)->getOptions(); 25 | if (options.find("partition_uuid") != options.end()) { 26 | // add device path 27 | for (Model_DeviceDataListInterface::const_iterator iter = deviceDataList.begin(); iter != deviceDataList.end(); iter++) { 28 | if (iter->second.find("UUID") != iter->second.end() && iter->second.at("UUID") == options["partition_uuid"]) { 29 | options["_deviceName"] = iter->first; 30 | break; 31 | } 32 | } 33 | } 34 | } catch (ParserNotFoundException const& e) { 35 | // nothing to do 36 | } 37 | return options; 38 | } 39 | -------------------------------------------------------------------------------- /src/Controller/Helper/DeviceInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef DEVICEINFO_H_ 20 | #define DEVICEINFO_H_ 21 | 22 | #include "../../lib/ContentParserFactory.h" 23 | #include "../../Model/DeviceDataListInterface.h" 24 | 25 | class Controller_Helper_DeviceInfo { 26 | public: 27 | static std::map fetch(std::string const& menuEntryData, ContentParserFactory& contentParserFactory, Model_DeviceDataListInterface const& deviceDataList); 28 | }; 29 | 30 | 31 | #endif /* DEVICEINFO_H_ */ 32 | -------------------------------------------------------------------------------- /src/Controller/InstallerController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef INSTALLERCONTROLLER_H_ 20 | #define INSTALLERCONTROLLER_H_ 21 | 22 | #include "ThreadController.h" 23 | 24 | class InstallerController { 25 | public: 26 | virtual inline ~InstallerController(){}; 27 | virtual void showAction() = 0; 28 | virtual void installGrubAction(std::string device) = 0; 29 | virtual void installGrubThreadedAction(std::string device) = 0; 30 | virtual void showMessageAction(std::string const& msg) = 0; 31 | }; 32 | 33 | 34 | #endif /* INSTALLERCONTROLLER_H_ */ 35 | -------------------------------------------------------------------------------- /src/Controller/InstallerControllerImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "InstallerControllerImpl.h" 20 | 21 | InstallerControllerImpl::InstallerControllerImpl() 22 | : ControllerAbstract("installer") 23 | { 24 | } 25 | 26 | 27 | ThreadController& InstallerControllerImpl::getThreadController() { 28 | if (this->threadController == NULL) { 29 | throw ConfigException("missing ThreadController", __FILE__, __LINE__); 30 | } 31 | return *this->threadController; 32 | } 33 | 34 | void InstallerControllerImpl::showAction(){ 35 | this->logActionBegin("show"); 36 | try { 37 | view->show(); 38 | } catch (Exception const& e) { 39 | this->getAllControllers().errorController->errorAction(e); 40 | } 41 | this->logActionEnd(); 42 | } 43 | 44 | void InstallerControllerImpl::installGrubAction(std::string device){ 45 | this->logActionBegin("install-grub"); 46 | try { 47 | this->getThreadController().startGrubInstallThread(device); 48 | } catch (Exception const& e) { 49 | this->getAllControllers().errorController->errorAction(e); 50 | } 51 | this->logActionEnd(); 52 | } 53 | 54 | void InstallerControllerImpl::installGrubThreadedAction(std::string device) { 55 | this->logActionBeginThreaded("install-grub-threaded"); 56 | try { 57 | this->env->activeThreadCount++; 58 | installer->threadable_install(device); 59 | this->env->activeThreadCount--; 60 | if (this->env->activeThreadCount == 0 && this->env->quit_requested) { 61 | this->getAllControllers().mainController->exitAction(true); 62 | } 63 | } catch (Exception const& e) { 64 | this->getAllControllers().errorController->errorThreadedAction(e); 65 | } 66 | this->logActionEndThreaded(); 67 | } 68 | 69 | void InstallerControllerImpl::showMessageAction(std::string const& msg){ 70 | this->logActionBegin("show-message"); 71 | try { 72 | view->showMessageGrubInstallCompleted(msg); 73 | } catch (Exception const& e) { 74 | this->getAllControllers().errorController->errorAction(e); 75 | } 76 | this->logActionEnd(); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/Controller/InstallerControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef INSTALLERCONTROLLERIMPL_H_ 20 | #define INSTALLERCONTROLLERIMPL_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "../config.h" 26 | 27 | #include "../Model/Env.h" 28 | 29 | #include "../Model/Installer.h" 30 | #include "../View/Installer.h" 31 | #include "../View/Trait/ViewAware.h" 32 | 33 | #include "ThreadController.h" 34 | 35 | #include "../Controller/ControllerAbstract.h" 36 | #include "../Controller/Trait/ThreadControllerAware.h" 37 | 38 | #include "../lib/Exception.h" 39 | 40 | #include "InstallerController.h" 41 | 42 | 43 | class InstallerControllerImpl : 44 | public ControllerAbstract, 45 | public InstallerController, 46 | public View_Trait_ViewAware, 47 | public Trait_ThreadControllerAware, 48 | public Model_Installer_Connection, 49 | public Model_Env_Connection 50 | { 51 | public: 52 | ThreadController& getThreadController(); 53 | 54 | InstallerControllerImpl(); 55 | 56 | void showAction(); 57 | void installGrubAction(std::string device); 58 | void installGrubThreadedAction(std::string device); 59 | void showMessageAction(std::string const& msg); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/Controller/SettingsController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef SETTINGSCONTROLLER_H_ 20 | #define SETTINGSCONTROLLER_H_ 21 | 22 | #include "../Controller/ThreadController.h" 23 | 24 | class SettingsController { 25 | public: 26 | virtual inline ~SettingsController(){}; 27 | virtual void loadResolutionsAction() = 0; 28 | virtual void updateSettingsDataAction() = 0; 29 | virtual void updateResolutionlistAction() = 0; 30 | virtual void updateResolutionlistThreadedAction() = 0; 31 | virtual void updateDefaultSystemAction() = 0; 32 | virtual void updateCustomSettingAction(std::string const& name) = 0; 33 | virtual void addCustomSettingAction() = 0; 34 | virtual void removeCustomSettingAction(std::string const& name) = 0; 35 | virtual void updateShowMenuSettingAction() = 0; 36 | virtual void updateOsProberSettingAction() = 0; 37 | virtual void updateTimeoutSettingAction() = 0; 38 | virtual void updateKernelParamsAction() = 0; 39 | virtual void updateRecoverySettingAction() = 0; 40 | virtual void updateCustomResolutionAction() = 0; 41 | virtual void updateUseCustomResolutionAction() = 0; 42 | virtual void hideAction() = 0; 43 | virtual void showAction(bool burgMode) = 0; 44 | virtual void syncAction() = 0; 45 | }; 46 | 47 | 48 | #endif /* SETTINGSCONTROLLER_H_ */ 49 | -------------------------------------------------------------------------------- /src/Controller/ThemeController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef THEMECONTROLLER_H_ 20 | #define THEMECONTROLLER_H_ 21 | #include 22 | 23 | class ThemeController { 24 | public: 25 | virtual void loadThemesAction() = 0; 26 | virtual void loadThemeAction(std::string const& name) = 0; 27 | virtual void addThemePackageAction(std::string const& filePath) = 0; 28 | virtual void removeThemeAction(const std::string& name) = 0; 29 | virtual void showThemeInstallerAction() = 0; 30 | virtual void showSimpleThemeConfigAction() = 0; 31 | virtual void addFileAction() = 0; 32 | virtual void startFileEditAction(std::string const& file) = 0; 33 | virtual void removeFileAction(std::string const& file) = 0; 34 | virtual void updateEditAreaAction(std::string const& file) = 0; 35 | virtual void renameAction(std::string const& newName) = 0; 36 | virtual void loadFileAction(std::string const& externalPath) = 0; 37 | virtual void saveTextAction(std::string const& newText) = 0; 38 | 39 | virtual void updateColorSettingsAction() = 0; 40 | virtual void updateFontSettingsAction(bool removeFont) = 0; 41 | virtual void updateFontSizeAction() = 0; 42 | virtual void updateBackgroundImageAction() = 0; 43 | virtual void removeBackgroundImageAction() = 0; 44 | virtual void updateSettingsDataAction() = 0; 45 | 46 | virtual void syncAction() = 0; 47 | virtual void saveAction() = 0; 48 | 49 | virtual void postSaveAction() = 0; 50 | 51 | virtual inline ~ThemeController() {} 52 | }; 53 | 54 | 55 | #endif /* THEMECONTROLLER_H_ */ 56 | -------------------------------------------------------------------------------- /src/Controller/ThemeControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef THEMECONTROLLERIMPL_H_ 20 | #define THEMECONTROLLERIMPL_H_ 21 | #include "ThemeController.h" 22 | #include "../Model/Env.h" 23 | #include "../View/Theme.h" 24 | #include "../View/Trait/ViewAware.h" 25 | #include "../Model/SettingsManagerData.h" 26 | #include "ControllerAbstract.h" 27 | #include "Trait/ThreadControllerAware.h" 28 | #include "../Model/ThemeManager.h" 29 | #include "../Model/ListCfg.h" 30 | #include 31 | 32 | class ThemeControllerImpl : 33 | public ThemeController, 34 | public ControllerAbstract, 35 | public View_Trait_ViewAware, 36 | public Trait_ThreadControllerAware, 37 | public Model_ThemeManager_Connection, 38 | public Model_SettingsManagerData_Connection, 39 | public Model_ListCfg_Connection, 40 | public Model_Env_Connection 41 | { 42 | std::string currentTheme, currentThemeFile; 43 | bool syncActive; // should only be controlled by syncSettings() 44 | bool isImage(std::string const& fileName); 45 | 46 | void syncSettings(); 47 | void syncFiles(); 48 | public: 49 | ThemeControllerImpl(); 50 | 51 | void loadThemesAction(); 52 | void loadThemeAction(std::string const& name); 53 | void addThemePackageAction(const std::string& filePath); 54 | void removeThemeAction(const std::string& name); 55 | void showThemeInstallerAction(); 56 | void showSimpleThemeConfigAction(); 57 | void addFileAction(); 58 | void startFileEditAction(std::string const& file); 59 | void removeFileAction(std::string const& file); 60 | void updateEditAreaAction(std::string const& file); 61 | void renameAction(std::string const& newName); 62 | void loadFileAction(std::string const& externalPath); 63 | void saveTextAction(std::string const& newText); 64 | 65 | void updateColorSettingsAction(); 66 | void updateFontSettingsAction(bool removeFont); 67 | void updateFontSizeAction(); 68 | void updateBackgroundImageAction(); 69 | void removeBackgroundImageAction(); 70 | void updateSettingsDataAction(); 71 | 72 | void syncAction(); 73 | void saveAction(); 74 | void postSaveAction(); 75 | }; 76 | 77 | 78 | #endif /* THEMECONTROLLERIMPL_H_ */ 79 | -------------------------------------------------------------------------------- /src/Controller/ThreadController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef THREADCONTROLLER_H_INCLUDED 20 | #define THREADCONTROLLER_H_INCLUDED 21 | #include 22 | #include "../lib/Exception.h" 23 | #include "../lib/Type.h" 24 | 25 | class ThreadController { 26 | public: 27 | virtual inline ~ThreadController() {}; 28 | 29 | virtual void syncEntryList() = 0; 30 | virtual void updateSaveProgress() = 0; 31 | virtual void updateSettingsDlgResolutionList() = 0; 32 | virtual void showThreadDiedError() = 0; 33 | virtual void enableSettings() = 0; 34 | virtual void startLoadThread(bool preserveConfig) = 0; 35 | virtual void startSaveThread() = 0; 36 | virtual void startFramebufferResolutionLoader() = 0; 37 | virtual void startGrubInstallThread(std::string const& device) = 0; 38 | virtual void stopApplication() = 0; 39 | virtual void showException(Exception const& e) = 0; 40 | virtual void showConfigSavingError(std::string const& message) = 0; 41 | virtual void startEdit(Rule* rule) = 0; 42 | virtual void startThemeFileEdit(std::string const& fileName) = 0; 43 | virtual void doPostSaveActions() = 0; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/Controller/Trait/ControllerAware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRAIT_CONTROLLERAWARE_H_ 20 | #define TRAIT_CONTROLLERAWARE_H_ 21 | 22 | template 23 | class Trait_ControllerAware { 24 | protected: 25 | T* controller; 26 | public: 27 | Trait_ControllerAware() : controller(NULL) {} 28 | void setController(T& controller) { 29 | this->controller = &controller; 30 | } 31 | }; 32 | 33 | #endif /* TRAIT_CONTROLLERAWARE_H_ */ 34 | -------------------------------------------------------------------------------- /src/Controller/Trait/ThreadControllerAware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRAIT_THREADCONTROLLERAWARE_H_ 20 | #define TRAIT_THREADCONTROLLERAWARE_H_ 21 | 22 | class Trait_ThreadControllerAware { 23 | protected: 24 | ThreadController* threadController; 25 | public: 26 | Trait_ThreadControllerAware() : threadController(NULL) {} 27 | 28 | void setThreadController(ThreadController& threadController) { 29 | this->threadController = &threadController; 30 | } 31 | }; 32 | 33 | #endif /* TRAIT_THREADCONTROLLERAWARE_H_ */ 34 | -------------------------------------------------------------------------------- /src/Controller/TrashController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRASHCONTROLLER_H_ 20 | #define TRASHCONTROLLER_H_ 21 | #include "../lib/Type.h" 22 | #include 23 | 24 | class TrashController { 25 | public: 26 | virtual inline ~TrashController(){} 27 | virtual void applyAction() = 0; 28 | virtual void updateAction(std::map const& viewOptions) = 0; 29 | virtual void hideAction() = 0; 30 | virtual void deleteCustomEntriesAction() = 0; 31 | virtual void selectEntriesAction(std::list const& entries) = 0; 32 | virtual void updateSelectionAction(std::list const& selectedEntries) = 0; 33 | }; 34 | 35 | 36 | #endif /* TRASHCONTROLLER_H_ */ 37 | -------------------------------------------------------------------------------- /src/Controller/TrashControllerImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRASHCONTROLLERIMPL_H_ 20 | #define TRASHCONTROLLERIMPL_H_ 21 | 22 | #include "../Model/ListCfg.h" 23 | #include "../View/Main.h" 24 | #include 25 | #include 26 | #include 27 | #include "../config.h" 28 | 29 | #include "../Model/Env.h" 30 | 31 | #include "../Model/MountTable.h" 32 | 33 | #include "../View/Trash.h" 34 | 35 | #include "ThreadController.h" 36 | #include "../View/EnvEditor.h" 37 | #include "../View/Trait/ViewAware.h" 38 | #include "../Mapper/EntryName.h" 39 | 40 | #include "../Controller/ControllerAbstract.h" 41 | 42 | #include "TrashController.h" 43 | #include "../Model/DeviceDataListInterface.h" 44 | #include "../lib/ContentParserFactory.h" 45 | #include "Helper/DeviceInfo.h" 46 | 47 | 48 | class TrashControllerImpl : 49 | public ControllerAbstract, 50 | public TrashController, 51 | public View_Trait_ViewAware, 52 | public Model_ListCfg_Connection, 53 | public Mapper_EntryName_Connection, 54 | public Model_DeviceDataListInterface_Connection, 55 | public ContentParserFactory_Connection, 56 | public Model_Env_Connection 57 | { 58 | void _refresh(); 59 | void _refreshView(Model_Rule* parent); 60 | bool _isDeletable(std::list const& selectedEntries); 61 | std::list data; 62 | public: 63 | TrashControllerImpl(); 64 | 65 | void updateAction(std::map const& viewOptions); 66 | void applyAction(); 67 | 68 | void showAboutDialog(); 69 | 70 | void hideAction(); 71 | 72 | void deleteCustomEntriesAction(); 73 | 74 | void selectEntriesAction(std::list const& entries); 75 | void updateSelectionAction(std::list const& selectedEntries); 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/Mapper/EntryName.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYNAME_H_ 20 | #define ENTRYNAME_H_ 21 | 22 | #include 23 | #include "../Model/Entry.h" 24 | 25 | class Mapper_EntryName { 26 | public: 27 | virtual inline ~Mapper_EntryName(){}; 28 | virtual std::string map(Model_Entry const* sourceEntry, std::string const& defaultName, bool treatSubmenuAsPlaceholder) = 0; 29 | }; 30 | 31 | class Mapper_EntryName_Connection { 32 | protected: 33 | Mapper_EntryName* entryNameMapper; 34 | public: 35 | Mapper_EntryName_Connection() : entryNameMapper(NULL) {} 36 | void setEntryNameMapper(Mapper_EntryName& mapper) { 37 | this->entryNameMapper = &mapper; 38 | } 39 | }; 40 | 41 | #endif /* ENTRYNAME_H_ */ 42 | -------------------------------------------------------------------------------- /src/Mapper/EntryNameImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "EntryNameImpl.h" 20 | 21 | std::string Mapper_EntryNameImpl::map(Model_Entry const* sourceEntry, std::string const& defaultName, bool treatSubmenuAsPlaceholder) { 22 | assert(this->view != NULL); 23 | std::string name; 24 | bool is_other_entries_ph = sourceEntry && treatSubmenuAsPlaceholder ? sourceEntry->type == Model_Entry::SUBMENU || sourceEntry->type == Model_Entry::SCRIPT_ROOT : false; 25 | bool is_plaintext = sourceEntry ? sourceEntry->type == Model_Entry::PLAINTEXT : false; 26 | if (is_other_entries_ph) { 27 | if (sourceEntry->type != Model_Entry::SCRIPT_ROOT) { 28 | name = this->view->createNewEntriesPlaceholderString(sourceEntry->name); 29 | } else { 30 | name = this->view->createNewEntriesPlaceholderString(""); 31 | } 32 | } else if (is_plaintext) { 33 | name = this->view->createPlaintextString(); 34 | } else { 35 | name = defaultName; 36 | } 37 | return name; 38 | } 39 | -------------------------------------------------------------------------------- /src/Mapper/EntryNameImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYNAMEIMPL_H_ 20 | #define ENTRYNAMEIMPL_H_ 21 | 22 | #include "EntryName.h" 23 | #include "../View/Main.h" 24 | #include "../View/Trait/ViewAware.h" 25 | #include "../lib/assert.h" 26 | 27 | class Mapper_EntryNameImpl : public Mapper_EntryName, public View_Trait_ViewAware { 28 | public: 29 | std::string map(Model_Entry const* sourceEntry, std::string const& defaultName, bool treatSubmenuAsPlaceholder); 30 | }; 31 | 32 | 33 | #endif /* ENTRYNAMEIMPL_H_ */ 34 | -------------------------------------------------------------------------------- /src/Model/DeviceDataList.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "DeviceDataList.h" 20 | 21 | Model_DeviceDataList::Model_DeviceDataList(FILE* blkidOutput){ 22 | loadData(blkidOutput); 23 | } 24 | 25 | Model_DeviceDataList::Model_DeviceDataList(){} 26 | 27 | void Model_DeviceDataList::loadData(FILE* blkidOutput){ 28 | std::string deviceName, attributeName; 29 | bool inAttributeValue = false; 30 | bool deviceNameIsComplete = false, attributeNameIsComplete = false; 31 | int c; 32 | while ((c = fgetc(blkidOutput)) != EOF){ 33 | if (inAttributeValue && c != '"'){ 34 | (*this)[deviceName][attributeName] += c; 35 | } 36 | else { 37 | if (c == '\n'){ 38 | deviceName = ""; 39 | deviceNameIsComplete = false; 40 | } 41 | else if (c == ':'){ 42 | deviceNameIsComplete = true; 43 | } 44 | else if (!deviceNameIsComplete) { 45 | deviceName += c; 46 | } 47 | else if (c != '=' && !attributeNameIsComplete) { 48 | if (c != ' ') 49 | attributeName += c; 50 | } 51 | else if (c == '=') 52 | attributeNameIsComplete = true; 53 | else if (c == '"'){ 54 | if (inAttributeValue){ 55 | attributeName = ""; 56 | attributeNameIsComplete = false; 57 | } 58 | inAttributeValue = !inAttributeValue; 59 | } 60 | } 61 | } 62 | } 63 | 64 | void Model_DeviceDataList::clear(){ 65 | this->std::map >::clear(); 66 | } 67 | -------------------------------------------------------------------------------- /src/Model/DeviceDataList.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef DEVICE_DATALIST_INCLUDED 20 | #define DEVICE_DATALIST_INCLUDED 21 | #include 22 | #include 23 | #include 24 | #include "../Model/DeviceDataListInterface.h" 25 | #include "../lib/Trait/LoggerAware.h" 26 | 27 | class Model_DeviceDataList : public Model_DeviceDataListInterface, public Trait_LoggerAware { 28 | public: 29 | Model_DeviceDataList(FILE* blkidOutput); 30 | Model_DeviceDataList(); 31 | void loadData(FILE* blkidOutput); 32 | void clear(); 33 | }; 34 | 35 | class Model_DeviceDataList_Connection { 36 | protected: 37 | Model_DeviceDataList* deviceDataList; 38 | public: 39 | Model_DeviceDataList_Connection() : deviceDataList(NULL) {} 40 | 41 | void setDeviceDataList(Model_DeviceDataList& deviceDataList){ 42 | this->deviceDataList = &deviceDataList; 43 | } 44 | }; 45 | #endif 46 | -------------------------------------------------------------------------------- /src/Model/DeviceDataListInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef DEVICEDATALIST_IFACE_H_ 20 | #define DEVICEDATALIST_IFACE_H_ 21 | #include 22 | #include 23 | 24 | class Model_DeviceDataListInterface : public std::map > { 25 | public: 26 | virtual inline ~Model_DeviceDataListInterface() {}; 27 | 28 | virtual void loadData(FILE* blkidOutput)=0; 29 | virtual void clear()=0; 30 | }; 31 | 32 | class Model_DeviceDataListInterface_Connection { 33 | protected: 34 | Model_DeviceDataListInterface* deviceDataList; 35 | public: 36 | Model_DeviceDataListInterface_Connection() : deviceDataList(NULL) {} 37 | 38 | void setDeviceDataList(Model_DeviceDataListInterface& deviceDataList){ 39 | this->deviceDataList = &deviceDataList; 40 | } 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/Model/DeviceMap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUBDEVICEMAP_H_ 20 | #define GRUBDEVICEMAP_H_ 21 | #include "SmartFileHandle.h" 22 | #include "Env.h" 23 | #include "../lib/regex.h" 24 | #include 25 | #include 26 | 27 | struct Model_DeviceMap_PartitionIndex { 28 | std::string hddNum, partNum; 29 | operator std::string(); 30 | }; 31 | 32 | class Model_DeviceMap : 33 | public Model_Env_Connection 34 | { 35 | mutable std::map _cache; 36 | public: 37 | Model_SmartFileHandle getFileHandle() const; 38 | Model_DeviceMap_PartitionIndex getHarddriveIndexByPartitionUuid(std::string partitionUuid) const; 39 | void clearCache(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/Model/Entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_CUSTOMIZER_ENTRY_INCLUDED 20 | #define GRUB_CUSTOMIZER_ENTRY_INCLUDED 21 | #include 22 | #include 23 | #include 24 | #include "../lib/Trait/LoggerAware.h" 25 | #include "../lib/str_replace.h" 26 | #include "../lib/ArrayStructure.h" 27 | #include "../lib/trim.h" 28 | #include "../lib/Type.h" 29 | 30 | struct Model_Entry_Row { 31 | Model_Entry_Row(FILE* sourceFile); 32 | Model_Entry_Row(); 33 | std::string text; 34 | bool eof; 35 | bool is_loaded; 36 | operator bool(); 37 | }; 38 | 39 | struct Model_Entry : public Trait_LoggerAware, public Entry { 40 | enum EntryType { 41 | MENUENTRY, 42 | SUBMENU, 43 | SCRIPT_ROOT, 44 | PLAINTEXT 45 | } type; 46 | bool isValid, isModified; 47 | std::string name, extension, content; 48 | char quote; 49 | std::list subEntries; 50 | Model_Entry(); 51 | Model_Entry(std::string name, std::string extension, std::string content = "", EntryType type = MENUENTRY); 52 | Model_Entry(FILE* sourceFile, Model_Entry_Row firstRow = Model_Entry_Row(), Logger* logger = NULL, std::string* plaintextBuffer = NULL); 53 | private: 54 | void readSubmenu(FILE* sourceFile, Model_Entry_Row firstRow); 55 | void readMenuEntry(FILE* sourceFile, Model_Entry_Row firstRow); 56 | public: 57 | std::list& getSubEntries(); 58 | operator bool() const; 59 | operator ArrayStructure() const; 60 | static Model_Entry& fromPtr(Entry* entry); 61 | static Model_Entry const& fromPtr(Entry const* entry); 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/Model/EntryPathBuilder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRY_PATH_BUILDER_INCLUDED 20 | #define ENTRY_PATH_BUILDER_INCLUDED 21 | #include 22 | #include 23 | #include "../Model/Entry.h" 24 | 25 | class Model_EntryPathBilder { 26 | public: 27 | virtual inline ~Model_EntryPathBilder() {}; 28 | 29 | virtual std::list buildPath(Model_Entry const& entry) const =0; 30 | virtual std::string buildPathString(Model_Entry const& entry, bool withOtherEntriesPlaceholder = false) const =0; 31 | virtual std::string buildScriptPath(Model_Entry const& entry) const =0; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/Model/EntryPathBuilderImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "EntryPathBuilderImpl.h" 20 | 21 | Model_EntryPathBuilderImpl::Model_EntryPathBuilderImpl(Model_Script const& mainScript) 22 | : prefixLength(0), mainScript(NULL) 23 | { 24 | this->setMainScript(mainScript); 25 | } 26 | 27 | void Model_EntryPathBuilderImpl::setMainScript(Model_Script const& mainScript) { 28 | this->mainScript = &mainScript; 29 | } 30 | 31 | void Model_EntryPathBuilderImpl::setEntrySourceMap(std::map const& entrySourceMap) { 32 | this->entrySourceMap = entrySourceMap; 33 | } 34 | void Model_EntryPathBuilderImpl::setScriptTargetMap(std::map const& scriptTargetMap) { 35 | this->scriptTargetMap = scriptTargetMap; 36 | } 37 | 38 | void Model_EntryPathBuilderImpl::setPrefixLength(int length) { 39 | this->prefixLength = length; 40 | } 41 | 42 | std::list Model_EntryPathBuilderImpl::buildPath(Model_Entry const& entry) const { 43 | Model_Script const* script = entrySourceMap.find(&entry) != entrySourceMap.end() ? entrySourceMap.find(&entry)->second : this->mainScript; 44 | return script->buildPath(entry); 45 | } 46 | std::string Model_EntryPathBuilderImpl::buildPathString(Model_Entry const& entry, bool withOtherEntriesPlaceholder) const { 47 | Model_Script const* script = entrySourceMap.find(&entry) != entrySourceMap.end() ? entrySourceMap.find(&entry)->second : this->mainScript; 48 | return script->buildPathString(entry, withOtherEntriesPlaceholder); 49 | } 50 | 51 | std::string Model_EntryPathBuilderImpl::buildScriptPath(Model_Entry const& entry) const { 52 | Model_Script const* script = entrySourceMap.find(&entry) != entrySourceMap.end() ? entrySourceMap.find(&entry)->second : NULL; 53 | return script ? this->scriptTargetMap.find(script)->second.substr(this->prefixLength) : ""; 54 | } 55 | -------------------------------------------------------------------------------- /src/Model/EntryPathBuilderImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | 20 | #ifndef ENTRYPATHBUILDERIMPL_H_ 21 | #define ENTRYPATHBUILDERIMPL_H_ 22 | #include "../Model/EntryPathBuilder.h" 23 | #include "Script.h" 24 | #include 25 | 26 | class Model_EntryPathBuilderImpl : public Model_EntryPathBilder { 27 | Model_Script const* mainScript; 28 | std::map entrySourceMap; 29 | std::map scriptTargetMap; 30 | int prefixLength; 31 | public: 32 | Model_EntryPathBuilderImpl(Model_Script const& mainScript); 33 | void setMainScript(Model_Script const& mainScript); 34 | void setEntrySourceMap(std::map const& entrySourceMap); 35 | void setScriptTargetMap(std::map const& scriptTargetMap); 36 | void setPrefixLength(int length); 37 | std::list buildPath(Model_Entry const& entry) const; 38 | std::string buildPathString(Model_Entry const& entry, bool withOtherEntriesPlaceholder = false) const; 39 | std::string buildScriptPath(Model_Entry const& entry) const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/Model/EntryPathFollower.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRY_PATH_FOLLOWER_INCLUDED 20 | #define ENTRY_PATH_FOLLOWER_INCLUDED 21 | #include 22 | #include 23 | #include "../Model/Entry.h" 24 | 25 | class Model_EntryPathFollower { 26 | public: 27 | virtual inline ~Model_EntryPathFollower() {}; 28 | 29 | virtual Model_Entry* getEntryByPath(std::list const& path)=0; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Model/FbResolutionsGetter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "FbResolutionsGetter.h" 20 | 21 | Model_FbResolutionsGetter::Model_FbResolutionsGetter() 22 | : _isLoading(false) 23 | {} 24 | 25 | const std::list& Model_FbResolutionsGetter::getData() const { 26 | return data; 27 | } 28 | void Model_FbResolutionsGetter::load(){ 29 | if (!_isLoading){ //make sure that only one thread is running this function at the same time 30 | _isLoading = true; 31 | data.clear(); 32 | FILE* hwinfo_proc = popen("hwinfo --framebuffer", "r"); 33 | if (hwinfo_proc){ 34 | int c; 35 | std::string row; 36 | //parses mode lines like " Mode 0x0300: 640x400 (+640), 8 bits" 37 | while ((c = fgetc(hwinfo_proc)) != EOF){ 38 | if (c != '\n') 39 | row += char(c); 40 | else { 41 | if (row.substr(0,7) == " Mode "){ 42 | int beginOfResulution = row.find(':')+2; 43 | int endOfResulution = row.find(' ', beginOfResulution); 44 | 45 | int beginOfColorDepth = row.find(' ', endOfResulution+1)+1; 46 | int endOfColorDepth = row.find(' ', beginOfColorDepth); 47 | 48 | data.push_back( 49 | row.substr(beginOfResulution, endOfResulution-beginOfResulution) 50 | + "x" 51 | + row.substr(beginOfColorDepth, endOfColorDepth-beginOfColorDepth) 52 | ); 53 | } 54 | row = ""; 55 | } 56 | } 57 | if (pclose(hwinfo_proc) == 0 && this->controller) 58 | this->controller->updateResolutionlistThreadedAction(); 59 | } 60 | _isLoading = false; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Model/FbResolutionsGetter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef FB_RESOLUTIONS_GETTER 20 | #define FB_RESOLUTIONS_GETTER 21 | #include 22 | #include 23 | #include 24 | #include "../Controller/SettingsController.h" 25 | #include "../Controller/Trait/ControllerAware.h" 26 | #include "../lib/Trait/LoggerAware.h" 27 | 28 | class Model_FbResolutionsGetter : public Trait_LoggerAware, public Trait_ControllerAware { 29 | std::list data; 30 | bool _isLoading; 31 | public: 32 | Model_FbResolutionsGetter(); 33 | const std::list& getData() const; 34 | void load(); 35 | }; 36 | 37 | class Model_FbResolutionsGetter_Connection { 38 | protected: 39 | Model_FbResolutionsGetter* fbResolutionsGetter; 40 | public: 41 | Model_FbResolutionsGetter_Connection() : fbResolutionsGetter(NULL) {} 42 | 43 | void setFbResolutionsGetter(Model_FbResolutionsGetter& fbResolutionsGetter){ 44 | this->fbResolutionsGetter = &fbResolutionsGetter; 45 | } 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Model/Installer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "Installer.h" 20 | 21 | void Model_Installer::threadable_install(std::string const& device){ 22 | this->install_result = install(device); 23 | if (controller) 24 | controller->showMessageAction(this->install_result); 25 | } 26 | 27 | std::string Model_Installer::install(std::string const& device){ 28 | FILE* install_proc = popen((this->env->install_cmd+" '"+device+"' 2>&1").c_str(), "r"); 29 | std::string output; 30 | int c; 31 | while ((c = fgetc(install_proc)) != EOF){ 32 | output += c; 33 | } 34 | int success = pclose(install_proc); 35 | if (success == 0) 36 | return ""; //empty return string = no error 37 | else 38 | return output; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Model/Installer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_INSTALLER_INCLUDED 20 | #define GRUB_INSTALLER_INCLUDED 21 | #include 22 | #include "Env.h" 23 | #include "../Controller/InstallerController.h" 24 | #include "../Controller/Trait/ControllerAware.h" 25 | #include "../lib/Trait/LoggerAware.h" 26 | 27 | class Model_Installer : 28 | public Trait_LoggerAware, 29 | public Trait_ControllerAware, 30 | public Model_Env_Connection 31 | { 32 | std::string install_result; 33 | public: 34 | void threadable_install(std::string const& device); 35 | std::string install(std::string const& device); 36 | }; 37 | 38 | class Model_Installer_Connection { 39 | protected: 40 | Model_Installer* installer; 41 | public: 42 | Model_Installer_Connection() : installer(NULL) {} 43 | 44 | void setInstaller(Model_Installer& installer){ 45 | this->installer = &installer; 46 | } 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/Model/ProxyScriptData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_CFG_LIBProxyScriptData_PARSER_INCLUDED 20 | #define GRUB_CFG_LIBProxyScriptData_PARSER_INCLUDED 21 | #include 22 | #include 23 | 24 | struct Model_ProxyScriptData { 25 | std::string scriptCmd, proxyCmd, ruleString; 26 | bool is_valid; 27 | Model_ProxyScriptData(FILE* fpProxyScript); 28 | bool load(FILE* fpProxyScript); 29 | static bool is_proxyscript(FILE* fpProxyScript); 30 | static bool is_proxyscript(std::string const& filePath); 31 | operator bool(); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/Model/PscriptnameTranslator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "PscriptnameTranslator.h" 20 | 21 | std::string Model_PscriptnameTranslator::decode(std::string const& input){ 22 | std::string result = input; 23 | int last_nonnum_pos = input.find_last_not_of("0123456789"); 24 | if (last_nonnum_pos != -1 && result[last_nonnum_pos] == '~' && last_nonnum_pos != input.length()-1) 25 | result = result.substr(0, last_nonnum_pos); 26 | return result; 27 | } 28 | 29 | std::string Model_PscriptnameTranslator::encode(std::string const& input, int x){ 30 | std::ostringstream out; 31 | out << input; 32 | int last_nonnum_pos = input.find_last_not_of("0123456789"); 33 | if (x != 0 || (last_nonnum_pos != -1 && input[last_nonnum_pos] == '~') && last_nonnum_pos != input.length()-1) 34 | out << "~" << x; 35 | return out.str(); 36 | } 37 | -------------------------------------------------------------------------------- /src/Model/PscriptnameTranslator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef PSCRIPTNAME_TRANSLATOR_INCLUDED 20 | #define PSCRIPTNAME_TRANSLATOR_INCLUDED 21 | 22 | #include 23 | #include 24 | 25 | class Model_PscriptnameTranslator { 26 | public: 27 | static std::string decode(std::string const& input); 28 | static std::string encode(std::string const& input, int x); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/Model/Repository.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_CUSTOMIZER_REPOSITORY_INCLUDED 20 | #define GRUB_CUSTOMIZER_REPOSITORY_INCLUDED 21 | #include "Script.h" 22 | #include "ProxyScriptData.h" 23 | #include "PscriptnameTranslator.h" 24 | #include 25 | #include 26 | #include 27 | #include "../lib/Trait/LoggerAware.h" 28 | #include "../lib/ArrayStructure.h" 29 | 30 | struct Model_Repository : public std::list, public Trait_LoggerAware { 31 | std::list trash; 32 | void load(std::string const& directory, bool is_proxifiedScript_dir); 33 | Model_Script* getScriptByFilename(std::string const& fileName, bool createScriptIfNotFound = false); 34 | Model_Script* getScriptByName(std::string const& name); 35 | Model_Script* getScriptByEntry(Model_Entry const& entry); 36 | Model_Script const* getScriptByEntry(Model_Entry const& entry) const; 37 | Model_Script* getCustomScript(); 38 | Model_Script* getNthScript(int pos); 39 | void deleteAllEntries(bool preserveModifiedScripts = true); 40 | Model_Script* createScript(std::string const& name, std::string const& fileName, std::string const& content); 41 | void createScript(Model_Script const& script, std::string const& content); // create existing script (in scriptlist) on file system 42 | std::map getScriptPathMap(); 43 | void removeScript(Model_Script const& script); 44 | void clearTrash(); 45 | operator ArrayStructure() const; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Model/Rule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_CUSTOMIZER_RULE_INCLUDED 20 | #define GRUB_CUSTOMIZER_RULE_INCLUDED 21 | #include 22 | #include "Entry.h" 23 | #include "../Model/EntryPathBuilder.h" 24 | #include "../Model/EntryPathFollower.h" 25 | #include 26 | #include "../lib/md5.h" 27 | #include "../lib/ArrayStructure.h" 28 | #include "../lib/Type.h" 29 | 30 | struct Model_Rule : public Rule { 31 | Model_Entry* dataSource; //assigned when using RuleType::OTHER_ENTRIES_PLACEHOLDER 32 | std::string outputName; 33 | std::string __idHash; //should only be used by sync()! 34 | std::list __idpath; //should only be used by sync()! 35 | std::string __sourceScriptPath; //should only be used by sync()! 36 | bool isVisible; 37 | std::list subRules; 38 | enum RuleType { 39 | NORMAL, OTHER_ENTRIES_PLACEHOLDER, PLAINTEXT, SUBMENU 40 | } type; 41 | Model_Rule(RuleType type, std::list path, std::string outputName, bool isVisible); 42 | Model_Rule(RuleType type, std::list path, bool isVisible); 43 | Model_Rule(Model_Entry& source, bool isVisible, Model_EntryPathFollower& pathFollower, std::list > const& pathesToIgnore = std::list >(), std::list const& currentPath = std::list()); //generate rule for given entry 44 | Model_Rule(); 45 | std::string toString(Model_EntryPathBilder const& pathBuilder); 46 | bool hasRealSubrules() const; 47 | void print(std::ostream& out) const; 48 | std::string getEntryName() const; 49 | void setVisibility(bool isVisible); 50 | operator ArrayStructure() const; 51 | static Model_Rule& fromPtr(Rule* rule); 52 | static Model_Rule const& fromPtr(Rule const* rule); 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/Model/Script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_CUSTOMIZER_SCRIPT_INCLUDED 20 | #define GRUB_CUSTOMIZER_SCRIPT_INCLUDED 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "Entry.h" 26 | #include 27 | #include "../Model/EntryPathFollower.h" 28 | #include "../lib/Trait/LoggerAware.h" 29 | #include "../lib/md5.h" 30 | #include "../config.h" 31 | #include "../lib/Exception.h" 32 | #include "../lib/ArrayStructure.h" 33 | #include "../lib/Type.h" 34 | 35 | struct Model_Script : public Model_EntryPathFollower, public Trait_LoggerAware, public Script { 36 | std::string name, fileName; 37 | bool isCustomScript; 38 | Model_Entry root; 39 | Model_Script(std::string const& name, std::string const& fileName); 40 | bool isModified(Model_Entry* parent = NULL); 41 | std::list& entries(); 42 | std::list const& entries() const; 43 | bool isInScriptDir(std::string const& cfg_dir) const; 44 | Model_Entry* getEntryByPath(std::list const& path); 45 | Model_Entry* getEntryByName(std::string const& name, std::list& parentList); 46 | Model_Entry* getEntryByHash(std::string const& hash, std::list& parentList); 47 | Model_Entry* getPlaintextEntry(); 48 | void moveToBasedir(std::string const& cfg_dir); //moves the file from any location to grub.d and adds the prefix PS_ (proxified Script) or DS_ (default script) 49 | bool moveFile(std::string const& newPath, short int permissions = -1); 50 | std::list buildPath(Model_Entry const& entry, Model_Entry const* parent) const; 51 | std::list buildPath(Model_Entry const& entry) const; 52 | std::string buildPathString(Model_Entry const& entry, bool withOtherEntriesPlaceholder = false) const; 53 | bool hasEntry(Model_Entry const& entry, Model_Entry const * parent = NULL) const; 54 | void deleteEntry(Model_Entry const& entry, Model_Entry* parent = NULL); 55 | bool deleteFile(); 56 | operator ArrayStructure() const; 57 | static Model_Script& fromPtr(Script* script); 58 | static Model_Script const& fromPtr(Script const* script); 59 | static int extractIndexFromPath(std::string const& path, std::string const& cfgDirPath); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/Model/ScriptSourceMap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef SCRIPTSOURCEMAP_H_ 20 | #define SCRIPTSOURCEMAP_H_ 21 | 22 | #include 23 | #include 24 | #include "Env.h" 25 | #include "../lib/csv.h" 26 | #include 27 | #include "../lib/assert.h" 28 | #include "../lib/Trait/LoggerAware.h" 29 | 30 | class Model_ScriptSourceMap : 31 | public std::map, 32 | public Trait_LoggerAware, 33 | public Model_Env_Connection 34 | { 35 | std::string _getFilePath(); 36 | bool _fileExists; 37 | std::list _newSources; 38 | public: 39 | Model_ScriptSourceMap(); 40 | void load(); 41 | void registerMove(std::string const& sourceName, std::string const& destinationName); 42 | void addScript(std::string const& sourceName); 43 | void save(); 44 | bool has(std::string const& sourceName); 45 | std::string getSourceName(std::string const& destinationName); 46 | bool fileExists(); 47 | std::list getUpdates() const; 48 | void deleteUpdates(); 49 | }; 50 | 51 | 52 | #endif /* SCRIPTSOURCEMAP_H_ */ 53 | -------------------------------------------------------------------------------- /src/Model/SettingsManagerData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef SETTING_MANAGER_DATASTORE_INCLUDED 20 | #define SETTING_MANAGER_DATASTORE_INCLUDED 21 | #include //mkdir 22 | #include "Env.h" 23 | #include "../lib/Trait/LoggerAware.h" 24 | #include "SettingsStore.h" 25 | #include 26 | #include "../lib/str_replace.h" 27 | #include 28 | 29 | class Model_SettingsManagerData : 30 | public Model_SettingsStore, 31 | public Trait_LoggerAware, 32 | public Model_Env_Connection 33 | { 34 | bool _reloadRequired; 35 | public: 36 | bool color_helper_required; 37 | std::string grubFont, oldFontFile; 38 | int grubFontSize; 39 | Model_SettingsManagerData(); 40 | bool reloadRequired() const; 41 | static std::map parsePf2(std::string const& fileName); 42 | static std::string getFontFileByName(std::string const& name); 43 | std::string mkFont(std::string fontFile = "", std::string outputDir = ""); 44 | bool load(); 45 | bool save(); 46 | bool setValue(std::string const& name, std::string const& value); 47 | bool setIsActive(std::string const& name, bool value); 48 | }; 49 | 50 | class Model_SettingsManagerData_Connection { 51 | protected: 52 | Model_SettingsManagerData* settings; 53 | public: 54 | Model_SettingsManagerData_Connection() : settings(NULL) {} 55 | void setSettingsManager(Model_SettingsManagerData& settings){ 56 | this->settings = &settings; 57 | } 58 | }; 59 | #endif 60 | -------------------------------------------------------------------------------- /src/Model/SettingsStore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef SETTINGSSTORE_H_ 20 | #define SETTINGSSTORE_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | struct Model_SettingsStore_Row { 27 | Model_SettingsStore_Row(); 28 | std::string name, value, comment, plaintext; 29 | bool hasExportPrefix, isActive, isSetting; 30 | void validate(); 31 | std::string getOutput(); 32 | }; 33 | 34 | class Model_SettingsStore { 35 | std::string filePath; 36 | protected: 37 | std::list settings; 38 | public: 39 | Model_SettingsStore(FILE* source = NULL); 40 | std::list::iterator begin(bool jumpOverPlaintext = true); 41 | std::list::iterator end(); 42 | void iter_to_next_setting(std::list::iterator& iter); 43 | std::string getValue(std::string const& name); 44 | bool setValue(std::string const& name, std::string const& value); 45 | std::string addNewItem(); 46 | void removeItem(std::string const& name); 47 | void renameItem(std::string const& old_name, std::string const& new_name); 48 | bool isActive(std::string const& name, bool checkValueToo = false); 49 | bool setIsActive(std::string const& name, bool value); 50 | bool setIsExport(std::string const& name, bool isExport); 51 | void load(FILE* source); 52 | void save(FILE* target); 53 | void clear(); 54 | }; 55 | 56 | #endif /* SETTINGSSTORE_H_ */ 57 | -------------------------------------------------------------------------------- /src/Model/SmartFileHandle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef SMARTFILEHANDLE_H_ 20 | #define SMARTFILEHANDLE_H_ 21 | #include 22 | #include 23 | #include "../lib/Exception.h" 24 | 25 | class Model_SmartFileHandle { 26 | public: 27 | enum Type { 28 | TYPE_FILE, 29 | TYPE_COMMAND, 30 | TYPE_STRING 31 | }; 32 | private: 33 | FILE* proc_or_file; 34 | Model_SmartFileHandle::Type type; 35 | std::string string; // content for TYPE_STRING 36 | public: 37 | Model_SmartFileHandle(); 38 | char getChar(); 39 | std::string getRow(); 40 | std::string getAll(); 41 | void open(std::string const& cmd_or_file, std::string const& mode, Type type); 42 | void close(); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/Model/Theme.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef MODEL_THEME_H_ 20 | #define MODEL_THEME_H_ 21 | #include 22 | #include "ThemeFile.h" 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "../lib/Exception.h" 28 | #include 29 | #include 30 | #include 31 | #include "../lib/assert.h" 32 | 33 | struct Model_Theme { 34 | std::string directory; 35 | std::string zipFile; 36 | std::list files; 37 | std::string name; 38 | bool isModified; 39 | 40 | Model_Theme(std::string const& directory, std::string const& zipFile, std::string const& name); 41 | void load(std::string const& directory); 42 | void sort(); 43 | void loadZipFile(std::string const& zipFile); 44 | std::string loadFileContent(std::string localFileName); 45 | std::string loadFileContentExternal(std::string const& externalPath); 46 | std::string getFullFileName(std::string localFileName); 47 | Model_ThemeFile& getFile(std::string localFileName); 48 | Model_ThemeFile& getFileByNewName(std::string localFileName); 49 | void removeFile(Model_ThemeFile const& file); 50 | void save(std::string const& baseDirectory); 51 | void renameFile(std::string const& oldName, std::string const& newName); 52 | bool hasConflicts(std::string const& localFilename); 53 | void deleteThemeFiles(std::string const& baseDirectory); 54 | private: 55 | void removeSubdir(); 56 | std::string extractLocalPath(std::string fullPath); 57 | std::string loadFileContentFromDirectory(std::string localFileName); 58 | std::string loadFileContentFromZip(std::string localFileName); 59 | void writeFile(Model_ThemeFile& file, std::string const& path); 60 | bool fileExists(std::string const& path); 61 | bool isDir(std::string const& path); 62 | void createFilePath(std::string const& path); 63 | void deleteDirectory(std::string const& path); 64 | }; 65 | 66 | 67 | #endif /* MODEL_THEME_H_ */ 68 | -------------------------------------------------------------------------------- /src/Model/ThemeFile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "ThemeFile.h" 20 | 21 | Model_ThemeFile::Model_ThemeFile(std::string localFileName, bool isAddedByUser) 22 | : localFileName(localFileName), contentLoaded(false), newLocalFileName(localFileName), isAddedByUser(isAddedByUser) 23 | { 24 | } 25 | 26 | bool Model_ThemeFile::compareLocalPath(Model_ThemeFile const& a, Model_ThemeFile const& b) { 27 | return a.newLocalFileName < b.newLocalFileName; 28 | } 29 | -------------------------------------------------------------------------------- /src/Model/ThemeFile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef THEMEFILE_H_ 20 | #define THEMEFILE_H_ 21 | #include 22 | 23 | struct Model_ThemeFile { 24 | Model_ThemeFile(std::string localFileName, bool isAddedByUser = false); 25 | static bool compareLocalPath(Model_ThemeFile const& a, Model_ThemeFile const& b); 26 | std::string localFileName, newLocalFileName; // path inside of the theme directory 27 | bool contentLoaded; // say whether the content is loaded (text only) 28 | std::string content; // loaded content (text only) 29 | bool isAddedByUser; 30 | std::string externalSource; 31 | }; 32 | 33 | 34 | #endif /* THEMEFILE_H_ */ 35 | -------------------------------------------------------------------------------- /src/Model/ThemeManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef THEMEMANAGER_H_ 20 | #define THEMEMANAGER_H_ 21 | 22 | #include 23 | #include "Theme.h" 24 | #include "Env.h" 25 | #include "../lib/Exception.h" 26 | 27 | class Model_ThemeManager : 28 | public Model_Env_Connection 29 | { 30 | bool gotSaveErrors; 31 | std::string saveErrors; 32 | public: 33 | std::list themes; 34 | std::list removedThemes; 35 | Model_ThemeManager(); 36 | void load(); 37 | Model_Theme& getTheme(std::string const& name); 38 | bool themeExists(std::string const& name); 39 | std::string extractThemeName(std::string const& indexFile); 40 | std::string addThemePackage(std::string const& fileName); 41 | void removeTheme(Model_Theme const& theme); 42 | void save(); 43 | std::string getThemePath(); 44 | bool hasSaveErrors(); 45 | std::string getSaveErrors(); 46 | }; 47 | 48 | class Model_ThemeManager_Connection { 49 | protected: 50 | Model_ThemeManager* themeManager; 51 | public: 52 | Model_ThemeManager_Connection() : themeManager(NULL) {} 53 | 54 | void setThemeManager(Model_ThemeManager& themeManager) { 55 | this->themeManager = &themeManager; 56 | } 57 | }; 58 | 59 | 60 | #endif /* THEMEMANAGER_H_ */ 61 | -------------------------------------------------------------------------------- /src/View/About.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ABOUTDIALOG_H_ 20 | #define ABOUTDIALOG_H_ 21 | 22 | /** 23 | * base class to be implemented by about dialogs 24 | */ 25 | class View_About { 26 | public: 27 | virtual inline ~View_About() {}; 28 | //show the about dialog, don't block 29 | virtual void show()=0; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/View/ColorChooser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef COLOR_CHOOSER_INCLUDED 20 | #define COLOR_CHOOSER_INCLUDED 21 | #include 22 | /** 23 | * base class to be implemented by color chooser controls 24 | */ 25 | class View_ColorChooser { 26 | public: 27 | virtual inline ~View_ColorChooser() {}; 28 | 29 | //choose one of the colors provided by this control 30 | virtual void selectColor(std::string const& codeName)=0; 31 | 32 | //determine which color is currently selected 33 | virtual std::string getSelectedColor() const=0; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/View/EntryEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYEDITDLG_H_ 20 | #define ENTRYEDITDLG_H_ 21 | #include 22 | #include 23 | #include 24 | #include "../lib/Type.h" 25 | 26 | class View_EntryEditor { 27 | public: 28 | virtual inline ~View_EntryEditor() {}; 29 | 30 | virtual void show() = 0; 31 | virtual void setSourcecode(std::string const& source) = 0; 32 | virtual std::string getSourcecode() = 0; 33 | 34 | virtual void addOption(std::string const& name, std::string const& value) = 0; 35 | virtual void setOptions(std::map options) = 0; 36 | virtual std::map getOptions() const = 0; 37 | virtual void removeOptions() = 0; 38 | 39 | virtual void setRulePtr(Rule* rulePtr) = 0; 40 | virtual Rule* getRulePtr() = 0; 41 | 42 | virtual void hide() = 0; 43 | 44 | virtual void setAvailableEntryTypes(std::list const& names) = 0; 45 | virtual void selectType(std::string const& name) = 0; 46 | virtual std::string getSelectedType() const = 0; 47 | }; 48 | 49 | #endif /* ENTRYEDITDLG_H_ */ 50 | -------------------------------------------------------------------------------- /src/View/EnvEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUBENVEDITOR_H_ 20 | #define GRUBENVEDITOR_H_ 21 | #include 22 | 23 | class View_EnvEditor { 24 | public: 25 | virtual inline ~View_EnvEditor() {}; 26 | 27 | enum MountExceptionType { 28 | MOUNT_FAILED, 29 | UMOUNT_FAILED, 30 | MOUNT_ERR_NO_FSTAB, 31 | SUB_MOUNT_FAILED, 32 | SUB_UMOUNT_FAILED 33 | }; 34 | virtual void show(bool resetPartitionChooser = false) = 0; 35 | virtual void hide() = 0; 36 | virtual void removeAllSubmountpoints() = 0; 37 | virtual void addSubmountpoint(std::string const& name, bool isActive) = 0; 38 | virtual void setEnvSettings(std::map const& props, std::list const& requiredProps, std::list const& validProps) = 0; 39 | virtual std::map getEnvSettings() = 0; 40 | virtual void setRootDeviceName(std::string const& rootDeviceName) = 0; 41 | virtual int getBootloaderType() const = 0; 42 | virtual void setSubmountpointSelectionState(std::string const& submountpoint, bool new_isSelected) = 0; 43 | virtual void showErrorMessage(MountExceptionType type)=0; 44 | }; 45 | 46 | #endif /* GRUBENVEDITOR_H_ */ 47 | -------------------------------------------------------------------------------- /src/View/Error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ERROR_H_ 20 | #define ERROR_H_ 21 | 22 | #include 23 | 24 | class View_Error { 25 | public: 26 | virtual inline ~View_Error(){} 27 | virtual void showErrorMessage(std::string const& errorMessage, bool allowContinue) = 0; 28 | }; 29 | 30 | 31 | #endif /* ERROR_H_ */ 32 | -------------------------------------------------------------------------------- /src/View/Gtk/About.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GC_ABOUNTDIALOG_GTK_INCLUDED 20 | #define GC_ABOUNTDIALOG_GTK_INCLUDED 21 | #include 22 | #include "../../config.h" 23 | #include 24 | #include "../About.h" 25 | #include "../../lib/Trait/LoggerAware.h" 26 | 27 | class View_Gtk_About : public Gtk::AboutDialog, public View_About, public Trait_LoggerAware { 28 | Glib::ustring appName, appVersion; 29 | std::vector authors; 30 | std::vector artists; 31 | 32 | void signal_about_dlg_response(int response_id); 33 | public: 34 | View_Gtk_About(); 35 | void show(); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/View/Gtk/Element/PartitionChooser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "PartitionChooser.h" 20 | 21 | View_Gtk_Element_PartitionChooser::View_Gtk_Element_PartitionChooser(Glib::ustring const& activePartition_uuid, Model_DeviceDataListInterface const& deviceDataList, bool prependCurrentPartition, std::string const& currentPartitionName) 22 | : activePartition_uuid(activePartition_uuid), deviceDataList(&deviceDataList), prependCurrentPartition(prependCurrentPartition), currentPartitionName(currentPartitionName) 23 | { 24 | load(); 25 | } 26 | 27 | std::string View_Gtk_Element_PartitionChooser::strToLower(std::string str) { 28 | for (std::string::iterator iter = str.begin(); iter != str.end(); iter++) { 29 | *iter = std::tolower(*iter); 30 | } 31 | return str; 32 | } 33 | 34 | /** 35 | * returns the uuid of the selected entry of the combobox 36 | */ 37 | std::string View_Gtk_Element_PartitionChooser::getSelectedUuid() const { 38 | if (this->get_active_row_number() == 0 && prependCurrentPartition) { // (current) 39 | return ""; 40 | } else { 41 | return this->uuid_map.at(this->get_active_text()); 42 | } 43 | } 44 | 45 | void View_Gtk_Element_PartitionChooser::load(){ 46 | this->remove_all(); 47 | if (prependCurrentPartition) { 48 | this->append(currentPartitionName + "\n(" + gettext("current") + ")"); 49 | this->set_active(0); 50 | } 51 | for (Model_DeviceDataListInterface::const_iterator iter = deviceDataList->begin(); iter != deviceDataList->end(); iter++) { 52 | if (iter->second.find("UUID") != iter->second.end()) { 53 | Glib::ustring text = iter->first + "\n(" + (iter->second.find("LABEL") != iter->second.end() ? iter->second.at("LABEL") + ", " : "") + (iter->second.find("TYPE") != iter->second.end() ? iter->second.at("TYPE") : "") + ")"; 54 | uuid_map[text] = iter->second.at("UUID"); 55 | this->append(text); 56 | if (strToLower(iter->second.at("UUID")) == strToLower(activePartition_uuid) || (activePartition_uuid == "" && iter == deviceDataList->begin() && !prependCurrentPartition)) { 57 | this->set_active_text(text); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/View/Gtk/Element/PartitionChooser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef PARTITIONCHOOSER_DROPDOWN_H_ 20 | #define PARTITIONCHOOSER_DROPDOWN_H_ 21 | #include 22 | #include 23 | #include "../../../Model/DeviceDataListInterface.h" 24 | #include 25 | 26 | class View_Gtk_Element_PartitionChooser : public Gtk::ComboBoxText { 27 | std::map uuid_map; 28 | Glib::ustring activePartition_uuid; 29 | Model_DeviceDataListInterface const* deviceDataList; 30 | bool prependCurrentPartition; 31 | std::string currentPartitionName; 32 | public: 33 | View_Gtk_Element_PartitionChooser(Glib::ustring const& activePartition_uuid, Model_DeviceDataListInterface const& deviceDataList, bool prependCurrentPartition = false, std::string const& currentPartitionName = ""); 34 | void load(); 35 | std::string getSelectedUuid() const; 36 | static std::string strToLower(std::string str); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/View/Gtk/EntryEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYEDITDLGGTK_H_ 20 | #define ENTRYEDITDLGGTK_H_ 21 | #include "../EntryEditor.h" 22 | #include "../../lib/Trait/LoggerAware.h" 23 | #include "../../lib/str_replace.h" 24 | #include 25 | #include 26 | #include "../../Controller/EntryEditController.h" 27 | #include "../../Controller/Trait/ControllerAware.h" 28 | #include "EntryEditor.h" 29 | #include "../../Model/DeviceDataListInterface.h" 30 | #include "Element/PartitionChooser.h" 31 | 32 | class View_Gtk_EntryEditor : 33 | public View_EntryEditor, 34 | public Gtk::Dialog, 35 | public Trait_LoggerAware, 36 | public Trait_ControllerAware, 37 | public Model_DeviceDataListInterface_Connection 38 | { 39 | Gtk::Notebook tabbox; 40 | Gtk::TextView tvSource; 41 | Gtk::ScrolledWindow scrSource; 42 | Gtk::ScrolledWindow scrOptions; 43 | Gtk::Table tblOptions; 44 | std::map optionMap; 45 | std::map labelMap; 46 | Gtk::ComboBoxText cbType; 47 | Gtk::Label lblType; 48 | bool lock_state; 49 | 50 | Rule* rulePtr; 51 | protected: 52 | virtual std::string mapOptionName(std::string const& name); 53 | public: 54 | View_Gtk_EntryEditor(); 55 | void setSourcecode(std::string const& source); 56 | std::string getSourcecode(); 57 | void addOption(std::string const& name, std::string const& value); 58 | void setOptions(std::map options); 59 | std::map getOptions() const; 60 | void removeOptions(); 61 | void setRulePtr(Rule* rulePtr); 62 | Rule* getRulePtr(); 63 | void show(); 64 | void hide(); 65 | 66 | void setAvailableEntryTypes(std::list const& names); 67 | void selectType(std::string const& name); 68 | std::string getSelectedType() const; 69 | 70 | void signal_response_action(int response_id); 71 | 72 | bool signal_sourceModified(GdkEventKey* event); 73 | void signal_optionsModified(); 74 | void signal_typeModified(); 75 | }; 76 | 77 | #endif /* ENTRYEDITDLGGTK_H_ */ 78 | -------------------------------------------------------------------------------- /src/View/Gtk/Error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "Error.h" 20 | 21 | View_Gtk_Error::View_Gtk_Error() 22 | { 23 | } 24 | 25 | void View_Gtk_Error::showErrorMessage(std::string const& errorMessage, bool allowContinue) { 26 | Gtk::MessageDialog msgDlg(gettext("An error occurred"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, true); 27 | msgDlg.set_secondary_text(gettext("please Inform the author about this problem. The following information could be helpful:") + std::string("\n\n") + errorMessage); 28 | msgDlg.set_title(gettext("An error occurred")); 29 | msgDlg.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE); 30 | if (allowContinue) { 31 | msgDlg.add_button(gettext("continue (risk data loss)"), Gtk::RESPONSE_CANCEL); 32 | } 33 | if (msgDlg.run() == Gtk::RESPONSE_CLOSE) { 34 | this->controller->quitAction(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/View/Gtk/Error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ERRORGTK_H_ 20 | #define ERRORGTK_H_ 21 | #include 22 | #include 23 | #include "../Error.h" 24 | #include "../../Controller/ErrorController.h" 25 | #include "../../Controller/Trait/ControllerAware.h" 26 | 27 | class View_Gtk_Error : public View_Error, public Trait_ControllerAware { 28 | public: 29 | View_Gtk_Error(); 30 | void showErrorMessage(std::string const& errorMessage, bool allowContinue); 31 | }; 32 | 33 | 34 | #endif /* ERRORGTK_H_ */ 35 | -------------------------------------------------------------------------------- /src/View/Gtk/Installer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUB_INSTALL_DLG_GTK_INCLUDED 20 | #define GRUB_INSTALL_DLG_GTK_INCLUDED 21 | #include 22 | #include "../../Controller/InstallerController.h" 23 | #include "../../Controller/Trait/ControllerAware.h" 24 | #include 25 | #include "../Installer.h" 26 | #include "../../lib/Trait/LoggerAware.h" 27 | 28 | class View_Gtk_Installer : 29 | public Gtk::Dialog, 30 | public View_Installer, 31 | public Trait_LoggerAware, 32 | public Trait_ControllerAware 33 | { 34 | Gtk::Label lblDescription; 35 | Gtk::HBox hbDevice; 36 | Gtk::Label lblDevice, lblInstallInfo; 37 | Gtk::Entry txtDevice; 38 | Glib::Dispatcher disp_grub_install_ready; 39 | void func_disp_grub_install_ready(); 40 | void signal_grub_install_dialog_response(int response_id); 41 | Glib::ustring install_result; 42 | public: 43 | View_Gtk_Installer(); 44 | void show(); 45 | void showMessageGrubInstallCompleted(std::string const& msg); 46 | }; 47 | #endif 48 | -------------------------------------------------------------------------------- /src/View/Gtk/Trash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRY_ADD_DLG_INCLUDED 20 | #define ENTRY_ADD_DLG_INCLUDED 21 | #include 22 | #include "../../Controller/TrashController.h" 23 | #include "../../Controller/Trait/ControllerAware.h" 24 | #include "../Trash.h" 25 | #include 26 | #include "../../lib/Trait/LoggerAware.h" 27 | #include "../../lib/Type.h" 28 | #include "Element/List.h" 29 | 30 | class View_Gtk_Trash : 31 | public Gtk::Window, 32 | public View_Trash, 33 | public Trait_LoggerAware, 34 | public Trait_ControllerAware 35 | { 36 | Gtk::ScrolledWindow scrEntryBox; 37 | View_Gtk_Element_List list; 38 | Gtk::Frame frmList; 39 | Gtk::VBox vbList; 40 | Gtk::HBox hbList; 41 | Gtk::Button bttRestore; 42 | Gtk::Button bttDelete; 43 | 44 | std::map options; 45 | 46 | Gtk::MenuItem miContext; 47 | Gtk::Menu contextMenu; 48 | Gtk::ImageMenuItem micRestore; 49 | Gtk::ImageMenuItem micDelete; 50 | 51 | bool event_lock; 52 | public: 53 | View_Gtk_Trash(); 54 | void signal_item_dblClick(Gtk::TreeModel::Path const& path, Gtk::TreeViewColumn* column); 55 | void restore_button_click(); 56 | void delete_button_click(); 57 | void clear(); 58 | std::list getSelectedEntries(); 59 | void addItem(View_Model_ListItem const& listItem); 60 | void setDeleteButtonEnabled(bool val); 61 | void show(); 62 | void hide(); 63 | void askForDeletion(std::list const& names); 64 | Gtk::Widget& getList(); 65 | void setDeleteButtonVisibility(bool visibility); 66 | void setOptions(std::map const& viewOptions); 67 | void selectEntries(std::list const& entries); 68 | void setRestoreButtonSensitivity(bool sensitivity); 69 | private: 70 | void signal_treeview_selection_changed(); 71 | void signal_button_press(GdkEventButton *event); 72 | bool signal_popup(); 73 | 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/View/Installer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GRUBINSTALLDLG_H_ 20 | #define GRUBINSTALLDLG_H_ 21 | 22 | /** 23 | * Interface for dialogs which helps users to install grub into the MBR 24 | */ 25 | class View_Installer { 26 | public: 27 | virtual inline ~View_Installer() {}; 28 | 29 | //show this dialog 30 | virtual void show()=0; 31 | //show the information that grub has been installed completely 32 | virtual void showMessageGrubInstallCompleted(std::string const& msg)=0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/View/Model/ListItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef MODEL_VIEW_LISTITEM_H_INCLUDED 20 | #define MODEL_VIEW_LISTITEM_H_INCLUDED 21 | #include 22 | #include 23 | 24 | template 25 | struct View_Model_ListItem { 26 | std::string name; 27 | TItem* entryPtr; 28 | TWrapper* scriptPtr; 29 | bool is_placeholder; 30 | bool is_submenu; 31 | std::string scriptName; 32 | std::string defaultName; 33 | bool isEditable; 34 | bool isModified; 35 | std::map options; 36 | bool isVisible; 37 | TItem* parentEntry; 38 | TWrapper* parentScript; 39 | 40 | View_Model_ListItem() : 41 | entryPtr(NULL), 42 | scriptPtr(NULL), 43 | parentEntry(NULL), 44 | parentScript(NULL), 45 | is_placeholder(false), 46 | is_submenu(false), 47 | isEditable(false), 48 | isModified(false), 49 | isVisible(false) 50 | {} 51 | }; 52 | 53 | 54 | #endif /* MODEL_VIEW_LISTITEM_H_INCLUDED */ 55 | -------------------------------------------------------------------------------- /src/View/Trait/ViewAware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef VIEW_VIEWAWARE_H_ 20 | #define VIEW_VIEWAWARE_H_ 21 | 22 | template 23 | class View_Trait_ViewAware { 24 | protected: 25 | T* view; 26 | public: 27 | View_Trait_ViewAware() : view(NULL) {} 28 | void setView(T& view) { 29 | this->view = &view; 30 | } 31 | }; 32 | 33 | #endif /* VIEW_VIEWAWARE_H_ */ 34 | -------------------------------------------------------------------------------- /src/View/Trash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ENTRYADDDLG_H_ 20 | #define ENTRYADDDLG_H_ 21 | 22 | #include 23 | #include 24 | #include "../lib/Type.h" 25 | #include "Model/ListItem.h" 26 | 27 | /** 28 | * Interface to be implemented by dialogs which lets the user adding scripts 29 | */ 30 | class View_Trash { 31 | public: 32 | virtual inline ~View_Trash() {}; 33 | 34 | //clear the script menu 35 | virtual void clear()=0; 36 | //gets the index of the selected script item 37 | virtual std::list getSelectedEntries()=0; 38 | //adds a new item 39 | virtual void addItem(View_Model_ListItem const& listItem)=0; 40 | //whether to active the delete button 41 | virtual void setDeleteButtonEnabled(bool val) = 0; 42 | //show this dialog 43 | virtual void show()=0; 44 | //thise this dialog 45 | virtual void hide()=0; 46 | 47 | virtual void askForDeletion(std::list const& names) = 0; 48 | 49 | virtual void setOptions(std::map const& viewOptions) = 0; 50 | 51 | virtual void selectEntries(std::list const& entries) = 0; 52 | 53 | virtual void setRestoreButtonSensitivity(bool sensitivity) = 0; 54 | 55 | virtual void setDeleteButtonVisibility(bool visibility) = 0; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/lib/ArrayStructure.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ARRAYSTRUCTURE_H_ 20 | #define ARRAYSTRUCTURE_H_ 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "str_replace.h" 27 | 28 | struct ArrayStructureItem { 29 | public: 30 | ArrayStructureItem(std::string const& value = ""); 31 | bool isArray; 32 | bool isString; 33 | std::string const& operator=(std::string const& value); 34 | std::string const& operator=(double const& value); 35 | std::string const& operator=(bool const& value); 36 | std::string const& operator=(void const* value); 37 | std::string const& operator=(char const* value); 38 | std::string const& operator=(int value); 39 | std::map const& operator=(std::map const& value); 40 | ArrayStructureItem& operator[] (std::string const& key); 41 | ArrayStructureItem& operator[] (int const& key); 42 | std::string value; 43 | std::map subItems; 44 | }; 45 | 46 | /** 47 | * used to dump objects implementing a cast to ArrayStructure 48 | * 49 | * Example of usage: 50 | * ArrayStructure test; 51 | * test["x"] = "Model_Proxy"; 52 | * test["x"]["y"]; 53 | * test["x"]["z"] = (Foo*)NULL; 54 | * test["x"]["a"] = 10.4; 55 | * test["x"]["bool1"] = true; 56 | * test["x"]["bool2"] = false; 57 | * test["a"] = "eins"; 58 | * test["null-test"] = (Foo*)NULL; 59 | 60 | * ArrayStructure subStructure; 61 | * subStructure["BLUBB"] = true; 62 | * test["SUB"] = subStructure; 63 | 64 | * var_dump(test); 65 | */ 66 | 67 | class ArrayStructure : public std::map { 68 | public: 69 | ArrayStructure(); 70 | ArrayStructure(std::list const& source); 71 | ArrayStructure(std::map const& source); 72 | }; 73 | 74 | // prefix "!" = use prefixes 75 | void var_dump(std::map const& data, std::string prefix = "", unsigned int indent = 0); 76 | 77 | #endif /* ARRAYSTRUCTURE_H_ */ 78 | -------------------------------------------------------------------------------- /src/lib/ContentParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENTPARSER_H_ 20 | #define CONTENTPARSER_H_ 21 | #include 22 | #include 23 | #include "Exception.h" 24 | 25 | class ContentParser { 26 | public: 27 | virtual inline ~ContentParser() {}; 28 | virtual void parse(std::string const& sourceCode) = 0; 29 | virtual std::map getOptions() const = 0; 30 | virtual std::string getOption(std::string const& name) const = 0; 31 | virtual void setOption(std::string const& name, std::string const& value) = 0; 32 | virtual void setOptions(std::map const& options) = 0; 33 | virtual std::string buildSource() const = 0; 34 | virtual void buildDefaultEntry(std::string const& partition_uuid) = 0; 35 | }; 36 | 37 | #endif /* CONTENTPARSER_H_ */ 38 | 39 | -------------------------------------------------------------------------------- /src/lib/ContentParser/Abstract.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "Abstract.h" 20 | 21 | std::map ContentParser_Abstract::getOptions() const { 22 | return this->options; 23 | } 24 | 25 | std::string ContentParser_Abstract::getOption(std::string const& name) const { 26 | return this->options.at(name); 27 | } 28 | 29 | void ContentParser_Abstract::setOption(std::string const& name, std::string const& value) { 30 | this->options[name] = value; 31 | } 32 | 33 | void ContentParser_Abstract::setOptions(std::map const& options) { 34 | this->options = options; 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/ContentParser/Abstract.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENT_PARSER_ABSTRACT_H_ 20 | #define CONTENT_PARSER_ABSTRACT_H_ 21 | #include 22 | #include 23 | #include "../../lib/ContentParser.h" 24 | #include "../../lib/Trait/LoggerAware.h" 25 | 26 | class ContentParser_Abstract : public ContentParser, public Trait_LoggerAware { 27 | protected: 28 | std::map options; 29 | public: 30 | virtual inline ~ContentParser_Abstract() {}; 31 | std::map getOptions() const; 32 | std::string getOption(std::string const& name) const; 33 | void setOption(std::string const& name, std::string const& value); 34 | void setOptions(std::map const& options); 35 | }; 36 | 37 | #endif /* CONTENT_PARSER_ABSTRACT_H_ */ 38 | -------------------------------------------------------------------------------- /src/lib/ContentParser/Chainloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENT_PARSER_CHAINLOADER_H_ 20 | #define CONTENT_PARSER_CHAINLOADER_H_ 21 | 22 | #include "../regex.h" 23 | #include "../../Model/DeviceMap.h" 24 | #include "Abstract.h" 25 | 26 | class ContentParser_Chainloader : public ContentParser_Abstract { 27 | static const char* _regex; 28 | Model_DeviceMap& deviceMap; 29 | std::string sourceCode; 30 | public: 31 | ContentParser_Chainloader(Model_DeviceMap& deviceMap); 32 | void parse(std::string const& sourceCode); 33 | std::string buildSource() const; 34 | void buildDefaultEntry(std::string const& partition_uuid); 35 | }; 36 | #endif /* CONTENT_PARSER_CHAINLOADER_H_ */ 37 | -------------------------------------------------------------------------------- /src/lib/ContentParser/FactoryImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | #include "FactoryImpl.h" 19 | 20 | void ContentParser_FactoryImpl::registerParser(ContentParser& parser, std::string const& name) { 21 | assert(this->parsers.size() == this->names.size()); 22 | this->parsers.push_back(&parser); 23 | this->names.push_back(name); 24 | } 25 | 26 | ContentParser* ContentParser_FactoryImpl::create(std::string const& sourceCode) { 27 | for (std::list::iterator iter = this->parsers.begin(); iter != this->parsers.end(); iter++) { 28 | try { 29 | (*iter)->parse(sourceCode); 30 | return *iter; 31 | } catch (ParserException const& e) { 32 | continue; 33 | } 34 | } 35 | throw ParserNotFoundException("no matching parser found", __FILE__, __LINE__); 36 | } 37 | 38 | 39 | ContentParser* ContentParser_FactoryImpl::createByName(std::string const& name) { 40 | assert(this->parsers.size() == this->names.size()); 41 | 42 | std::list::iterator namesIter = this->names.begin(); 43 | for (std::list::iterator parsersIter = this->parsers.begin(); parsersIter != this->parsers.end(); parsersIter++) { 44 | if (name == *namesIter) { 45 | return *parsersIter; 46 | } 47 | namesIter++; 48 | } 49 | throw ItemNotFoundException("no parser found by name '" + name + "'", __FILE__, __LINE__); 50 | } 51 | 52 | std::list const& ContentParser_FactoryImpl::getNames() const { 53 | return this->names; 54 | } 55 | 56 | std::string ContentParser_FactoryImpl::getNameByInstance(ContentParser const& instance) const { 57 | assert(this->parsers.size() == this->names.size()); 58 | 59 | std::list::const_iterator namesIter = this->names.begin(); 60 | for (std::list::const_iterator parsersIter = this->parsers.begin(); parsersIter != this->parsers.end(); parsersIter++) { 61 | if (&instance == *parsersIter) { 62 | return *namesIter; 63 | } 64 | namesIter++; 65 | } 66 | throw ItemNotFoundException("no parser found by instance pointer", __FILE__, __LINE__); 67 | } 68 | -------------------------------------------------------------------------------- /src/lib/ContentParser/FactoryImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENTPARSERFACTORYIMPL_H_ 20 | #define CONTENTPARSERFACTORYIMPL_H_ 21 | #include "../../lib/ContentParserFactory.h" 22 | #include "../../lib/ContentParser.h" 23 | #include 24 | #include "../../lib/assert.h" 25 | #include "../Exception.h" 26 | 27 | class ContentParser_FactoryImpl : public ContentParserFactory { 28 | std::list parsers; 29 | std::list names; 30 | public: 31 | void registerParser(ContentParser& parser, std::string const& name); 32 | ContentParser* create(std::string const& sourceCode); 33 | ContentParser* createByName(std::string const& name); 34 | std::list const& getNames() const; 35 | std::string getNameByInstance(ContentParser const& instance) const; 36 | }; 37 | 38 | #endif /* CONTENTPARSERFACTORYIMPL_H_ */ 39 | -------------------------------------------------------------------------------- /src/lib/ContentParser/Linux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENT_PARSER_LINUX_H_ 20 | #define CONTENT_PARSER_LINUX_H_ 21 | #include "../regex.h" 22 | #include "../../Model/DeviceMap.h" 23 | #include "Abstract.h" 24 | 25 | class ContentParser_Linux : public ContentParser_Abstract { 26 | static const char* _regex; 27 | Model_DeviceMap& deviceMap; 28 | std::string sourceCode; 29 | public: 30 | ContentParser_Linux(Model_DeviceMap& deviceMap); 31 | void parse(std::string const& sourceCode); 32 | std::string buildSource() const; 33 | void buildDefaultEntry(std::string const& partition_uuid); 34 | }; 35 | 36 | #endif /* CONTENT_PARSER_LINUX_H_ */ 37 | -------------------------------------------------------------------------------- /src/lib/ContentParser/LinuxIso.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENT_PARSER_LINUXISO_H_ 20 | #define CONTENT_PARSER_LINUXISO_H_ 21 | 22 | #include "../regex.h" 23 | #include "../../Model/DeviceMap.h" 24 | #include "Abstract.h" 25 | 26 | class ContentParser_LinuxIso : public ContentParser_Abstract { 27 | static const char* _regex; 28 | Model_DeviceMap& deviceMap; 29 | std::string sourceCode; 30 | public: 31 | ContentParser_LinuxIso(Model_DeviceMap& deviceMap); 32 | void parse(std::string const& sourceCode); 33 | std::string buildSource() const; 34 | 35 | void buildDefaultEntry(std::string const& partition_uuid); 36 | }; 37 | #endif /* CONTENT_PARSER_LINUXISO_H_ */ 38 | -------------------------------------------------------------------------------- /src/lib/ContentParser/Memtest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENT_PARSER_MEMTEST_H_ 20 | #define CONTENT_PARSER_MEMTEST_H_ 21 | 22 | #include "../regex.h" 23 | #include "../../Model/DeviceMap.h" 24 | #include "Abstract.h" 25 | 26 | class ContentParser_Memtest : public ContentParser_Abstract { 27 | static const char* _regex; 28 | Model_DeviceMap& deviceMap; 29 | std::string sourceCode; 30 | public: 31 | ContentParser_Memtest(Model_DeviceMap& deviceMap); 32 | void parse(std::string const& sourceCode); 33 | std::string buildSource() const; 34 | 35 | void buildDefaultEntry(std::string const& partition_uuid); 36 | }; 37 | #endif /* CONTENT_PARSER_MEMTEST_H_ */ 38 | -------------------------------------------------------------------------------- /src/lib/ContentParserFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CONTENTPARSERFACTORY_H_ 20 | #define CONTENTPARSERFACTORY_H_ 21 | #include "ContentParser.h" 22 | #include 23 | #include 24 | #include "Exception.h" 25 | 26 | class ContentParserFactory { 27 | public: 28 | virtual inline ~ContentParserFactory() {}; 29 | 30 | virtual ContentParser* create(std::string const& sourceCode) = 0; 31 | virtual ContentParser* createByName(std::string const& name) = 0; 32 | virtual std::list const& getNames() const = 0; 33 | virtual std::string getNameByInstance(ContentParser const& instance) const = 0; 34 | }; 35 | 36 | class ContentParserFactory_Connection { 37 | protected: 38 | ContentParserFactory* contentParserFactory; 39 | public: 40 | ContentParserFactory_Connection() : contentParserFactory(NULL) {} 41 | 42 | void setContentParserFactory(ContentParserFactory& contentParserFactory) { 43 | this->contentParserFactory = &contentParserFactory; 44 | } 45 | }; 46 | 47 | #endif /* CONTENTPARSERFACTORY_H_ */ 48 | -------------------------------------------------------------------------------- /src/lib/Exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "Exception.h" 20 | 21 | Exception::Exception(std::string const& message, std::string const& file, int line) 22 | : _message(message), _file(file), _line(line) 23 | { 24 | } 25 | 26 | Exception::operator std::string() const { 27 | std::ostringstream out; 28 | out << "exception '" << typeid(*this).name() 29 | << "'\n with message '" << this->_message; 30 | if (this->_file != "") { 31 | out << "'\n in " << this->_file << ":" << this->_line; 32 | } 33 | return out.str(); 34 | } 35 | 36 | std::string Exception::getMessage() const { 37 | return this->_message; 38 | } 39 | 40 | 41 | Exception::operator bool() const { 42 | return this->_message != ""; 43 | } 44 | -------------------------------------------------------------------------------- /src/lib/FileSystem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "FileSystem.h" 20 | 21 | void FileSystem::copy(std::string const& srcPath, std::string const& destPath, bool recursive, std::list ignoreList) { 22 | if (std::find(ignoreList.begin(), ignoreList.end(), srcPath) != ignoreList.end()) { 23 | return; 24 | } 25 | struct stat fileProperties; 26 | stat(srcPath.c_str(), &fileProperties); 27 | 28 | if (S_ISDIR(fileProperties.st_mode)) { 29 | if (!recursive) { 30 | throw LogicException(srcPath + " is an directory but copying shouldn't be recursive (recursive=false)", __FILE__, __LINE__); 31 | } 32 | DIR* dir = opendir(srcPath.c_str()); 33 | if (dir) { 34 | struct dirent *entry; 35 | mkdir(destPath.c_str(), fileProperties.st_mode); 36 | while ((entry = readdir(dir))) { 37 | if (std::string(entry->d_name) == "." || std::string(entry->d_name) == "..") { 38 | continue; 39 | } 40 | this->copy(srcPath + "/" + entry->d_name, destPath + "/" + entry->d_name, recursive, ignoreList); 41 | } 42 | closedir(dir); 43 | } else { 44 | throw FileReadException("cannot read directory: " + srcPath, __FILE__, __LINE__); 45 | } 46 | } else { 47 | std::ifstream src(srcPath.c_str(), std::ios::binary); 48 | std::ofstream dst(destPath.c_str(), std::ios::binary); 49 | dst << src.rdbuf(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/lib/FileSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef FILESYSTEM_H_ 20 | #define FILESYSTEM_H_ 21 | #include 22 | #include 23 | #include 24 | #include "Exception.h" 25 | #include 26 | #include 27 | #include 28 | 29 | class FileSystem { 30 | public: 31 | void copy(std::string const& srcPath, std::string const& destPath, bool recursive = false, std::list ignoreList = std::list()); 32 | }; 33 | 34 | #endif /* FILESYSTEM_H_ */ 35 | -------------------------------------------------------------------------------- /src/lib/Logger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | #ifndef LOGGER_H_INCLUDED 19 | #define LOGGER_H_INCLUDED 20 | 21 | #include 22 | 23 | class Logger { 24 | public: 25 | virtual inline ~Logger() {}; 26 | 27 | enum Priority { 28 | EVENT, 29 | IMPORTANT_EVENT, 30 | INFO, 31 | WARNING, 32 | ERROR, 33 | DEBUG, 34 | EXCEPTION 35 | }; 36 | virtual void log(std::string const& str, Priority prio) = 0; 37 | virtual void logActionBegin(std::string const& controller, std::string const& action) = 0; 38 | virtual void logActionEnd() = 0; 39 | virtual void logActionBeginThreaded(std::string const& controller, std::string const& action) = 0; 40 | virtual void logActionEndThreaded() = 0; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/lib/Logger/Stream.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "Stream.h" 20 | 21 | Logger_Stream::Logger_Stream(std::ostream& stream) : stream(&stream), actionStackDepth(0), logLevel(LOG_NOTHING) {} 22 | 23 | void Logger_Stream::log(std::string const& message, Logger::Priority prio) { 24 | if (prio != ERROR && ( 25 | this->logLevel == LOG_NOTHING || 26 | (this->logLevel == LOG_DEBUG_ONLY && prio != Logger::DEBUG && prio != Logger::EXCEPTION) || 27 | (this->logLevel == LOG_IMPORTANT && prio != Logger::IMPORTANT_EVENT) || 28 | (this->logLevel == LOG_EVENT && prio != Logger::EVENT && prio != Logger::IMPORTANT_EVENT))) { 29 | return; 30 | } 31 | if (prio == Logger::IMPORTANT_EVENT) { 32 | *this->stream << " *** "; 33 | } else if (prio == Logger::EVENT) { 34 | *this->stream << " * "; 35 | } else { 36 | *this->stream << " "; 37 | } 38 | 39 | if (prio == Logger::INFO) { 40 | *this->stream << "["; 41 | } 42 | *this->stream << message; 43 | if (prio == Logger::INFO) { 44 | *this->stream << "]"; 45 | } 46 | 47 | *this->stream << std::endl; 48 | } 49 | 50 | void Logger_Stream::logActionBegin(std::string const& controller, std::string const& action) { 51 | if (this->logLevel == LOG_DEBUG_ONLY || this->logLevel == LOG_VERBOSE) { 52 | actionStackDepth++; 53 | for (int i = 0; i < actionStackDepth; i++) { 54 | *this->stream << " "; 55 | } 56 | *this->stream << "-> " << controller << "/" << action << std::endl; 57 | } 58 | } 59 | void Logger_Stream::logActionEnd() { 60 | if (this->logLevel == LOG_DEBUG_ONLY || this->logLevel == LOG_VERBOSE) { 61 | if (actionStackDepth) { 62 | actionStackDepth--; 63 | } 64 | if (actionStackDepth == 0) { 65 | *this->stream << std::endl; 66 | } 67 | } 68 | } 69 | 70 | 71 | void Logger_Stream::logActionBeginThreaded(std::string const& controller, std::string const& action) { 72 | // not yet implemented 73 | } 74 | 75 | void Logger_Stream::logActionEndThreaded() { 76 | // not yet implemented 77 | } 78 | 79 | void Logger_Stream::setLogLevel(LogLevel level) { 80 | this->logLevel = level; 81 | } 82 | -------------------------------------------------------------------------------- /src/lib/Logger/Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef STREAM_LOGGER_H_ 20 | #define STREAM_LOGGER_H_ 21 | #include "../Logger.h" 22 | #include 23 | #include 24 | 25 | class Logger_Stream : public Logger { 26 | std::ostream* stream; 27 | int actionStackDepth; 28 | public: 29 | enum LogLevel { 30 | LOG_NOTHING, 31 | LOG_DEBUG_ONLY, 32 | LOG_IMPORTANT, 33 | LOG_EVENT, 34 | LOG_VERBOSE 35 | } logLevel; 36 | Logger_Stream(std::ostream& stream); 37 | void log(std::string const& message, Logger::Priority prio); 38 | void logActionBegin(std::string const& controller, std::string const& action); 39 | void logActionEnd(); 40 | void logActionBeginThreaded(std::string const& controller, std::string const& action); 41 | void logActionEndThreaded(); 42 | void setLogLevel(LogLevel level); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/lib/Mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef MUTEX_H_INCLUDED 20 | #define MUTEX_H_INCLUDED 21 | #include 22 | 23 | class Mutex { 24 | public: 25 | virtual inline ~Mutex() {}; 26 | 27 | virtual void lock() = 0; 28 | virtual bool trylock() = 0; 29 | virtual void unlock() = 0; 30 | }; 31 | 32 | class Mutex_Connection { 33 | protected: 34 | Mutex* mutex; 35 | public: 36 | Mutex_Connection() : mutex(NULL) {} 37 | 38 | void setMutex(Mutex& mutex) { 39 | this->mutex = &mutex; 40 | } 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/lib/Mutex/GLib.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "GLib.h" 20 | 21 | void Mutex_GLib::lock() { 22 | this->mutex.lock(); 23 | } 24 | 25 | bool Mutex_GLib::trylock() { 26 | return this->mutex.trylock(); 27 | } 28 | 29 | void Mutex_GLib::unlock() { 30 | this->mutex.unlock(); 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/Mutex/GLib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef GLIBMUTEX_H_ 20 | #define GLIBMUTEX_H_ 21 | #include "../Mutex.h" 22 | #include 23 | #include "../Trait/LoggerAware.h" 24 | 25 | class Mutex_GLib : public Mutex, public Trait_LoggerAware { 26 | protected: 27 | Glib::Mutex mutex; 28 | public: 29 | void lock(); 30 | bool trylock(); 31 | void unlock(); 32 | }; 33 | 34 | #endif /* GLIBMUTEX_H_ */ 35 | -------------------------------------------------------------------------------- /src/lib/Trait/ActionLoggerAware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRAIT_ACTIONLOGGERAWARE_H_ 20 | #define TRAIT_ACTIONLOGGERAWARE_H_ 21 | #include "LoggerAware.h" 22 | 23 | class Trait_ActionLoggerAware : public Trait_LoggerAware { 24 | std::string _controllerName; 25 | protected: 26 | void setControllerName(std::string const& name) { 27 | this->_controllerName = name; 28 | } 29 | 30 | void logActionBegin(std::string const& action) const { 31 | if (this->logger) { 32 | this->logger->logActionBegin(this->_controllerName, action); 33 | } 34 | } 35 | 36 | void logActionEnd() const { 37 | if (this->logger) { 38 | this->logger->logActionEnd(); 39 | } 40 | } 41 | void logActionBeginThreaded(std::string const& action) const { 42 | if (this->logger) { 43 | this->logger->logActionBeginThreaded(this->_controllerName, action); 44 | } 45 | } 46 | 47 | void logActionEndThreaded() const { 48 | if (this->logger) { 49 | this->logger->logActionEndThreaded(); 50 | } 51 | } 52 | }; 53 | 54 | 55 | #endif /* TRAIT_ACTIONLOGGERAWARE_H_ */ 56 | -------------------------------------------------------------------------------- /src/lib/Trait/LoggerAware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRAIT_LOGGERAWARE_INCLUDED 20 | #define TRAIT_LOGGERAWARE_INCLUDED 21 | 22 | #include "../Logger.h" 23 | #include "../Exception.h" 24 | 25 | class Trait_LoggerAware { 26 | protected: 27 | mutable Logger* logger; 28 | public: 29 | Trait_LoggerAware() : logger(NULL) {} 30 | 31 | void setLogger(Logger& logger) { 32 | this->logger = &logger; 33 | } 34 | 35 | Logger const& getLogger() const { 36 | if (this->logger == NULL) { 37 | throw ConfigException("missing logger"); 38 | } 39 | return *this->logger; 40 | } 41 | 42 | Logger& getLogger() { 43 | if (this->logger == NULL) { 44 | throw ConfigException("missing logger"); 45 | } 46 | return *this->logger; 47 | } 48 | 49 | Logger* getLoggerPtr() { 50 | return this->logger; 51 | } 52 | 53 | bool hasLogger() const { 54 | return this->logger != NULL; 55 | } 56 | protected: 57 | void log(std::string const& message, Logger::Priority prio) const { 58 | if (this->logger) { 59 | this->logger->log(message, prio); 60 | } 61 | } 62 | }; 63 | 64 | 65 | #endif /* TRAIT_LOGGERAWARE_INCLUDED */ 66 | -------------------------------------------------------------------------------- /src/lib/Type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TYPE_H_ 20 | #define TYPE_H_ 21 | 22 | enum ViewOption { 23 | VIEW_SHOW_DETAILS, 24 | VIEW_SHOW_HIDDEN_ENTRIES, 25 | VIEW_GROUP_BY_SCRIPT, 26 | VIEW_SHOW_PLACEHOLDERS 27 | }; 28 | 29 | // Just a basic class, no own functionality - used as storage type 30 | class Rule { 31 | public: 32 | virtual ~Rule(){} 33 | }; 34 | class Entry { 35 | public: 36 | virtual ~Entry(){} 37 | }; 38 | class Proxy { 39 | public: 40 | virtual ~Proxy(){} 41 | }; 42 | class Script { 43 | public: 44 | virtual ~Script(){} 45 | }; 46 | 47 | // to be used as dummy class 48 | class Nothing {}; 49 | 50 | #endif /* TYPE_H_ */ 51 | -------------------------------------------------------------------------------- /src/lib/assert.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "assert.h" 20 | 21 | void assert_fail(std::string const& expr, std::string const& file, int line, std::string const& func) { 22 | throw AssertException("Assertion `" + expr + "' failed. Function: " + func, file, line); 23 | } 24 | 25 | void assert_filepath_empty(std::string const& filepath, std::string const& sourceCodeFile, int line) { 26 | FILE* file = fopen(filepath.c_str(), "r"); 27 | if (file) { 28 | fclose(file); 29 | throw AssertException("found unexpected file on path: " + filepath, sourceCodeFile, line); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef ASSERT_H_ 20 | #define ASSERT_H_ 21 | 22 | /** 23 | * a custom assert implementation throwing exceptions instead of aborting directly 24 | */ 25 | 26 | #include "Exception.h" 27 | #include 28 | 29 | # define ASSERT_VOID_CAST static_cast 30 | 31 | void assert_fail(std::string const& expr, std::string const& file, int line, std::string const& func); 32 | 33 | # define assert(expr) \ 34 | ((expr) \ 35 | ? ASSERT_VOID_CAST (0) \ 36 | : assert_fail (__STRING(expr), __FILE__, __LINE__, __func__)) 37 | 38 | void assert_filepath_empty(std::string const& filepath, std::string const& sourceCodeFile, int line); 39 | 40 | #endif /* ASSERT_H_ */ 41 | -------------------------------------------------------------------------------- /src/lib/csv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef CSV_H_ 20 | #define CSV_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "str_replace.h" 28 | 29 | class CsvReader { 30 | FILE* _file; 31 | std::list _keys; 32 | std::list _parseRow(); 33 | public: 34 | CsvReader(FILE* file); 35 | std::map read(); 36 | }; 37 | 38 | class CsvWriter { 39 | FILE* _file; 40 | std::list _keys; 41 | void _writeValue(std::string const& value); 42 | public: 43 | CsvWriter(FILE* file); 44 | void write(std::map const& data); 45 | }; 46 | 47 | 48 | #endif /* CSV_H_ */ 49 | -------------------------------------------------------------------------------- /src/lib/md5.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "md5.h" 20 | 21 | std::string md5(std::string const& input) { 22 | unsigned char buf[16]; 23 | unsigned char* cStr = new unsigned char[input.length() + 1]; 24 | for (int i = 0; i < input.length(); i++) { 25 | cStr[i] = static_cast(input[i]); 26 | } 27 | MD5(cStr, input.length(), buf); 28 | 29 | std::string result; 30 | for (int i = 0; i < 16; i++) { 31 | unsigned int a = (buf[i] - (buf[i] % 16)) / 16; 32 | if (a <= 9) { 33 | result += '0' + a; 34 | } else { 35 | result += 'a' + a - 10; 36 | } 37 | unsigned int b = (buf[i] % 16); 38 | if (b <= 9) { 39 | result += '0' + b; 40 | } else { 41 | result += 'a' + b - 10; 42 | } 43 | } 44 | assert(result.length() == 32); 45 | return result; 46 | } 47 | -------------------------------------------------------------------------------- /src/lib/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | #ifndef MD5_H_INCLUDED 19 | #define MD5_H_INCLUDED 20 | 21 | #include 22 | #include 23 | #include "assert.h" 24 | 25 | std::string md5(std::string const& input); 26 | 27 | #endif /* MD5_H_ */ 28 | -------------------------------------------------------------------------------- /src/lib/regex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "regex.h" 20 | 21 | std::vector Regex::match(std::string const& pattern, std::string const& str){ 22 | std::vector result; 23 | GMatchInfo* mi = NULL; 24 | GRegex* gr = g_regex_new(pattern.c_str(), GRegexCompileFlags(0), GRegexMatchFlags(0), NULL); 25 | bool success = g_regex_match(gr, str.c_str(), GRegexMatchFlags(0), &mi); 26 | if (!success) 27 | throw RegExNotMatchedException("RegEx doesn't match", __FILE__, __LINE__); 28 | 29 | gint match_count = g_match_info_get_match_count(mi); 30 | for (gint i = 0; i < match_count; i++){ 31 | gchar* matched_string = g_match_info_fetch(mi, i); 32 | result.push_back(std::string(matched_string)); 33 | delete matched_string; 34 | } 35 | 36 | g_match_info_free(mi); 37 | g_regex_unref(gr); 38 | return result; 39 | } 40 | std::string Regex::replace(std::string const& pattern, std::string const& str, std::map const& newValues){ 41 | std::string result = str; 42 | GMatchInfo* mi = NULL; 43 | GRegex* gr = g_regex_new(pattern.c_str(), GRegexCompileFlags(0), GRegexMatchFlags(0), NULL); 44 | bool success = g_regex_match(gr, str.c_str(), GRegexMatchFlags(0), &mi); 45 | if (!success) 46 | throw RegExNotMatchedException("RegEx doesn't match", __FILE__, __LINE__); 47 | 48 | gint match_count = g_match_info_get_match_count(mi); 49 | gint offset = 0; 50 | for (std::map::const_iterator iter = newValues.begin(); iter != newValues.end(); iter++){ 51 | gint start_pos, end_pos; 52 | g_match_info_fetch_pos(mi, iter->first, &start_pos, &end_pos); 53 | if (start_pos != -1 && end_pos != -1) { //ignore unmatched (optional) values 54 | result.replace(start_pos+offset, end_pos-start_pos, iter->second); 55 | offset += iter->second.length() - (end_pos-start_pos); 56 | } 57 | } 58 | 59 | g_match_info_free(mi); 60 | g_regex_unref(gr); 61 | return result; 62 | } 63 | -------------------------------------------------------------------------------- /src/lib/regex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef REGEX_H_INCLUDED 20 | #define REGEX_H_INCLUDED 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "Exception.h" 27 | 28 | class Regex { 29 | public: 30 | static std::vector match(std::string const& pattern, std::string const& str); 31 | static std::string replace(std::string const& pattern, std::string const& str, std::map const& newValues); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/lib/str_replace.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "str_replace.h" 20 | 21 | std::string str_replace(const std::string &search, const std::string &replace, std::string subject) { 22 | size_t pos = 0; 23 | while (pos < subject.length() && (pos = subject.find(search, pos)) != -1){ 24 | subject.replace(pos, search.length(), replace); 25 | pos += replace.length(); 26 | } 27 | return subject; 28 | } 29 | 30 | std::string escapeXml(std::string const& input) { 31 | return str_replace("<", "<", str_replace("&", "&", input)); 32 | } 33 | -------------------------------------------------------------------------------- /src/lib/str_replace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef STR_REPLACE_H_ 20 | #define STR_REPLACE_H_ 21 | #include 22 | 23 | std::string str_replace(const std::string &search, const std::string &replace, std::string subject); 24 | std::string escapeXml(std::string const& input); 25 | 26 | #endif /* STR_REPLACE_H_ */ 27 | -------------------------------------------------------------------------------- /src/lib/trim.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "trim.h" 20 | 21 | std::string ltrim(std::string string, std::string const& chars) { 22 | int first = string.find_first_not_of(chars); 23 | if (first != -1) { 24 | return string.substr(first); 25 | } else { 26 | return ""; 27 | } 28 | } 29 | 30 | std::string rtrim(std::string string, std::string const& chars) { 31 | string = std::string(string.rbegin(), string.rend()); 32 | string = ltrim(string, chars); 33 | string = std::string(string.rbegin(), string.rend()); 34 | return string; 35 | } 36 | 37 | std::string trim(std::string string, std::string const& chars) { 38 | return rtrim(ltrim(string, chars)); 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/trim.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #ifndef TRIM_H_ 20 | #define TRIM_H_ 21 | 22 | #include 23 | 24 | std::string ltrim(std::string string, std::string const& chars = " \t\n\r"); 25 | std::string rtrim(std::string string, std::string const& chars = " \t\n\r"); 26 | std::string trim(std::string string, std::string const& chars = " \t\n\r"); 27 | 28 | #endif /* TRIM_H_ */ 29 | -------------------------------------------------------------------------------- /src/main/proxy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2011 Daniel Richter 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 | */ 18 | 19 | #include "../Model/Script.h" 20 | #include "../Model/Proxy.h" 21 | #include "../Model/Entry.h" 22 | #include "../Model/Rule.h" 23 | #include "../Model/ListCfg.h" // multi 24 | 25 | #include 26 | 27 | int main(int argc, char** argv){ 28 | if (argc == 2) { 29 | Model_Script script("noname", ""); 30 | Model_Entry newEntry; 31 | std::string plaintextBuffer; 32 | while (newEntry = Model_Entry(stdin, Model_Entry_Row(), NULL, &plaintextBuffer)) { 33 | script.entries().push_back(newEntry); 34 | } 35 | if (plaintextBuffer.size()) { 36 | script.entries().push_front(Model_Entry("#text", "", plaintextBuffer, Model_Entry::PLAINTEXT)); 37 | } 38 | 39 | Model_Proxy proxy; 40 | proxy.importRuleString(argv[1], ""); 41 | 42 | proxy.dataSource = &script; 43 | proxy.sync(true, true); 44 | 45 | for (std::list::iterator iter = proxy.rules.begin(); iter != proxy.rules.end(); iter++){ 46 | iter->print(std::cout); 47 | } 48 | return 0; 49 | } else if (argc == 3 && std::string(argv[2]) == "multi") { 50 | Model_Env env; 51 | Model_ListCfg scriptSource; 52 | scriptSource.setEnv(env); 53 | scriptSource.ignoreLock = true; 54 | { // this scope prevents access to the unused proxy variable - push_back takes a copy! 55 | Model_Proxy proxy; 56 | proxy.importRuleString(argv[1], env.cfg_dir_prefix); 57 | scriptSource.proxies.push_back(proxy); 58 | } 59 | scriptSource.readGeneratedFile(stdin, true, false); 60 | 61 | scriptSource.proxies.front().dataSource = &scriptSource.repository.front(); // the first Script is always the main script 62 | 63 | std::map map = scriptSource.repository.getScriptPathMap(); 64 | scriptSource.proxies.front().sync(true, true, map); 65 | 66 | for (std::list::iterator iter = scriptSource.proxies.front().rules.begin(); iter != scriptSource.proxies.front().rules.end(); iter++){ 67 | iter->print(std::cout); 68 | } 69 | } else { 70 | std::cerr << "wrong argument count. You have to give the config as parameter 1!" << std::endl; 71 | return 1; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /translation/compile_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in *.po 4 | do 5 | msgfmt -c -o `echo $i | grep -o '^[^.]*'`.mo $i 6 | done 7 | -------------------------------------------------------------------------------- /translation/translation-ar.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-ar.mo -------------------------------------------------------------------------------- /translation/translation-ast.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-ast.mo -------------------------------------------------------------------------------- /translation/translation-bg.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-bg.mo -------------------------------------------------------------------------------- /translation/translation-bs.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-bs.mo -------------------------------------------------------------------------------- /translation/translation-ca.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-ca.mo -------------------------------------------------------------------------------- /translation/translation-cs.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-cs.mo -------------------------------------------------------------------------------- /translation/translation-cy.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-cy.mo -------------------------------------------------------------------------------- /translation/translation-de.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-de.mo -------------------------------------------------------------------------------- /translation/translation-el.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-el.mo -------------------------------------------------------------------------------- /translation/translation-en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-en_GB.mo -------------------------------------------------------------------------------- /translation/translation-es.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-es.mo -------------------------------------------------------------------------------- /translation/translation-et.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-et.mo -------------------------------------------------------------------------------- /translation/translation-eu.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-eu.mo -------------------------------------------------------------------------------- /translation/translation-fi.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-fi.mo -------------------------------------------------------------------------------- /translation/translation-fr.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-fr.mo -------------------------------------------------------------------------------- /translation/translation-gl.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-gl.mo -------------------------------------------------------------------------------- /translation/translation-hr.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-hr.mo -------------------------------------------------------------------------------- /translation/translation-hu.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-hu.mo -------------------------------------------------------------------------------- /translation/translation-it.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-it.mo -------------------------------------------------------------------------------- /translation/translation-ja.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-ja.mo -------------------------------------------------------------------------------- /translation/translation-kk.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-kk.mo -------------------------------------------------------------------------------- /translation/translation-lt.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-lt.mo -------------------------------------------------------------------------------- /translation/translation-nl.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-nl.mo -------------------------------------------------------------------------------- /translation/translation-pl.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-pl.mo -------------------------------------------------------------------------------- /translation/translation-pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-pt_BR.mo -------------------------------------------------------------------------------- /translation/translation-ru.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-ru.mo -------------------------------------------------------------------------------- /translation/translation-sk.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-sk.mo -------------------------------------------------------------------------------- /translation/translation-tr.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-tr.mo -------------------------------------------------------------------------------- /translation/translation-uk.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-uk.mo -------------------------------------------------------------------------------- /translation/translation-vi.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-vi.mo -------------------------------------------------------------------------------- /translation/translation-zh_CN.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-zh_CN.mo -------------------------------------------------------------------------------- /translation/translation-zh_TW.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdeguzis/grub-customizer/d17c5ea879a46501ce8ffbb69e3db1536aa3e394/translation/translation-zh_TW.mo --------------------------------------------------------------------------------