/* * PDFedit - free program for PDF document manipulation. * Copyright (C) 2006, 2007 PDFedit team: Michal Hocko, * Miroslav Jahoda, * Jozef Misutka, * Martin Petricek * * Project is hosted on http://sourceforge.net/projects/pdfedit */ /** @file OptionWindow - widget for editing program options Options are arranged to tabs and it is ensured, that only one dialog at once is active (via Private constructor and static method to invoke the dialog, which will focus on existing dialog if it exists, instead of creating second one) @author Martin Petricek */ #include "optionwindow.h" #include #include #include #include #include #include "util.h" #include "stringoption.h" #include "realoption.h" #include "fileoption.h" #include "fontoption.h" #include "combooption.h" #include "booloption.h" #include "intoption.h" #include #include #include #include #include #include "version.h" #include "settings.h" #include "menu.h" #include "main.h" #include "toolbar.h" #include "config.h" #include namespace gui { using namespace std; /** The only Option window
Pointer to running OptionWindow instance or NULL if none active. */ OptionWindow *opt=NULL; /** Invoke option dialog. Ensure only one copy is running at time @param msystem Menu system reference for given option window (needed to get toolbar list) @param units list of available length units @param units_id list of available length unit identifiers. Same count and order as units */ void OptionWindow::optionsDialog(Menu *msystem,const QStringList &units,const QStringList &units_id) { if (opt) { //the dialog is already active opt->setActiveWindow(); } else { //create new dialog opt=new OptionWindow(msystem,units,units_id); opt->show(); } } /** Default constructor of option window. The window is initially empty @param msystem Menu system (Needed for toolbar list) @param units list of available length units @param units_id list of available length unit identifiers. Same count and order as units @param parent parent widget containing this control @param name name of widget (currently unused) */ OptionWindow::OptionWindow(Menu *msystem,const QStringList &units,const QStringList &units_id,QWidget *parent /*=0*/, const char *name /*=0*/) : QWidget(parent,name,Qt::WDestructiveClose | Qt::WType_TopLevel) { guiPrintDbg(debug::DBG_DBG,"Options creating ..."); menuSystem=msystem; setCaption(QString(APP_NAME)+" - "+tr("options")); //create list of properties in this editor; list=new QStringList(); //create option dictionary items=new Q_Dict