Public Slots | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
Expert Class Reference

#include <expert.h>

Inheritance diagram for Expert:
DocIntf

Public Slots

void activateTopic (QTreeWidgetItem *, QTreeWidgetItem *)
 
QWidget * createTopicWidget (QDomElement &elem)
 
void refresh ()
 

Signals

void changed ()
 
void done ()
 

Public Member Functions

 Expert ()
 
 ~Expert ()
 
void loadSettings (QSettings *)
 
void saveSettings (QSettings *)
 
void loadConfig (const QString &fileName)
 
bool writeConfig (QTextStream &t, bool brief)
 
QByteArray saveInnerState () const
 
bool restoreInnerState (const QByteArray &state)
 
const QHash< QString, Input * > & modelData () const
 
void resetToDefaults ()
 
bool htmlOutputPresent (const QString &workingDir) const
 
bool pdfOutputPresent (const QString &workingDir) const
 
QString getHtmlOutputIndex (const QString &workingDir) const
 
void setHeader (const char *name)
 
void add (const char *name, const char *doc)
 
- Public Member Functions inherited from DocIntf
virtual ~DocIntf ()
 

Private Slots

void showHelp (Input *)
 
void nextTopic ()
 
void prevTopic ()
 

Private Member Functions

void createTopics (const QDomElement &)
 
void saveTopic (QTextStream &t, QDomElement &elem, QTextCodec *codec, bool brief)
 

Private Attributes

QSplitter * m_splitter
 
QTextBrowser * m_helper
 
QTreeWidget * m_treeWidget
 
QStackedWidget * m_topicStack
 
QHash< QString, QWidget * > m_topics
 
QHash< QString, QObject * > m_optionWidgets
 
QHash< QString, Input * > m_options
 
QPushButton * m_next
 
QPushButton * m_prev
 
QDomElement m_rootElement
 
bool m_inShowHelp
 
QString m_header
 

Detailed Description

Definition at line 19 of file expert.h.

Constructor & Destructor Documentation

Expert::Expert ( )

Definition at line 59 of file expert.cpp.

60 {
61  m_treeWidget = new QTreeWidget;
62  m_treeWidget->setColumnCount(1);
63  m_topicStack = new QStackedWidget;
64  m_inShowHelp = false;
65 
66  QFile file(SA(":/config.xml"));
67  QString err;
68  int errLine,errCol;
69  QDomDocument configXml;
70  if (file.open(QIODevice::ReadOnly))
71  {
72  if (!configXml.setContent(&file,false,&err,&errLine,&errCol))
73  {
74  QString msg = tr("Error parsing internal config.xml at line %1 column %2.\n%3").
75  arg(errLine).arg(errCol).arg(err);
76  QMessageBox::warning(this, tr("Error"), msg);
77  exit(1);
78  }
79  }
80  m_rootElement = configXml.documentElement();
81 
83  m_helper = new QTextBrowser;
84  m_helper->setReadOnly(true);
85  m_helper->setOpenExternalLinks(true);
86  m_splitter = new QSplitter(Qt::Vertical);
87  m_splitter->addWidget(m_treeWidget);
88  m_splitter->addWidget(m_helper);
89 
90  QWidget *rightSide = new QWidget;
91  QGridLayout *grid = new QGridLayout(rightSide);
92  m_prev = new QPushButton(tr("Previous"));
93  m_prev->setEnabled(false);
94  m_next = new QPushButton(tr("Next"));
95  grid->addWidget(m_topicStack,0,0,1,2);
96  grid->addWidget(m_prev,1,0,Qt::AlignLeft);
97  grid->addWidget(m_next,1,1,Qt::AlignRight);
98  grid->setColumnStretch(0,1);
99  grid->setRowStretch(0,1);
100 
101  addWidget(m_splitter);
102  addWidget(rightSide);
103  connect(m_next,SIGNAL(clicked()),SLOT(nextTopic()));
104 
105  connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic()));
106 
107  addConfigDocs(this);
108 }
QTreeWidget * m_treeWidget
Definition: expert.h:62
void msg(const char *fmt,...)
Definition: message.cpp:107
QSplitter * m_splitter
Definition: expert.h:60
QPushButton * m_next
Definition: expert.h:67
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
void addConfigDocs(DocIntf *doc)
#define SA(x)
Definition: expert.cpp:26
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
Definition: graph.py:30
void nextTopic()
Definition: expert.cpp:838
void createTopics(const QDomElement &)
Definition: expert.cpp:120
QStackedWidget * m_topicStack
Definition: expert.h:63
QPushButton * m_prev
Definition: expert.h:68
void err(const char *fmt,...)
Definition: message.cpp:226
QTextBrowser * m_helper
Definition: expert.h:61
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
QDomElement m_rootElement
Definition: expert.h:69
void prevTopic()
Definition: expert.cpp:853
bool m_inShowHelp
Definition: expert.h:70
Expert::~Expert ( )

Definition at line 110 of file expert.cpp.

111 {
112  QHashIterator<QString,Input*> i(m_options);
113  while (i.hasNext())
114  {
115  i.next();
116  delete i.value();
117  }
118 }
QHash< QString, Input * > m_options
Definition: expert.h:66

Member Function Documentation

void Expert::activateTopic ( QTreeWidgetItem *  item,
QTreeWidgetItem *   
)
slot

Definition at line 692 of file expert.cpp.

693 {
694  if (item)
695  {
696  QWidget *w = m_topics[item->text(0)];
697  m_topicStack->setCurrentWidget(w);
698  m_prev->setEnabled(m_topicStack->currentIndex()!=0);
699  m_next->setEnabled(true);
700  }
701 }
QPushButton * m_next
Definition: expert.h:67
QStackedWidget * m_topicStack
Definition: expert.h:63
QPushButton * m_prev
Definition: expert.h:68
QHash< QString, QWidget * > m_topics
Definition: expert.h:64
void Expert::add ( const char *  name,
const char *  doc 
)
virtual

Implements DocIntf.

Definition at line 48 of file expert.cpp.

49 {
50  Input *opt = m_options[SA(name)];
51  if (opt)
52  {
53  opt->setTemplateDocs(SA(docs));
54  }
55 }
static QCString name
Definition: declinfo.cpp:673
QHash< QString, Input * > m_options
Definition: expert.h:66
opt
Definition: train.py:196
#define SA(x)
Definition: expert.cpp:26
Definition: input.h:9
virtual void setTemplateDocs(const QString &docs)=0
void Expert::changed ( )
signal
void Expert::createTopics ( const QDomElement &  rootElem)
private

Definition at line 120 of file expert.cpp.

121 {
123  QDomElement childElem = rootElem.firstChildElement();
124  while (!childElem.isNull())
125  {
126  if (childElem.tagName()==SA("group"))
127  {
128  // Remove _ from a group name like: Source_Browser
129  QString name = childElem.attribute(SA("name")).replace(SA("_"),SA(" "));
130  items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(name)));
131  QWidget *widget = createTopicWidget(childElem);
132  m_topics[name] = widget;
133  m_topicStack->addWidget(widget);
134  }
135  childElem = childElem.nextSiblingElement();
136  }
137  m_treeWidget->setHeaderLabels(QStringList() << SA("Topics"));
138  m_treeWidget->insertTopLevelItems(0,items);
140  SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),
141  this,
142  SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *)));
143 }
static QCString name
Definition: declinfo.cpp:673
void activateTopic(QTreeWidgetItem *, QTreeWidgetItem *)
Definition: expert.cpp:692
QTreeWidget * m_treeWidget
Definition: expert.h:62
QWidget * createTopicWidget(QDomElement &elem)
Definition: expert.cpp:477
void append(const type *d)
Definition: qlist.h:73
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
#define SA(x)
Definition: expert.cpp:26
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
Definition: graph.py:30
QStackedWidget * m_topicStack
Definition: expert.h:63
A list of strings.
Definition: qstringlist.h:51
QHash< QString, QWidget * > m_topics
Definition: expert.h:64
QCString & replace(uint index, uint len, const char *s)
Definition: qcstring.cpp:411
Definition: qlist.h:54
QWidget * Expert::createTopicWidget ( QDomElement &  elem)
slot

Definition at line 477 of file expert.cpp.

478 {
479  QScrollArea *area = new QScrollArea;
480  QWidget *topic = new QWidget;
481  QGridLayout *layout = new QGridLayout(topic);
482  QDomElement child = elem.firstChildElement();
483  int row=0;
484  while (!child.isNull())
485  {
486  QString setting = child.attribute(SA("setting"));
487  if (setting.isEmpty() || IS_SUPPORTED(setting.toLatin1()))
488  {
489  QString type = child.attribute(SA("type"));
490  QString docs = getDocsForNode(child);
491  if (type==SA("bool"))
492  {
493  InputBool *boolOption =
494  new InputBool(
495  layout,row,
496  child.attribute(SA("id")),
497  child.attribute(SA("defval"))==SA("1"),
498  docs
499  );
500  m_options.insert(
501  child.attribute(SA("id")),
502  boolOption
503  );
504  connect(boolOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
505  connect(boolOption,SIGNAL(changed()),SIGNAL(changed()));
506  }
507  else if (type==SA("string"))
508  {
510  QString format = child.attribute(SA("format"));
511  if (format==SA("dir"))
512  {
513  mode = InputString::StringDir;
514  }
515  else if (format==SA("file"))
516  {
518  }
519  else if (format==SA("image"))
520  {
522  }
523  else // format=="string"
524  {
526  }
527  InputString *stringOption =
528  new InputString(
529  layout,row,
530  child.attribute(SA("id")),
531  child.attribute(SA("defval")),
532  mode,
533  docs,
534  child.attribute(SA("abspath"))
535  );
536  m_options.insert(
537  child.attribute(SA("id")),
538  stringOption
539  );
540  connect(stringOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
541  connect(stringOption,SIGNAL(changed()),SIGNAL(changed()));
542  }
543  else if (type==SA("enum"))
544  {
545  InputString *enumList = new InputString(
546  layout,row,
547  child.attribute(SA("id")),
548  child.attribute(SA("defval")),
550  docs
551  );
552  QDomElement enumVal = child.firstChildElement();
553  while (!enumVal.isNull())
554  {
555  if (enumVal.tagName()==SA("value"))
556  {
557  enumList->addValue(enumVal.attribute(SA("name")));
558  }
559  enumVal = enumVal.nextSiblingElement();
560  }
561  enumList->setDefault();
562 
563  m_options.insert(child.attribute(SA("id")),enumList);
564  connect(enumList,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
565  connect(enumList,SIGNAL(changed()),SIGNAL(changed()));
566  }
567  else if (type==SA("int"))
568  {
569  InputInt *intOption =
570  new InputInt(
571  layout,row,
572  child.attribute(SA("id")),
573  child.attribute(SA("defval")).toInt(),
574  child.attribute(SA("minval")).toInt(),
575  child.attribute(SA("maxval")).toInt(),
576  docs
577  );
578  m_options.insert(
579  child.attribute(SA("id")),
580  intOption
581  );
582  connect(intOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
583  connect(intOption,SIGNAL(changed()),SIGNAL(changed()));
584  }
585  else if (type==SA("list"))
586  {
588  QString format = child.attribute(SA("format"));
589  if (format==SA("dir"))
590  {
591  mode = InputStrList::ListDir;
592  }
593  else if (format==SA("file"))
594  {
595  mode = InputStrList::ListFile;
596  }
597  else if (format==SA("filedir"))
598  {
600  }
601  else // format=="string"
602  {
604  }
605  QStringList sl;
606  QDomElement listVal = child.firstChildElement();
607  while (!listVal.isNull())
608  {
609  if (listVal.tagName()==SA("value"))
610  {
611  sl.append(listVal.attribute(SA("name")));
612  }
613  listVal = listVal.nextSiblingElement();
614  }
615  InputStrList *listOption =
616  new InputStrList(
617  layout,row,
618  child.attribute(SA("id")),
619  sl,
620  mode,
621  docs
622  );
623  m_options.insert(
624  child.attribute(SA("id")),
625  listOption
626  );
627  connect(listOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
628  connect(listOption,SIGNAL(changed()),SIGNAL(changed()));
629  }
630  else if (type==SA("obsolete"))
631  {
632  // ignore
633  }
634  else // should not happen
635  {
636  printf("Unsupported type %s\n",qPrintable(child.attribute(SA("type"))));
637  }
638  } // IS_SUPPORTED
639  child = child.nextSiblingElement();
640  }
641 
642  // compute dependencies between options
643  child = elem.firstChildElement();
644  while (!child.isNull())
645  {
646  QString setting = child.attribute(SA("setting"));
647  QString dependsOn = child.attribute(SA("depends"));
648  QString id = child.attribute(SA("id"));
649  if (!dependsOn.isEmpty() &&
650  (setting.isEmpty() || IS_SUPPORTED(setting.toLatin1())))
651  {
652  Input *parentOption = m_options[dependsOn];
653  if (parentOption==0)
654  {
655  printf("%s has depends=%s that is not valid\n",
656  qPrintable(id),qPrintable(dependsOn));
657  }
658  Input *thisOption = m_options[id];
659  Q_ASSERT(parentOption);
660  Q_ASSERT(thisOption);
661  if (parentOption && thisOption)
662  {
663  //printf("Adding dependency '%s' (%p)->'%s' (%p)\n",
664  // qPrintable(dependsOn),parentOption,
665  // qPrintable(id),thisOption);
666  parentOption->addDependency(thisOption);
667  }
668  }
669  child = child.nextSiblingElement();
670  }
671 
672  // set initial dependencies
673  QHashIterator<QString,Input*> i(m_options);
674  while (i.hasNext())
675  {
676  i.next();
677  if (i.value())
678  {
679  i.value()->updateDependencies();
680  }
681  }
682 
683  layout->setRowStretch(row,1);
684  layout->setColumnStretch(1,2);
685  layout->setSpacing(5);
686  topic->setLayout(layout);
687  area->setWidget(topic);
688  area->setWidgetResizable(true);
689  return area;
690 }
void addValue(QString s)
bool isEmpty() const
Definition: qstring.h:682
Iterator append(const T &x)
Definition: qvaluelist.h:372
QHash< QString, Input * > m_options
Definition: expert.h:66
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
virtual void addDependency(Input *option)=0
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
#define SA(x)
Definition: expert.cpp:26
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
Definition: graph.py:30
void showHelp(Input *)
Definition: expert.cpp:821
A list of strings.
Definition: qstringlist.h:51
static QString getDocsForNode(const QDomElement &child)
Definition: expert.cpp:145
Definition: input.h:9
void setDefault()
#define IS_SUPPORTED(x)
Definition: settings.h:5
void changed()
void Expert::done ( )
signal
QString Expert::getHtmlOutputIndex ( const QString workingDir) const

Definition at line 907 of file expert.cpp.

908 {
909  QString outputDir = getStringOption(m_options,QString::fromLatin1("OUTPUT_DIRECTORY"));
910  QString htmlOutputDir = getStringOption(m_options,QString::fromLatin1("HTML_OUTPUT"));
911  //printf("outputDir=%s\n",qPrintable(outputDir));
912  //printf("htmlOutputDir=%s\n",qPrintable(htmlOutputDir));
913  QString indexFile = workingDir;
914  if (QFileInfo(outputDir).isAbsolute()) // override
915  {
916  indexFile = outputDir;
917  }
918  else // append
919  {
920  indexFile += QString::fromLatin1("/")+outputDir;
921  }
922  if (QFileInfo(htmlOutputDir).isAbsolute()) // override
923  {
924  indexFile = htmlOutputDir;
925  }
926  else // append
927  {
928  indexFile += QString::fromLatin1("/")+htmlOutputDir;
929  }
930  indexFile+=QString::fromLatin1("/index.html");
931  return indexFile;
932 }
QHash< QString, Input * > m_options
Definition: expert.h:66
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
static QString getStringOption(const QHash< QString, Input * > &model, const QString &name)
Definition: expert.cpp:889
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
bool Expert::htmlOutputPresent ( const QString workingDir) const

Definition at line 898 of file expert.cpp.

899 {
900  bool generateHtml = getBoolOption(m_options,QString::fromLatin1("GENERATE_HTML"));
901  if (!generateHtml || workingDir.isEmpty()) return false;
902  QString indexFile = getHtmlOutputIndex(workingDir);
903  QFileInfo fi(indexFile);
904  return fi.exists() && fi.isFile();
905 }
bool isEmpty() const
Definition: qstring.h:682
QHash< QString, Input * > m_options
Definition: expert.h:66
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QString getHtmlOutputIndex(const QString &workingDir) const
Definition: expert.cpp:907
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
static bool getBoolOption(const QHash< QString, Input * > &model, const QString &name)
Definition: expert.cpp:881
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
void Expert::loadConfig ( const QString fileName)

Definition at line 733 of file expert.cpp.

734 {
735  //printf("Expert::loadConfig(%s)\n",qPrintable(fileName));
736  parseConfig(fileName,m_options);
737 }
QHash< QString, Input * > m_options
Definition: expert.h:66
bool parseConfig(const QString &fileName, const QHash< QString, Input * > &options)
void Expert::loadSettings ( QSettings *  s)

Definition at line 703 of file expert.cpp.

704 {
705  QHashIterator<QString,Input*> i(m_options);
706  while (i.hasNext())
707  {
708  i.next();
709  QVariant var = s->value(SA("config/")+i.key());
710  if (i.value())
711  {
712  //printf("Loading key %s: type=%d value='%s'\n",qPrintable(i.key()),var.type(),qPrintable(var.toString()));
713  i.value()->value() = var;
714  i.value()->update();
715  }
716  }
717 }
QHash< QString, Input * > m_options
Definition: expert.h:66
#define SA(x)
Definition: expert.cpp:26
int var
Definition: 018_def.c:9
static QCString * s
Definition: config.cpp:1042
const QHash<QString,Input*>& Expert::modelData ( ) const
inline

Definition at line 32 of file expert.h.

32 { return m_options; }
QHash< QString, Input * > m_options
Definition: expert.h:66
void Expert::nextTopic ( )
privateslot

Definition at line 838 of file expert.cpp.

839 {
840  if (m_topicStack->currentIndex()+1==m_topicStack->count()) // last topic
841  {
842  done();
843  }
844  else
845  {
846  m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1);
847  m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
848  m_prev->setEnabled(m_topicStack->currentIndex()!=0);
849  m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
850  }
851 }
QTreeWidget * m_treeWidget
Definition: expert.h:62
QPushButton * m_next
Definition: expert.h:67
QStackedWidget * m_topicStack
Definition: expert.h:63
QPushButton * m_prev
Definition: expert.h:68
void done()
bool Expert::pdfOutputPresent ( const QString workingDir) const

Definition at line 934 of file expert.cpp.

935 {
936  bool generateLatex = getBoolOption(m_options,QString::fromLatin1("GENERATE_LATEX"));
937  bool pdfLatex = getBoolOption(m_options,QString::fromLatin1("USE_PDFLATEX"));
938  if (!generateLatex || !pdfLatex) return false;
939  QString latexOutput = getStringOption(m_options,QString::fromLatin1("LATEX_OUTPUT"));
940  QString indexFile;
941  if (QFileInfo(latexOutput).isAbsolute())
942  {
943  indexFile = latexOutput+QString::fromLatin1("/refman.pdf");
944  }
945  else
946  {
947  indexFile = workingDir+QString::fromLatin1("/")+
948  latexOutput+QString::fromLatin1("/refman.pdf");
949  }
950  QFileInfo fi(indexFile);
951  return fi.exists() && fi.isFile();
952 }
QHash< QString, Input * > m_options
Definition: expert.h:66
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
static bool getBoolOption(const QHash< QString, Input * > &model, const QString &name)
Definition: expert.cpp:881
static QString getStringOption(const QHash< QString, Input * > &model, const QString &name)
Definition: expert.cpp:889
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
void Expert::prevTopic ( )
privateslot

Definition at line 853 of file expert.cpp.

854 {
855  m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1);
856  m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
857  m_prev->setEnabled(m_topicStack->currentIndex()!=0);
858  m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
859 }
QTreeWidget * m_treeWidget
Definition: expert.h:62
QPushButton * m_next
Definition: expert.h:67
QStackedWidget * m_topicStack
Definition: expert.h:63
QPushButton * m_prev
Definition: expert.h:68
void Expert::refresh ( )
slot

Definition at line 954 of file expert.cpp.

955 {
956  m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(0));
957 }
QTreeWidget * m_treeWidget
Definition: expert.h:62
void Expert::resetToDefaults ( )

Definition at line 861 of file expert.cpp.

862 {
863  //printf("Expert::makeDefaults()\n");
864  QHashIterator<QString,Input*> i(m_options);
865  while (i.hasNext())
866  {
867  i.next();
868  if (i.value())
869  {
870  i.value()->reset();
871  }
872  }
873 }
QHash< QString, Input * > m_options
Definition: expert.h:66
bool Expert::restoreInnerState ( const QByteArray state)

Definition at line 816 of file expert.cpp.

817 {
818  return m_splitter->restoreState(state);
819 }
QSplitter * m_splitter
Definition: expert.h:60
QByteArray Expert::saveInnerState ( ) const

Definition at line 811 of file expert.cpp.

812 {
813  return m_splitter->saveState();
814 }
QSplitter * m_splitter
Definition: expert.h:60
void Expert::saveSettings ( QSettings *  s)

Definition at line 719 of file expert.cpp.

720 {
721  QHashIterator<QString,Input*> i(m_options);
722  while (i.hasNext())
723  {
724  i.next();
725  //printf("Saving key %s: type=%d value='%s'\n",qPrintable(i.key()),i.value()->value().type(),qPrintable(i.value()->value().toString()));
726  if (i.value())
727  {
728  s->setValue(SA("config/")+i.key(),i.value()->value());
729  }
730  }
731 }
QHash< QString, Input * > m_options
Definition: expert.h:66
#define SA(x)
Definition: expert.cpp:26
static QCString * s
Definition: config.cpp:1042
void Expert::saveTopic ( QTextStream t,
QDomElement &  elem,
QTextCodec codec,
bool  brief 
)
private

Definition at line 739 of file expert.cpp.

741 {
742  if (!brief)
743  {
744  t << endl;
745  }
746  t << "#---------------------------------------------------------------------------" << endl;
747  t << "# " << elem.attribute(SA("docs")) << endl;
748  t << "#---------------------------------------------------------------------------" << endl;
749  // write options...
750  QDomElement childElem = elem.firstChildElement();
751  while (!childElem.isNull())
752  {
753  QString setting = childElem.attribute(SA("setting"));
754  QString type = childElem.attribute(SA("type"));
755  QString name = childElem.attribute(SA("id"));
756  if (setting.isEmpty() || IS_SUPPORTED(setting.toLatin1()))
757  {
759  if (i!=m_options.end())
760  {
761  Input *option = i.value();
762  if (option && !brief)
763  {
764  t << endl;
765  t << convertToComment(option->templateDocs());
766  t << endl;
767  }
768  t << name.leftJustified(MAX_OPTION_LENGTH) << "= ";
769  if (option)
770  {
771  option->writeValue(t,codec);
772  }
773  t << endl;
774  }
775  }
776  childElem = childElem.nextSiblingElement();
777  }
778 }
static QCString name
Definition: declinfo.cpp:673
bool isEmpty() const
Definition: qstring.h:682
bool brief
virtual QVariant & value()=0
QHash< QString, Input * > m_options
Definition: expert.h:66
virtual QString templateDocs() const =0
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
intermediate_table::const_iterator const_iterator
#define SA(x)
Definition: expert.cpp:26
Definition: input.h:9
#define IS_SUPPORTED(x)
Definition: settings.h:5
QTextStream & endl(QTextStream &s)
static QString convertToComment(const QString &s)
Definition: expert.cpp:29
virtual void writeValue(QTextStream &t, QTextCodec *codec)=0
void Expert::setHeader ( const char *  name)
virtual

Implements DocIntf.

Definition at line 43 of file expert.cpp.

44 {
45  m_header = SA(header);
46 }
QString m_header
Definition: expert.h:71
#define SA(x)
Definition: expert.cpp:26
void Expert::showHelp ( Input option)
privateslot

Definition at line 821 of file expert.cpp.

822 {
823  if (!m_inShowHelp)
824  {
825  m_inShowHelp = true;
826  m_helper->setText(
827  QString::fromLatin1("<qt><b>")+option->id()+
828  QString::fromLatin1("</b><br>")+
829  QString::fromLatin1("<br/>")+
830  option->docs().
831  replace(QChar::fromLatin1('\n'),QChar::fromLatin1(' '))+
832  QString::fromLatin1("</qt>")
833  );
834  m_inShowHelp = false;
835  }
836 }
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
virtual QString id() const =0
QTextBrowser * m_helper
Definition: expert.h:61
virtual QString docs() const =0
bool m_inShowHelp
Definition: expert.h:70
bool Expert::writeConfig ( QTextStream t,
bool  brief 
)

Definition at line 780 of file expert.cpp.

781 {
782  // write global header
783  t << "# Doxyfile " << versionString << endl << endl;
784  if (!brief)
785  {
787  }
788 
789  QTextCodec *codec = 0;
790  Input *option = m_options[QString::fromLatin1("DOXYFILE_ENCODING")];
791  if (option)
792  {
793  codec = QTextCodec::codecForName(option->value().toString().toLatin1());
794  if (codec==0) // fallback: use UTF-8
795  {
796  codec = QTextCodec::codecForName("UTF-8");
797  }
798  }
799  QDomElement childElem = m_rootElement.firstChildElement();
800  while (!childElem.isNull())
801  {
802  if (childElem.tagName()==SA("group"))
803  {
804  saveTopic(t,childElem,codec,brief);
805  }
806  childElem = childElem.nextSiblingElement();
807  }
808  return true;
809 }
void saveTopic(QTextStream &t, QDomElement &elem, QTextCodec *codec, bool brief)
Definition: expert.cpp:739
bool brief
virtual QVariant & value()=0
QHash< QString, Input * > m_options
Definition: expert.h:66
QString m_header
Definition: expert.h:71
#define SA(x)
Definition: expert.cpp:26
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
char versionString[]
Definition: version.cpp:1
Definition: input.h:9
static QTextCodec * codecForName(const char *hint, int accuracy=0)
Definition: qtextcodec.cpp:626
QDomElement m_rootElement
Definition: expert.h:69
Provides conversion between text encodings.
Definition: qtextcodec.h:62
QTextStream & endl(QTextStream &s)
static QString convertToComment(const QString &s)
Definition: expert.cpp:29

Member Data Documentation

QString Expert::m_header
private

Definition at line 71 of file expert.h.

QTextBrowser* Expert::m_helper
private

Definition at line 61 of file expert.h.

bool Expert::m_inShowHelp
private

Definition at line 70 of file expert.h.

QPushButton* Expert::m_next
private

Definition at line 67 of file expert.h.

QHash<QString,Input *> Expert::m_options
private

Definition at line 66 of file expert.h.

QHash<QString,QObject *> Expert::m_optionWidgets
private

Definition at line 65 of file expert.h.

QPushButton* Expert::m_prev
private

Definition at line 68 of file expert.h.

QDomElement Expert::m_rootElement
private

Definition at line 69 of file expert.h.

QSplitter* Expert::m_splitter
private

Definition at line 60 of file expert.h.

QHash<QString,QWidget *> Expert::m_topics
private

Definition at line 64 of file expert.h.

QStackedWidget* Expert::m_topicStack
private

Definition at line 63 of file expert.h.

QTreeWidget* Expert::m_treeWidget
private

Definition at line 62 of file expert.h.


The documentation for this class was generated from the following files: