📄 cdmanager.cpp
字号:
//$Id: CDManager.cpp,v 1.78 2006/06/06 22:02:03 markus Rel $//PROJECT : CDManager//SUBSYSTEM : CDManager//REFERENCES ://TODO ://BUGS ://REVISION : $Revision: 1.78 $//AUTHOR : Markus Schwab//CREATED : 10.10.2004//COPYRIGHT : Copyright (C) 2004 - 2006// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#include <cdmgr-cfg.h>#include <cstring>#include <cstdlib>#include <clocale>#include <unistd.h>#include <fstream>#include <sstream>#include <gdkmm/pixbuf.h>#include <gtkmm/box.h>#include <gtkmm/stock.h>#include <gtkmm/label.h>#include <gtkmm/button.h>#include <gtkmm/scrolledwindow.h>// TRACELEVEL 1 shows shared-memory key; TRACELEVEL 9 shows password#include <YGP/File.h>#include <YGP/Check.h>#include <YGP/Trace.h>#include <YGP/INIFile.h>#include <XGP/XAbout.h>#include <XGP/XFileDlg.h>#include <XGP/LoginDlg.h>#include "Words.h"#include "CDAppl.h"#include "LangDlg.h"#include "Options.h"#include "Storage.h"#include "Settings.h"#include "Language.h"#if WITH_ACTORS == 1# include "PActors.h"#endif#if WITH_MOVIES == 1# include <YGP/Tokenize.h># include "PMovies.h"#endif#if WITH_RECORDS == 1# include "PRecords.h"#endif#if (WITH_RECORDS == 1) || (WITH_MOVIES == 1)# include <YGP/Process.h># include <YGP/Tokenize.h>#endif#include "CDManager.h"const unsigned int CDManager::WIDTH (800);const unsigned int CDManager::HEIGHT (600);const char* const CDManager::DBNAME ("CDMedia");// Pixmap for programconst char* CDManager::xpmProgram[] = { "48 48 65 1", " c None", ". c #020300", "+ c #01080B", "@ c #0B070D", "# c #160B0E", "$ c #10120F", "% c #2C0B00", "& c #1D191B", "* c #2A2520", "= c #591302", "- c #383332", "; c #4D4643", "> c #903A37", ", c #993E26", "' c #5C5A3C", ") c #5D5954", "! c #825545", "~ c #6A6C69", "{ c #AB5343", "] c #7A695A", "^ c #838160", "/ c #BB6852", "( c #9B7C70", "_ c #CE6A52", ": c #8D857F", "< c #C8734C", "[ c #95926A", "} c #C77B5F", "| c #A08F7C", "1 c #DD896A", "2 c #A8A27C", "3 c #9AA3B8", "4 c #A8A9B3", "5 c #F58F6F", "6 c #AFACA7", "7 c #BDAC8E", "8 c #BDAB99", "9 c #F49685", "0 c #C6AAA9", "a c #EC9F83", "b c #DBABA3", "c c #C3B7B7", "d c #FBAA8E", "e c #C7C1A9", "f c #D1BCAC", "g c #B9C4DF", "h c #DFC1B7", "i c #FFB897", "j c #DDC3C4", "k c #EFC0A7", "l c #C7CEC9", "m c #FCC2AA", "n c #D9D3C1", "o c #E4CFBE", "p c #E3D6D7", "q c #E1DBD6", "r c #EFD8D3", "s c #EFDAC9", "t c #FED6C0", "u c #EEDFC6", "v c #DEE5DA", "w c #EFEAD4", "x c #FAE7E2", "y c #FAEFE1", "z c #F5F1EF", " ", " ", "c. ..>{/1dimmmmddc44.. . ", "~+ @@>{{15dtutm99b64.@ @ ", "~....+>>{_55imtd__dg3..... ", "~.@@.+>>>,<55dm__}agg..@.. ", "~@ @.@@@@.@@@@@@@+@@.. . ", "~. ..@@+..+.$#@+++.... @ ", "~@..@+#%=,{/}11dddmg3@.... ", "~..@...=,{//}1adddd33#.@.. ", "~@ .#%>{}{/}1daddm33.. . ", "~. ..>{/}////a}_}433@. @ ", "~@...+>{/}}//<}1<9433@.... ", "~..@@.{{}1aaa<amad344.@@.. ", "~@ +.>{/1diktmmdac44.. . ", "~. .+>{{15itttt99bc4.. .#&@.@& ", "~@.@.+>>{_55imtd__d33..*-;:bn8^)-*# ", "~....+>>>,/55ii__}bg3$-|fb0oyf80|:)$ ", "~@ .+++@..@@@@+@##@&:ssuh0hof887hh^*$ ", "~. ..#@.@.+.+++++$*:zzwso0hsf8(fff2^*$ ", "~@..@+#%=,{/}1add}-0rxxzuo0jsf68fo72[^*# ", "~..@.#.=,{//}11d9;:xrxxxsuhhof78u72[[[^$ ", "~@ .@%,{////1da()jxrrxxxuocs88fe2[[[[7]& ", "~. ..>><}/}/}1}-jxxxxrrzzo0o88f7[[^2b8b* ", "~@...+>{/}}//<}!)syxxxxrrxzzzzqo[[[7k0rs|& ", "~..@@+{{}1aa1}a!|uutyxyxrzzzzqzv7[8hhsuyu* ", "*+ ++>{/1ditkk;8hhsssuyzzl)-;:vzkhwwwwvv)& ", " @-0b00bhtuzz)&***6zywwwvvvq~+ ", " ;0hhhh0jry6-&-&-:zzlvlllll:+ ", " ;osysosopzc-&*--~zveeelele~+ ", " ;effff878zc)----lzzle7e7e7)# ", " -|888888fqz4);-6zzppqvnlee;$ ", " +]860|6fe2vvzzzzzwsrppqqvl$@ ", " @;|77hoe2[[qzzzzrpurrrrpq:$ ", " +|hof72[28rvlelsruuoqprj-& ", " &;ee72[[[8svleelrrouurr:*@ ", " &]22[[[7huvvlelrrruuuf&@ ", " ##^[[[|7hywle7nprrsue;## ", " &$'[[8hrwvll7elprrh*&+ ", " .@'[khuwqlllelpj:-&. ", " .@&(fwwvlle7e4)#$$ ", " ##&-~8ll6[);*### ", " @+&&+++$+&@+ ", " $.++@+++ ", " ", " ", " ", " "};// Pixmap for authorconst char* CDManager::xpmAuthor[] = { "56 43 5 1", " c None", "! c #0000FF", "@ c #000000", "- c #AEAAAE", ". c #FFFFFF", ".......................................................@", "..-----------------------------------------------------@", "..-----------------------------------------------------@", "..----------------------!!!!!!-------------------------@", "..--------------------!!!!@@!!!!-----------------------@", "..------------------!!!!@@---@@!!!---------------------@", "..-----------------!!!@@--------!!!--------------------@", "..-----------------!!!@---!!----!!!--------------------@", "..----------------!!!@---!!!!@---!!!-------------------@", "..----------------!!@---!!!!!!@---!!@------------------@", "..----------------!!@----!!!!@----!!@------------------@", "..----------------!!!-----!!@----!!!@------------------@", "..-----------------!!!-----@-----!!!@------------------@", "..-----------------!!!!---------!!!@-------------------@", "..------------------!!!!-------!!!@--------------------@", "..--------------------!!!!--!!!!@@---------------------@", "..----------------------!!!!!!@@-----------------------@", "..-----------------------!!!!@-------------------------@", "..------------------------!!@--------------------------@", "..------------------------!!@--------------------------@", "..------------------!!!!!!!!!!!!!!---------------------@", "..-----------------!!!!!!!!!!!!!!!!--------------------@", "..----------------!!!@@@@@!!@@@@@!!!-------------------@", "..----------------!!@-----!!@-----!!@------------------@", "..----------------!!@-----!!@-----!!@------------------@", "..----------------!!@-----!!@-----!!@------------------@", "..----------------!!@-----!!@-----!!@------------------@", "..-----------------@@-----!!@------@@------------------@", "..------------------------!!@--------------------------@", "..--------------------!!!!!!!!!!-----------------------@", "..------------------!!!!!!!!!!!!!!---------------------@", "..-----------------!!!@@@@@@@@@!!!!--------------------@", "..-----------------!!@----------!!!!-------------------@", "..----------------!!!@-----------!!!@------------------@", "..----------------!!@------------!!!@------------------@", "..----------------!!@-------------!!@------------------@", "..----------------!!@-------------!!@------------------@", "..----------------!@--------------!!@------------------@", "..----------------!!@--------------@@------------------@", "..-----------------!@----------------------------------@", "..------------------@----------------------------------@", "..-----------------------------------------------------@", "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" };//-----------------------------------------------------------------------------/// Defaultconstructor; all widget are created/// \param options: Options for the program/// \param user: User for database/// \param pwd: Password for DB//-----------------------------------------------------------------------------CDManager::CDManager (Options& options) : XApplication (PACKAGE " V" PRG_RELEASE), opt (options) { TRACE8 ("CDManager::CDManager (Options&)"); Language::init (); setIconProgram (xpmProgram); set_default_size (WIDTH, HEIGHT); // Create controls Glib::ustring ui ("<ui><menubar name='Menu'>" " <menu action='CD'>" " <menuitem action='Login'/>" " <menuitem action='SaveDB'/>" " <menuitem action='Logout'/>"#if (WITH_RECORDS == 1) || (WITH_MOVIES == 1) " <separator/>" " <menuitem action='Export'/>"#endif#if WITH_RECORDS == 1 " <menuitem action='Import'/>"#endif " <separator/>" " <menuitem action='FQuit'/>" " </menu>" " <menu action='Edit'>" " <placeholder name='EditAction'/>" " </menu>" " <placeholder name='Other'/>" " <menu action='Options'>" " <menuitem action='Prefs'/>" " <menuitem action='SavePrefs'/>" " </menu>"); grpAction->add (Gtk::Action::create ("CD", _("_CD"))); grpAction->add (apMenus[LOGIN] = Gtk::Action::create ("Login", _("_Login")), Gtk::AccelKey (_("<ctl>L")), mem_fun (*this, &CDManager::showLogin)); grpAction->add (apMenus[SAVE] = Gtk::Action::create ("SaveDB", Gtk::Stock::SAVE), mem_fun (*this, &CDManager::save)); grpAction->add (apMenus[LOGOUT] = Gtk::Action::create ("Logout", _("Log_out")), Gtk::AccelKey (_("<ctl>O")), mem_fun (*this, &CDManager::logout));#if (WITH_RECORDS == 1) || (WITH_MOVIES == 1) grpAction->add (apMenus[EXPORT] = Gtk::Action::create ("Export", _("_Export to HTML")), Gtk::AccelKey (_("<ctl>E")), mem_fun (*this, &CDManager::export2HTML));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -