diff options
Diffstat (limited to 'addon/doxywizard')
-rw-r--r-- | addon/doxywizard/Makefile.in | 52 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard.pro.in | 52 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard.t | 45 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard_templ.cpp | 348 | ||||
-rw-r--r-- | addon/doxywizard/doxywizard_templ.h | 75 | ||||
-rw-r--r-- | addon/doxywizard/inputbool.cpp | 42 | ||||
-rw-r--r-- | addon/doxywizard/inputbool.h | 42 | ||||
-rw-r--r-- | addon/doxywizard/inputint.cpp | 67 | ||||
-rw-r--r-- | addon/doxywizard/inputint.h | 51 | ||||
-rw-r--r-- | addon/doxywizard/inputstring.cpp | 184 | ||||
-rw-r--r-- | addon/doxywizard/inputstring.h | 66 | ||||
-rw-r--r-- | addon/doxywizard/inputstrlist.cpp | 210 | ||||
-rw-r--r-- | addon/doxywizard/inputstrlist.h | 69 | ||||
-rw-r--r-- | addon/doxywizard/pagewidget.cpp | 86 | ||||
-rw-r--r-- | addon/doxywizard/pagewidget.h | 63 | ||||
-rw-r--r-- | addon/doxywizard/pixmaps.cpp | 204 | ||||
-rw-r--r-- | addon/doxywizard/pixmaps.h | 26 | ||||
-rw-r--r-- | addon/doxywizard/version.cpp | 1 | ||||
-rw-r--r-- | addon/doxywizard/version.h | 6 |
19 files changed, 1689 insertions, 0 deletions
diff --git a/addon/doxywizard/Makefile.in b/addon/doxywizard/Makefile.in new file mode 100644 index 0000000..4e8779b --- /dev/null +++ b/addon/doxywizard/Makefile.in @@ -0,0 +1,52 @@ +# +# +# +# Copyright (C) 1997-2000 by Dimitri van Heesch. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation under the terms of the GNU General Public License is hereby +# granted. No representations are made about the suitability of this software +# for any purpose. It is provided "as is" without express or implied warranty. +# See the GNU General Public License for more details. +# + +CFGGENBIN_DIR = ../configgen/bin +CFGGENSRC_DIR = ../configgen + +all: $(CFGGENBIN_DIR)/configgen config.h config.l doxywizard.cpp doxywizard.h \ + Makefile.doxywizard + $(MAKE) -f Makefile.doxywizard $@ + +Makefile.doxywizard: doxywizard.pro doxywizard.t + $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard + +config.l: $(CFGGENBIN_DIR)/configgen $(CFGGENSRC_DIR)/config_templ.l + $(CFGGENBIN_DIR)/configgen $(CFGGENSRC_DIR)/config_templ.l >config.l + +config.h: $(CFGGENBIN_DIR)/configgen $(CFGGENSRC_DIR)/config_templ.h + $(CFGGENBIN_DIR)/configgen $(CFGGENSRC_DIR)/config_templ.h >config.h + +doxywizard.cpp: $(CFGGENBIN_DIR)/configgen doxywizard_templ.cpp + $(CFGGENBIN_DIR)/configgen doxywizard_templ.cpp >doxywizard.cpp + +doxywizard.h: $(CFGGENBIN_DIR)/configgen doxywizard_templ.h + $(CFGGENBIN_DIR)/configgen doxywizard_templ.h >doxywizard.h + +$(CFGGENBIN_DIR)/configgen: $(CFGGENSRC_DIR)/configgen.cpp + $(MAKE) -C $(CFGGENSRC_DIR) + +tmake: + $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard + +clean: Makefile.doxywizard + $(MAKE) -f Makefile.doxywizard clean + +distclean: clean + $(RM) doxywizard.cpp doxywizard.h \ + config.l config.h config.cpp Makefile.doxywizard + +install: + $(INSTTOOL) -d $(INSTALL)/bin + $(INSTTOOL) -m 755 ../../bin/doxywizard $(INSTALL)/bin + +FORCE: diff --git a/addon/doxywizard/doxywizard.pro.in b/addon/doxywizard/doxywizard.pro.in new file mode 100644 index 0000000..36b9639 --- /dev/null +++ b/addon/doxywizard/doxywizard.pro.in @@ -0,0 +1,52 @@ +# +# +# +# Copyright (C) 1997-2000 by Dimitri van Heesch. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation under the terms of the GNU General Public License is hereby +# granted. No representations are made about the suitability of this software +# for any purpose. It is provided "as is" without express or implied warranty. +# See the GNU General Public License for more details. +# +# project file for the doxywizard project + +# special template configuration file because we use flex +TEMPLATE = doxywizard.t + +# executable to generate +TARGET = ../../bin/doxywizard + +# configure options +CONFIG = qt warn_on $extraopts + +# header file for the project +HEADERS = doxywizard.h \ + config.h \ + version.h \ + pagewidget.h \ + inputstring.h \ + inputbool.h \ + inputstrlist.h \ + inputint.h \ + pixmaps.h + +# source flle for the project +SOURCES = doxywizard.cpp \ + config.cpp \ + version.cpp \ + pagewidget.cpp \ + inputstring.cpp \ + inputbool.cpp \ + inputstrlist.cpp \ + inputint.cpp \ + pixmaps.cpp + +# where to put the objects +OBJECTS_DIR = obj + +# where to put the intermediate moc stuff +MOC_DIR = moc + +# extra C++ compiler options +TMAKE_CXXFLAGS = -DDOXYWIZARD diff --git a/addon/doxywizard/doxywizard.t b/addon/doxywizard/doxywizard.t new file mode 100644 index 0000000..bebb1be --- /dev/null +++ b/addon/doxywizard/doxywizard.t @@ -0,0 +1,45 @@ +# +# +# +# Copyright (C) 2000 by Dimitri van Heesch. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation under the terms of the GNU General Public License is hereby +# granted. No representations are made about the suitability of this software +# for any purpose. It is provided "as is" without express or implied warranty. +# See the GNU General Public License for more details. +#! +#! wizard.t: This is a custom template for building doxywizard +#! +#$ IncludeTemplate("app.t"); + +LEX = flex +YACC = bison + +#${ +sub GenerateDep { + my($obj,$src,$dep) = @_; + my(@objv,$srcv,$i,$s,$o,$d,$c); + @objv = split(/\s+/,$obj); + @srcv = split(/\s+/,$src); + for $i ( 0..$#objv ) { + $s = $srcv[$i]; + $o = $objv[$i]; + next if $s eq ""; + $text .= $o . ": " . $s; + $text .= " ${linebreak}\n\t\t" . $dep if $dep ne ""; + if ( $moc_output{$s} ne "" ) { + $text .= " ${linebreak}\n\t\t" . $moc_output{$s}; + } + $d = &make_depend($s); + $text .= " ${linebreak}\n\t\t" . $d if $d ne ""; + $text .= "\n"; + } + chop $text; +} +#$} + +#################### + +#$ GenerateDep("config.cpp","config.l"); + $(LEX) -PconfigYY -t config.l >config.cpp diff --git a/addon/doxywizard/doxywizard_templ.cpp b/addon/doxywizard/doxywizard_templ.cpp new file mode 100644 index 0000000..4ec430d --- /dev/null +++ b/addon/doxywizard/doxywizard_templ.cpp @@ -0,0 +1,348 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include <stdio.h> +#include <qmainwindow.h> +#include <qpopupmenu.h> +#include <qfileinfo.h> +#include <qmenubar.h> +#include <qstatusbar.h> +#include <qfiledialog.h> +#include <qmessagebox.h> +#include <qapplication.h> +#include <qwhatsthis.h> +#include <qlayout.h> +#include <qtabwidget.h> +#include <qtoolbar.h> +#include <qtoolbutton.h> + +#include "doxywizard.h" +#include "pagewidget.h" +#include "inputbool.h" +#include "inputstring.h" +#include "inputstrlist.h" +#include "inputint.h" +#include "config.h" +#include "version.h" +#include "pixmaps.h" + +QString configFileName; + +const int messageTimeout = 4000; //!< status bar message timeout in millisec. + +//------------------------------------------------------------------------- + +static bool loadConfig( QString loadFile ) +{ + QFileInfo fi( loadFile ); + if ( !fi.exists() ) + { + QMessageBox::warning(0, + "Warning","Input file "+loadFile+ + " does not exist! Starting new file.", + "ok" + ); + return FALSE; + } + QFile f( loadFile ); + if ( !f.open(IO_ReadOnly) ) + { + QMessageBox::warning(0, + "Warning","Cannot open input "+loadFile+ + " for reading!.", + "abort" + ); + exit(1); + } + + // set config values to their defaults + Config::init(); + + // read file into a string buffer + int fsize = fi.size(); + QCString contents(fsize+1); // add room for \0 terminator + f.readBlock(contents.data(),fsize); + contents[fsize]='\0'; + + // parse the config file + // this will initialize the various Config data members + parseConfig(contents); + configStrToVal(); + + f.close(); + return TRUE; +} + +static bool saveConfig( QString saveFile ) +{ + QFile f( saveFile ); + if ( !f.open(IO_WriteOnly) ) + { + QMessageBox::warning(0, + "Warning","Cannot open file "+saveFile+ + " for writing. Nothing saved!.", + "ok" + ); + return FALSE; // failure + } + + writeTemplateConfig(&f,TRUE); // write brief config file + + return TRUE; // success +} + +//-------------------------------------------------------------------------- + +Wizard::Wizard(int argc,char **argv) : + QMainWindow( 0, (QCString)"DoxyWizard v"+versionString ) +{ + // File popupmenu + + hasChanged=FALSE; + + fileTools = new QToolBar( this, "file operations" ); + fileTools->setLabel( "File Operations" ); + + new QToolButton( QPixmap( file_xpm ), "New File", QString::null, + this, SLOT(newFile()), fileTools, "new file" ); + + //QToolButton * fileOpen = + new QToolButton( QPixmap( fileopen_xpm ), "Open File", QString::null, + this, SLOT(loadFile()), fileTools, "open file" ); + + //QToolButton * fileSave = + new QToolButton( QPixmap( filesave_xpm ), "Save File", QString::null, + this, SLOT(saveFile()), fileTools, "save file" ); + + + QWhatsThis::whatsThisButton( fileTools ); + + QPopupMenu* file = new QPopupMenu; + file->insertItem( QIconSet(QPixmap(file_xpm)), + "&New", this, SLOT(newFile()), CTRL+Key_N ); + file->insertItem( QIconSet(QPixmap(fileopen_xpm)), + "&Load", this, SLOT(loadFile()), CTRL+Key_O ); + file->insertSeparator(); + file->insertItem( QIconSet(QPixmap(filesave_xpm)), + "&Save", this, SLOT(saveFile()), CTRL+Key_S ); + file->insertItem( "&Save as ...", this, SLOT(saveAsFile()) ); + file->insertSeparator(); + file->insertItem( "&Quit", this, SLOT(quit()), CTRL+Key_Q ); + + // Doxygen popupmenu + //QPopupMenu* doxygen = new QPopupMenu; + //int itemIndex = doxygen->insertItem( "&Run" ); + //doxygen->setWhatsThis ( itemIndex, "Run doxygen with the current configuration file..." ); + //doxygen->setItemEnabled( itemIndex, FALSE ); + + // Help popupmenu + QPopupMenu* help = new QPopupMenu; + help->insertItem( "&About", this, SLOT(about()), Key_F1 ); + help->insertItem( "What's &This", this , SLOT(whatsThis()), SHIFT+Key_F1); + + // menubar definition + menuBar()->insertItem( "&File", file ); + //menuBar()->insertItem( "&Doxygen", doxygen ); + menuBar()->insertSeparator(); + menuBar()->insertItem( "&Help", help ); + + statusBar()->message("Welcome to DoxyWizard",messageTimeout); + + cw = new ConfigFile( this ); + connect(cw,SIGNAL(changed()),this,SLOT(changed())); + setCentralWidget( cw ); + cw->show(); + + if (argc==2) + { + loadFile(argv[1]); + } + else + { + newFile(); + } + refreshCaption(); + + resize( 640, 480 ); + +} + +void Wizard::newFile() +{ + if (hasChanged) + { + switch( QMessageBox::warning( this, "DoxyWizard", "Start a new file and lose changes?\n", + "Yes", "No", 0, 0, 1 )) + { + case 0: + break; + default: // command aborted by the user + return; + } + } + Config::init(); + configFileName="Doxyfile"; + cw->init(); +} + +void Wizard::loadFile(const char *fileName) +{ + if (fileName==0) + { + configFileName = QFileDialog::getOpenFileName(); + } + else + { + configFileName = fileName; + } + + if ( !configFileName.isNull() ) + { + //initData( configFileName ); + loadConfig(configFileName); + cw->init(); + + statusBar()->message(configFileName, messageTimeout); + } +} + +void Wizard::loadFile() +{ + if (hasChanged) + { + switch( QMessageBox::warning( + this, "DoxyWizard", "Load a new file and lose changes?\n", + "Yes", "No", 0, 0, 1 )) + { + case 0: + break; + default: // command aborted by the user + return; + } + } + loadFile(0); +} + +void Wizard::saveFile() +{ + //printf("configFileName=`%s'\n",configFileName.data()); + if (configFileName.isEmpty()) + { + saveAsFile(); + return; + } + else + { + saveConfig(configFileName); + statusBar()->message(configFileName + " saved", messageTimeout); + } + hasChanged = FALSE; + refreshCaption(); +} + +void Wizard::saveAsFile() +{ + configFileName = QFileDialog::getSaveFileName(); + if (configFileName.isNull()) + { + statusBar()->message("Save aborted", messageTimeout ); + return; // operation cancelled by the user + } + + saveConfig(configFileName); + statusBar()->message("Saved as "+ configFileName, messageTimeout ); + hasChanged = FALSE; + refreshCaption(); +} + +void Wizard::quit() +{ + if (hasChanged) + { + switch( QMessageBox::warning( this, "DoxyWizard", "Quit and lose changes?\n", + "Yes", "No", 0, 0, 1 )) + { + case 0: + qApp->quit(); + break; + case 1: + break; + } + } + else + { + qApp->quit(); + } +} + +void Wizard::changed() +{ + hasChanged = TRUE; + refreshCaption(); +} + +void Wizard::refreshCaption() +{ + QString s; + if (hasChanged) s=" *"; + setCaption("Doxywizard - ["+configFileName+s+"]"); +} + +void Wizard::about() +{ + QMessageBox::about(this, "DoxyWizard", + "<qt><center>A tool to create and edit configuration files " + "that can be read by doxygen.</center><p>" + "<center>Written by Dimitri van Heesch</center><p>" + "<center>(c) 2000</center></qt>" + ); +} + +//---------------------------------------------------------------------- + +ConfigFile::ConfigFile( QWidget *parent ) : QWidget( parent ) +{ + QVBoxLayout *layout = new QVBoxLayout( this ); + + // QTabWidget definition + QTabWidget *tab = new QTabWidget( this ); + layout->addWidget( tab ); + +#CONFIG Widgets0 +#CONFIG Widgets1 + +} + +ConfigFile::~ConfigFile() +{ +} + +#CONFIG WidgetSlotImpl + +void ConfigFile::init() +{ +#CONFIG WidgetInit +} + +//---------------------------------------------------------------------- + +int main(int argc,char **argv) +{ + QApplication::setColorSpec( QApplication::NormalColor ); + QApplication app(argc,argv); + Wizard wizard(argc,argv); + app.setMainWidget( &wizard ); + wizard.show(); + return app.exec(); +} diff --git a/addon/doxywizard/doxywizard_templ.h b/addon/doxywizard/doxywizard_templ.h new file mode 100644 index 0000000..e0c228e --- /dev/null +++ b/addon/doxywizard/doxywizard_templ.h @@ -0,0 +1,75 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _DOXWIZARD_H +#define _DOXWIZARD_H + +#include <qmainwindow.h> + +class QToolBar; +class ConfigFile; +class InputBool; +class InputString; +class InputStrList; +class InputFile; +class InputDir; +class InputInt; + +class Wizard : public QMainWindow +{ + Q_OBJECT + + public: + Wizard(int argc,char **argv); + ~Wizard(){}; + void loadFile(const char *s); + + private slots: + void newFile(); + void loadFile(); + void saveFile(); + void saveAsFile(); + void quit(); + void changed(); + void about(); + + signals: + + private: + void refreshCaption(); + QToolBar *fileTools; + bool hasChanged; + ConfigFile *cw; +}; + +class ConfigFile : public QWidget +{ + Q_OBJECT + + public: + ConfigFile(QWidget *parent=0); + ~ConfigFile(); + void init(); + + signals: + void changed(); + + private slots: +#CONFIG WidgetSlots + + private: +#CONFIG WidgetVars +}; + +#endif diff --git a/addon/doxywizard/inputbool.cpp b/addon/doxywizard/inputbool.cpp new file mode 100644 index 0000000..b0db14b --- /dev/null +++ b/addon/doxywizard/inputbool.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include "inputbool.h" +#include "pagewidget.h" +#include <qwindowsstyle.h> + +InputBool::InputBool( const QString & text, PageWidget * parent, bool &flag ) + : QCheckBox( text, parent->getLayout() ), state(flag) +{ + QWindowsStyle *winStyle = new QWindowsStyle(); + setChecked( flag ); + setStyle( winStyle ); + setMinimumSize( sizeHint() ); + + connect( this, SIGNAL(toggled(bool)), SLOT(setState(bool)) ); + + parent->addWidget(this); +} + +void InputBool::init() +{ + setChecked(state); +} + +void InputBool::setState( bool s ) +{ + if (state!=s) emit changed(); + state=s; +} + diff --git a/addon/doxywizard/inputbool.h b/addon/doxywizard/inputbool.h new file mode 100644 index 0000000..9102be7 --- /dev/null +++ b/addon/doxywizard/inputbool.h @@ -0,0 +1,42 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _INPUTBOOL_H +#define _INPUTBOOL_H + +#include <qcheckbox.h> + +class PageWidget; + +class InputBool : public QCheckBox +{ + Q_OBJECT + + public: + InputBool( const QString &text, PageWidget *parent, bool &flag ); + ~InputBool(){}; + void init(); + + signals: + void changed(); + + private slots: + void setState(bool); + + private: + bool &state; + +}; + +#endif diff --git a/addon/doxywizard/inputint.cpp b/addon/doxywizard/inputint.cpp new file mode 100644 index 0000000..54d7d02 --- /dev/null +++ b/addon/doxywizard/inputint.cpp @@ -0,0 +1,67 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include "inputint.h" +#include "pagewidget.h" + +#include <stdio.h> +#include <stdlib.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qwindowsstyle.h> +#include <qspinbox.h> + +InputInt::InputInt( const QString & label, PageWidget *parent, int &val, int minVal,int maxVal ) + : QWidget( parent->getLayout() ), m_val(val), m_minVal(minVal), m_maxVal(maxVal) +{ + QHBoxLayout *layout = new QHBoxLayout( this, 5 ); + + lab = new QLabel( label, this ); + lab->setMinimumSize( lab->sizeHint() ); + + sp = new QSpinBox( minVal,maxVal,1,this ); + sp->setMinimumSize( sp->sizeHint() ); + + init(); + + layout->addWidget( lab ); + layout->addWidget( sp ); + layout->addStretch(1); + layout->activate(); + setMinimumSize( sizeHint() ); + + connect(sp, SIGNAL(valueChanged(int)), + this, SLOT(valueChanged(int)) ); + + parent->addWidget(this); +} + +void InputInt::valueChanged(int val) +{ + if (val!=m_val) emit changed(); + m_val = val; +} + +void InputInt::setEnabled(bool state) +{ + lab->setEnabled(state); + sp->setEnabled(state); +} + +void InputInt::init() +{ + m_val = QMAX(m_minVal,m_val); + m_val = QMIN(m_maxVal,m_val); + sp->setValue(m_val); +} diff --git a/addon/doxywizard/inputint.h b/addon/doxywizard/inputint.h new file mode 100644 index 0000000..ad6d2de --- /dev/null +++ b/addon/doxywizard/inputint.h @@ -0,0 +1,51 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _INPUTINT_H +#define _INPUTINT_H + +#include <qwidget.h> +#include <qstring.h> + +class QLabel; +class QSpinBox; +class PageWidget; + +class InputInt : public QWidget +{ + Q_OBJECT + + public: + InputInt( const QString &text, PageWidget *parent, int &val, + int minVal, int maxVal ); + ~InputInt(){}; + void setEnabled(bool); + void init(); + + private: + QLabel *lab; + QSpinBox *sp; + int &m_val; + int m_minVal; + int m_maxVal; + + signals: + void changed(); + + private slots: + void valueChanged(int val); + +}; + +#endif diff --git a/addon/doxywizard/inputstring.cpp b/addon/doxywizard/inputstring.cpp new file mode 100644 index 0000000..2895a18 --- /dev/null +++ b/addon/doxywizard/inputstring.cpp @@ -0,0 +1,184 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include "inputstring.h" +#include "pagewidget.h" +#include "pixmaps.h" + +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qwindowsstyle.h> +#include <qcstring.h> +#include <qpushbutton.h> +#include <qfiledialog.h> +#include <qcombobox.h> +#include <qtooltip.h> + + +InputString::InputString( const QString & label, + PageWidget *parent, QCString &s, StringMode m ) + : QWidget( parent->getLayout() ), str(s), sm(m), m_values(0), m_index(0) +{ + if (m==StringFixed) + { + QHBoxLayout *layout = new QHBoxLayout( this, 5); + lab = new QLabel( label, this ); + lab->setMinimumSize( lab->sizeHint() ); + layout->addWidget( lab ); + com = new QComboBox( this ); + layout->addWidget( com ); + layout->addStretch( 1 ); + le=0; + br=0; + layout->activate(); + setMinimumSize( sizeHint() ); + } + else + { + QGridLayout *layout = new QGridLayout( this, 1, m==StringFree ? 1 : 3, 5 ); + lab = new QLabel( label, this ); + lab->setMinimumSize( lab->sizeHint() ); + layout->addWidget( lab,0,0 ); + le = new QLineEdit( this ); + le->setMinimumSize( le->sizeHint() ); + le->setText( s ); + layout->addWidget( le,0,1 ); + if (m==StringFile || m==StringDir) + { + QPixmap pixmap = QPixmap(m==StringFile ? + file_xpm : + folder_xpm ); + br = new QPushButton( this ); + br->setPixmap(pixmap); + br->setMinimumSize( br->sizeHint() ); + if (m==StringFile) + QToolTip::add(br,"Browse to a file"); + else + QToolTip::add(br,"Browse to a folder"); + layout->addWidget( br,0,2 ); + } + else + { + br=0; + } + com=0; + layout->activate(); + setMinimumSize( sizeHint() ); + } + + if (le) connect( le, SIGNAL(textChanged(const QString&)), + this, SLOT(textChanged(const QString&)) ); + if (br) connect( br, SIGNAL(clicked()), this, SLOT(browse()) ); + if (com) connect( com, SIGNAL(activated(const QString &)), + this, SLOT(textChanged(const QString &)) ); + + parent->addWidget(this); +} + +InputString::~InputString() +{ + if (m_values) delete m_values; +} + + +void InputString::textChanged(const QString &s) +{ + if (str!=(const char *)s) + { + str = s; + emit changed(); + } +} + +void InputString::setEnabled(bool state) +{ + lab->setEnabled(state); + if (le) le->setEnabled(state); + if (br) br->setEnabled(state); + if (com) com->setEnabled(state); +} + +void InputString::browse() +{ + if (sm==StringFile) + { + QString fileName = QFileDialog::getOpenFileName(); + + if (!fileName.isNull()) + { + le->setText( fileName ); + if (str!=(const char *)le->text()) + { + str = le->text(); + emit changed(); + } + } + } + else // sm==StringDir + { + QString dirName = QFileDialog::getExistingDirectory(); + + if (!dirName.isNull()) + { + le->setText( dirName ); + if (str!=(const char *)le->text()) + { + str = le->text(); + emit changed(); + } + } + } +} + +void InputString::clear() +{ + le->setText(""); + if (!str.isEmpty()) + { + emit changed(); + str = ""; + } +} + +void InputString::addValue(const char *s) +{ + if (sm==StringFixed) + { + if (m_values==0) m_values = new QDict<int>; + m_values->setAutoDelete(TRUE); + m_values->insert(s,new int(m_index++)); + com->insertItem(s); + } +} + +void InputString::init() +{ + if (sm==StringFixed) + { + int *itemIndex = m_values->find(str); + if (itemIndex) + { + com->setCurrentItem(*itemIndex); + } + else + { + com->setCurrentItem(0); + } + } + else + { + le->setText(str); + } +} diff --git a/addon/doxywizard/inputstring.h b/addon/doxywizard/inputstring.h new file mode 100644 index 0000000..5928b80 --- /dev/null +++ b/addon/doxywizard/inputstring.h @@ -0,0 +1,66 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _INPUTSTRING_H +#define _INPUTSTRING_H + +#include <qwidget.h> +#include <qstring.h> +#include <qdict.h> + +class QLabel; +class QLineEdit; +class QPushButton; +class QComboBox; +class PageWidget; + +class InputString : public QWidget +{ + Q_OBJECT + + public: + enum StringMode { StringFree=0, + StringFile=1, + StringDir=2, + StringFixed=3 + }; + + InputString( const QString &text, PageWidget *parent, QCString &s, + StringMode m=StringFree ); + ~InputString(); + void setEnabled(bool); + void addValue(const char *s); + void init(); + + private: + QLabel *lab; + QLineEdit *le; + QPushButton *br; + QComboBox *com; + QCString &str; + StringMode sm; + QDict<int> *m_values; + int m_index; + + signals: + void changed(); + + private slots: + void textChanged(const QString&); + void browse(); + void clear(); + +}; + +#endif diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp new file mode 100644 index 0000000..60bc4bf --- /dev/null +++ b/addon/doxywizard/inputstrlist.cpp @@ -0,0 +1,210 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include "inputstrlist.h" +#include "pagewidget.h" +#include "pixmaps.h" + +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qlistbox.h> +#include <qstrlist.h> +#include <qstringlist.h> +#include <qfiledialog.h> +#include <qtooltip.h> + +InputStrList::InputStrList( const QString & label, + PageWidget *parent, QStrList &sl, ListMode lm) + : QWidget(parent->getLayout()), strList(sl) +{ + QGridLayout *layout = new QGridLayout( this, 2, 2, 5 ); + lab = new QLabel( label, this ); + lab->setMinimumSize( lab->sizeHint() ); + layout->addWidget( lab,0,0 ); + + QWidget *dw = new QWidget(this); /* dummy widget used for layouting */ + QHBoxLayout *boxlayout = new QHBoxLayout( dw, 0, 5 ); + le = new QLineEdit( dw ); + le->setMinimumSize( le->sizeHint() ); + boxlayout->addWidget( le, 1 ); + + add = new QPushButton( dw ); + add->setPixmap( QPixmap( add_xpm )); + add->setMinimumSize( add->sizeHint() ); + QToolTip::add(add,"Add item"); + boxlayout->addWidget( add ); + + del = new QPushButton( dw ); + del->setPixmap( QPixmap( del_xpm )); + del->setMinimumSize( del->sizeHint() ); + QToolTip::add(del,"Delete selected item"); + boxlayout->addWidget( del ); + + upd = new QPushButton( dw ); + upd->setPixmap( QPixmap( update_xpm )); + upd->setMinimumSize( upd->sizeHint() ); + QToolTip::add(upd,"Update selected item"); + boxlayout->addWidget( upd ); + + lb = new QListBox( this ); + lb->setMinimumSize(400,100); + init(); + lb->setVScrollBarMode(QScrollView::Auto); + lb->setHScrollBarMode(QScrollView::Auto); + + brFile=0; + brDir=0; + if (lm!=ListString) + { + if (lm&ListFile) + { + brFile = new QPushButton(dw); + brFile->setPixmap( QPixmap(file_xpm) ); + brFile->setMinimumSize(brFile->sizeHint()); + QToolTip::add(brFile,"Browse to a file"); + boxlayout->addWidget( brFile ); + } + if (lm&ListDir) + { + brDir = new QPushButton(dw); + brDir->setPixmap( QPixmap(folder_xpm) ); + brDir->setMinimumSize(brDir->sizeHint()); + QToolTip::add(brDir,"Browse to a folder"); + boxlayout->addWidget( brDir ); + } + } + layout->addWidget( dw, 0,1 ); + layout->addWidget( lb,1,1 ); + layout->activate(); + setMinimumSize( sizeHint() ); + + connect(le, SIGNAL(returnPressed()), + this, SLOT(addString()) ); + connect(add, SIGNAL(clicked()), + this, SLOT(addString()) ); + connect(del, SIGNAL(clicked()), + this, SLOT(delString()) ); + connect(upd, SIGNAL(clicked()), + this, SLOT(updateString()) ); + if (brFile) + { + connect(brFile, SIGNAL(clicked()), + this, SLOT(browseFiles())); + } + if (brDir) + { + connect(brDir, SIGNAL(clicked()), + this, SLOT(browseDir())); + } + connect(lb, SIGNAL(selected(const QString &)), + this, SLOT(selectText(const QString &))); + + parent->addWidget(this); + + strList=sl; +} + +void InputStrList::addString() +{ + if (!le->text().isEmpty()) + { + lb->insertItem(le->text()); + strList.append(le->text()); + emit changed(); + le->clear(); + } +} + +void InputStrList::delString() +{ + if (lb->currentItem()!=-1) + { + int itemIndex = lb->currentItem(); + lb->removeItem(itemIndex); + strList.remove(itemIndex); + emit changed(); + } +} + +void InputStrList::updateString() +{ + if (lb->currentItem()!=-1 && !le->text().isEmpty()) + { + lb->changeItem(le->text(),lb->currentItem()); + strList.insert(lb->currentItem(),le->text()); + strList.remove(lb->currentItem()+1); + emit changed(); + } +} + +void InputStrList::selectText(const QString &s) +{ + le->setText(s); +} + +void InputStrList::setEnabled(bool state) +{ + lab->setEnabled(state); + le->setEnabled(state); + add->setEnabled(state); + del->setEnabled(state); + upd->setEnabled(state); + lb->setEnabled(state); + if (brFile) brFile->setEnabled(state); + if (brDir) brDir->setEnabled(state); +} + +void InputStrList::browseFiles() +{ + QStringList fileNames = QFileDialog::getOpenFileNames(); + + if (!fileNames.isEmpty()) + { + QStringList::Iterator it; + for ( it= fileNames.begin(); it != fileNames.end(); ++it ) + { + lb->insertItem(*it); + strList.append(*it); + emit changed(); + } + le->setText(*fileNames.begin()); + } +} + +void InputStrList::browseDir() +{ + QString dirName = QFileDialog::getExistingDirectory(); + + if (!dirName.isNull()) + { + lb->insertItem(dirName); + strList.append(dirName); + emit changed(); + le->setText(dirName); + } +} + +void InputStrList::init() +{ + le->clear(); + lb->clear(); + char *s = strList.first(); + while (s) + { + lb->insertItem(s); + s = strList.next(); + } +} diff --git a/addon/doxywizard/inputstrlist.h b/addon/doxywizard/inputstrlist.h new file mode 100644 index 0000000..496aeed --- /dev/null +++ b/addon/doxywizard/inputstrlist.h @@ -0,0 +1,69 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _INPUTSTRLIST_H +#define _INPUTSTRLIST_H + +#include <qwidget.h> +#include <qstring.h> + +class QLabel; +class QLineEdit; +class QPushButton; +class QListBox; +class PageWidget; +class QStrList; + +class InputStrList : public QWidget +{ + Q_OBJECT + + public: + enum ListMode { ListString=0, + ListFile=1, + ListDir=2, + ListFileDir=ListFile|ListDir + }; + + InputStrList( const QString &text, PageWidget *parent, + QStrList &sl, ListMode v=ListString ); + ~InputStrList() {}; + void setEnabled(bool); + void init(); + + private: + QLabel *lab; + QLineEdit *le; + QPushButton *add; + QPushButton *del; + QPushButton *upd; + QPushButton *brFile; + QPushButton *brDir; + QListBox *lb; + QStrList &strList; + + signals: + void changed(); + + private slots: + void addString(); + void delString(); + void updateString(); + void selectText(const QString &s); + void browseFiles(); + void browseDir(); + +}; + +#endif diff --git a/addon/doxywizard/pagewidget.cpp b/addon/doxywizard/pagewidget.cpp new file mode 100644 index 0000000..48ab092 --- /dev/null +++ b/addon/doxywizard/pagewidget.cpp @@ -0,0 +1,86 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include <stdio.h> + +#include <qtabwidget.h> +#include <qlayout.h> +#include "pagewidget.h" + +FrameLayout::FrameLayout(QWidget *parent,const char *name,WFlags f) + : QFrame(parent,name,f) +{ + lay = new QVBoxLayout(this,5,3,name); +} + +FrameLayout::~FrameLayout() +{ +} + +void FrameLayout::addStretch(int stretch) +{ + lay->addStretch(stretch); +} + +void FrameLayout::addWidget(QWidget *w) +{ + lay->addWidget(w); +} + +PageWidget::PageWidget( QTabWidget *parent, const char *name ) + : QScrollView ( parent,name ) +{ + // the Qt docs say that one has to insert the viewport() as a parent + // here but this does not work! Insert 0 does give the proper result! + lay = new FrameLayout(this); + addChild(lay); + setVScrollBarMode(QScrollView::Auto); + setHScrollBarMode(QScrollView::AlwaysOff); + m_parent=parent; + m_parent->addTab( this, name ); +} + +void PageWidget::addStretch(int stretch=0) +{ + lay->addStretch(stretch); + //printf("Viewport SizeHint %d,%d\n",viewport()->sizeHint().width(),viewport()->sizeHint().height()); +} + +void PageWidget::addWidget(QWidget *w) +{ + //printf("Adding widget height=%d\n",w->sizeHint().height()); + lay->addWidget(w); +} + +QWidget *PageWidget::getLayout() const +{ + return lay; +} + +void PageWidget::resizeEvent(QResizeEvent *e) +{ + QScrollView::resizeEvent(e); + //printf("PageWidget::resizeEvent!\n"); + lay->resize(viewport()->width(),QMAX(lay->height(),viewport()->height())); +} + +void PageWidget::paintEvent(QPaintEvent *e) +{ + QScrollView::paintEvent(e); + //printf("PageWidget::paintEvent()\n"); + lay->resize(viewport()->width(),QMAX(lay->height(),viewport()->height())); +} + + + diff --git a/addon/doxywizard/pagewidget.h b/addon/doxywizard/pagewidget.h new file mode 100644 index 0000000..1f188ad --- /dev/null +++ b/addon/doxywizard/pagewidget.h @@ -0,0 +1,63 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _PAGEWIDGET_H +#define _PAGEWIDGET_H + +#include <qscrollview.h> + +class QTabWidget; +class QVBoxLayout; + +class FrameLayout : public QFrame +{ + Q_OBJECT + + public: + FrameLayout(QWidget *parent=0, const char *name=0, WFlags g=0); + ~FrameLayout(); + void addStretch(int s=0); + void addWidget(QWidget *w); + + private: + QVBoxLayout *lay; +}; + +class PageWidget : public QScrollView +{ + Q_OBJECT + + public: + PageWidget( QTabWidget *parent, const char *name ); + ~PageWidget() {}; + //void frameChanged() + //{ + // if (!layout()) return; + // layout()->setMargin(frameWidth()); + //} + void addStretch(int stretch=0); + void addWidget(QWidget *w); + QWidget *getLayout() const; + + protected: + void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e); + + private: + FrameLayout *lay; + QTabWidget *m_parent; + +}; + +#endif diff --git a/addon/doxywizard/pixmaps.cpp b/addon/doxywizard/pixmaps.cpp new file mode 100644 index 0000000..e3631c5 --- /dev/null +++ b/addon/doxywizard/pixmaps.cpp @@ -0,0 +1,204 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#include "pixmaps.h" + +static const char * const folder_xpm_data[] = +{ + "16 16 6 1", + ". c None", + "b c #ffff00", + "d c #000000", + "* c #999999", + "a c #cccccc", + "c c #ffffff", + "................", + "................", + "..*****.........", + ".*ababa*........", + "*abababa******..", + "*cccccccccccc*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "**************d.", + ".dddddddddddddd.", + "................" +}; +const char **folder_xpm = (const char **)folder_xpm_data; + +static const char* const file_xpm_data[] = +{ + "16 16 5 1", + ". c #7f7f7f", + "# c None", + "c c #000000", + "b c #bfbfbf", + "a c #ffffff", + "################", + "#..........#####", + "#.aaaaaaaab.####", + "#.aaaaaaaaba.###", + "#.aaaaaaaacccc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.aaaaaaaaaabc##", + "#.bbbbbbbbbbbc##", + "#ccccccccccccc##", + "################" +}; +const char **file_xpm = (const char **)file_xpm_data; + +static const char * const add_xpm_data[] = +{ + "16 16 5 1", + ". c None", + "* c #0328f9", + "# c #354396", + "a c #353740", + "c c #999999", + "................", + "......###.......", + "......#*ac......", + "......#*ac......", + "......#*ac......", + "......#*ac......", + ".######*a#####..", + ".#***********ac.", + ".#aaaaa*aaaaaac.", + "..cccc#*acccccc.", + "......#*ac......", + "......#*ac......", + "......#*ac......", + "......#aac......", + ".......ccc......", + "................" +}; +const char **add_xpm = (const char **)add_xpm_data; + +static const char * const del_xpm_data[] = +{ + "16 16 5 1", + ". c None", + "* c #0328f9", + "# c #354396", + "a c #353740", + "c c #999999", + "................", + "................", + "................", + "................", + "................", + "................", + ".#############..", + ".#***********ac.", + ".aaaaaaaaaaaaac.", + "..ccccccccccccc.", + "................", + "................", + "................", + "................", + "................", + "................" +}; +const char **del_xpm = (const char **)del_xpm_data; + +static char *update_xpm_data[] = +{ + "16 16 5 1", + /* colors */ + ". c #0328f9", + "# c #354396", + "a c #353740", + "b c None", + "c c #999999", + /* pixels */ + "bbbbbbbbbbbbbbbb", + "bbbbbbbb#####acb", + "bbbbbbbb#....abb", + "bbc##cbb#...acbb", + "bb#..abb#....abb", + "bc#..abb#.a..acb", + "b#..acbbaac#..ab", + "b#..abbbcbb#..ab", + "b#..abbbbbb#..ab", + "b#..acbbbbc#..ab", + "bc#..#cbbc#..acb", + "bb#...####...acb", + "bbca........acbb", + "bbbbaa....aaccbb", + "bbbbbcaaaaccbbbb", + "bbbbbbbbbbbbbbbb" +}; +const char **update_xpm = (const char **)update_xpm_data; + + +static const char *fileopen_xpm_data[] = +{ + "16 13 5 1", + ". c #040404", + "# c #808304", + "a c None", + "b c #f3f704", + "c c #f3f7f3", + "aaaaaaaaa...aaaa", + "aaaaaaaa.aaa.a.a", + "aaaaaaaaaaaaa..a", + "a...aaaaaaaa...a", + ".bcb.......aaaaa", + ".cbcbcbcbc.aaaaa", + ".bcbcbcbcb.aaaaa", + ".cbcb...........", + ".bcb.#########.a", + ".cb.#########.aa", + ".b.#########.aaa", + "..#########.aaaa", + "...........aaaaa" +}; +const char **fileopen_xpm = (const char **)fileopen_xpm_data; + +/* XPM */ +static const char *filesave_xpm_data[] = +{ + "14 14 4 1", + ". c #040404", + "# c #808304", + "a c #bfc2bf", + "b c None", + "..............", + ".#.aaaaaaaa.a.", + ".#.aaaaaaaa...", + ".#.aaaaaaaa.#.", + ".#.aaaaaaaa.#.", + ".#.aaaaaaaa.#.", + ".#.aaaaaaaa.#.", + ".##........##.", + ".############.", + ".##.........#.", + ".##......aa.#.", + ".##......aa.#.", + ".##......aa.#.", + "b............." +}; +const char **filesave_xpm = (const char **)filesave_xpm_data; + diff --git a/addon/doxywizard/pixmaps.h b/addon/doxywizard/pixmaps.h new file mode 100644 index 0000000..6c0bb97 --- /dev/null +++ b/addon/doxywizard/pixmaps.h @@ -0,0 +1,26 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 2000 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _PIXMAPS_H +#define _PIXMAPS_H + +extern const char** folder_xpm; +extern const char** file_xpm; +extern const char** add_xpm; +extern const char** del_xpm; +extern const char** update_xpm; +extern const char** fileopen_xpm; +extern const char** filesave_xpm; + +#endif diff --git a/addon/doxywizard/version.cpp b/addon/doxywizard/version.cpp new file mode 100644 index 0000000..5a00b3e --- /dev/null +++ b/addon/doxywizard/version.cpp @@ -0,0 +1 @@ +char versionString[]="0.1"; diff --git a/addon/doxywizard/version.h b/addon/doxywizard/version.h new file mode 100644 index 0000000..d7d5f13 --- /dev/null +++ b/addon/doxywizard/version.h @@ -0,0 +1,6 @@ +#ifndef VERSION_H +#define VERSION_H + +extern char versionString[]; + +#endif |