Skip to content

Commit 9dd215f

Browse files
committed
issue #8965 Allow other names for plantuml.jar
- allow other names than plantuml.jar for the jar file to be used - extend the GUI so that a file or a directory can be specified - updating documentation
1 parent 644607d commit 9dd215f

File tree

11 files changed

+55
-38
lines changed

11 files changed

+55
-38
lines changed

addon/doxywizard/expert.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ QWidget *Expert::createTopicWidget(QDomElement &elem)
536536
{
537537
mode = InputString::StringFile;
538538
}
539+
else if (format==SA("filedir"))
540+
{
541+
mode = InputString::StringFileDir;
542+
}
539543
else if (format==SA("image"))
540544
{
541545
mode = InputString::StringImage;

addon/doxywizard/inputstring.cpp

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ InputString::InputString( QGridLayout *layout,int &row,
4343
m_absPath(absPath==QString::fromLatin1("1"))
4444
{
4545
m_lab = new HelpLabel(id);
46+
m_brFile = 0;
47+
m_brDir = 0;
4648
if (m==StringFixed)
4749
{
4850
layout->addWidget( m_lab, row, 0 );
@@ -60,16 +62,16 @@ InputString::InputString( QGridLayout *layout,int &row,
6062
m_le->setText( s );
6163
m_im = 0;
6264
//layout->setColumnMinimumWidth(2,150);
63-
if (m==StringFile || m==StringDir || m==StringImage)
65+
if (m==StringFile || m==StringDir || m==StringImage || m==StringFileDir)
6466
{
65-
layout->addWidget( m_le, row, 1 );
67+
QHBoxLayout *rowLayout = new QHBoxLayout;
68+
rowLayout->addWidget( m_le);
6669
m_br = new QToolBar;
6770
m_br->setIconSize(QSize(24,24));
68-
if (m==StringFile || m==StringImage)
71+
if (m==StringFile || m==StringImage || m==StringFileDir)
6972
{
70-
QAction *file = m_br->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(),this,SLOT(browse()));
71-
file->setToolTip(tr("Browse to a file"));
72-
layout->addWidget( m_br,row,2 );
73+
m_brFile = m_br->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(),this,SLOT(browseFile()));
74+
m_brFile->setToolTip(tr("Browse to a file"));
7375
if (m==StringImage)
7476
{
7577
m_im = new QLabel;
@@ -79,12 +81,13 @@ InputString::InputString( QGridLayout *layout,int &row,
7981
layout->addWidget( m_im,row,1 );
8082
}
8183
}
82-
else
84+
if (m==StringDir || m==StringFileDir)
8385
{
84-
QAction *dir = m_br->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(),this,SLOT(browse()));
85-
dir->setToolTip(tr("Browse to a folder"));
86-
layout->addWidget( m_br,row,2 );
86+
m_brDir = m_br->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(),this,SLOT(browseDir()));
87+
m_brDir->setToolTip(tr("Browse to a folder"));
8788
}
89+
rowLayout->addWidget( m_br);
90+
layout->addLayout( rowLayout, m==StringImage?row-1:row, 1, 1, 2 );
8891
}
8992
else
9093
{
@@ -175,28 +178,30 @@ void InputString::setEnabled(bool state)
175178
if (m_le) m_le->setEnabled(state);
176179
if (m_im) m_im->setEnabled(state);
177180
if (m_br) m_br->setEnabled(state);
181+
if (m_brFile) m_brFile->setEnabled(state);
182+
if (m_brDir) m_brDir->setEnabled(state);
178183
if (m_com) m_com->setEnabled(state);
179184
updateDefault();
180185
}
181186

182-
void InputString::browse()
187+
void InputString::browseFile()
183188
{
184189
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
185-
if (m_sm==StringFile || m_sm==StringImage)
190+
QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(),
191+
tr("Select file"),path);
192+
if (!fileName.isNull())
186193
{
187-
QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(),
188-
tr("Select file"),path);
189-
if (!fileName.isNull())
194+
QDir dir(path);
195+
if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
190196
{
191-
QDir dir(path);
192-
if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
193-
{
194-
fileName = m_absPath ? fileName : dir.relativeFilePath(fileName);
195-
}
196-
setValue(fileName);
197+
fileName = m_absPath ? fileName : dir.relativeFilePath(fileName);
197198
}
199+
setValue(fileName);
198200
}
199-
else // sm==StringDir
201+
}
202+
void InputString::browseDir()
203+
{
204+
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
200205
{
201206
QString dirName = QFileDialog::getExistingDirectory(&MainWindow::instance(),
202207
tr("Select directory"),path);

addon/doxywizard/inputstring.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class QLineEdit;
2424
class QToolBar;
2525
class QComboBox;
2626
class QGridLayout;
27+
class QAction;
2728

2829
class InputString : public QObject, public Input
2930
{
@@ -34,7 +35,8 @@ class InputString : public QObject, public Input
3435
StringFile=1,
3536
StringDir=2,
3637
StringFixed=3,
37-
StringImage=4
38+
StringImage=4,
39+
StringFileDir=5
3840
};
3941

4042
InputString( QGridLayout *layout,int &row,
@@ -72,7 +74,8 @@ class InputString : public QObject, public Input
7274
void showHelp(Input *);
7375

7476
private slots:
75-
void browse();
77+
void browseFile();
78+
void browseDir();
7679
void clear();
7780
void help();
7881

@@ -82,6 +85,8 @@ class InputString : public QObject, public Input
8285
QLineEdit *m_le;
8386
QLabel *m_im;
8487
QToolBar *m_br;
88+
QAction *m_brFile;
89+
QAction *m_brDir;
8590
QComboBox *m_com;
8691
QString m_str;
8792
QString m_default;

doc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ set(DOC_FILES
6363
expert_list_string.png
6464
expert_string_dir.png
6565
expert_string_file.png
66+
expert_string_filedir.png
6667
expert_string_image.png
6768
expert_string_string.png
6869
external.doc

doc/doxywizard_usage.doc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ The representation of the input field depends on the type of the configuration o
175175
<br>and a folder looks like:<br>
176176
\image{inline} html expert_string_dir.png
177177
\image{inline} latex expert_string_dir.png width=11.0cm
178+
<br>and in case both a file or a folder is allowed, the look is:<br>
179+
\image{inline} html expert_string_filedir.png
180+
\image{inline} latex expert_string_filedir.png width=11.0cm
178181
<br>In case a file represents an image, doxygen also tries to display the selected image.
179182
Then a typical field looks like:<br>
180183
\image{inline} html expert_string_image.png

doc/expert_string_filedir.png

2.66 KB
Loading

src/config.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,11 +3814,12 @@ UML notation for the relationships.
38143814
]]>
38153815
</docs>
38163816
</option>
3817-
<option type='string' id='PLANTUML_JAR_PATH' format='dir' defval=''>
3817+
<option type='string' id='PLANTUML_JAR_PATH' format='filedir' defval=''>
38183818
<docs>
38193819
<![CDATA[
38203820
When using plantuml, the \c PLANTUML_JAR_PATH tag should be used to specify the path where
3821-
java can find the \c plantuml.jar file. If left blank, it is assumed PlantUML is not used or
3821+
java can find the \c plantuml.jar file or to the filename of \c jar file to be used.
3822+
If left blank, it is assumed PlantUML is not used or
38223823
called during a preprocessing step. Doxygen will generate a warning when it encounters a
38233824
\ref cmdstartuml "\\startuml" command in this case and will not generate output for the diagram.
38243825
]]>

src/configgen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ def parseOption(node):
285285
print(" cs->setWidgetType(ConfigString::Image);")
286286
elif format == 'dir':
287287
print(" cs->setWidgetType(ConfigString::Dir);")
288+
elif format == 'filedir':
289+
print(" cs->setWidgetType(ConfigString::FileAndDir);")
288290
if depends != '':
289291
print(" cs->addDependency(\"%s\");" % (depends))
290292
elif type == 'enum':

src/configimpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class ConfigEnum : public ConfigOption
182182
class ConfigString : public ConfigOption
183183
{
184184
public:
185-
enum WidgetType { String, File, Dir, Image };
185+
enum WidgetType { String, File, Dir, Image, FileAndDir };
186186
ConfigString(const char *name,const char *doc)
187187
: ConfigOption(O_String)
188188
{

src/configimpl.l

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,22 +1873,22 @@ void Config::checkAndCorrect(bool quiet)
18731873
FileInfo jar(plantumlJar.str());
18741874
if (jar.exists() && jar.isFile())
18751875
{
1876-
plantumlJarPath = jar.dirPath(TRUE)+Portable::pathSeparator();
1876+
plantumlJarPath = plantumlJar;
18771877
}
18781878
else
18791879
{
1880-
err("Jar file plantuml.jar not found at location "
1880+
err("Jar file 'plantuml.jar' not found at location "
18811881
"specified via PLANTUML_JAR_PATH: '%s'\n",qPrint(plantumlJarPath));
18821882
plantumlJarPath="";
18831883
}
18841884
}
1885-
else if (pu.exists() && pu.isFile() && plantumlJarPath.right(4)==".jar") // PLANTUML_JAR_PATH is file
1885+
else if (pu.exists() && pu.isFile()) // PLANTUML_JAR_PATH is file
18861886
{
1887-
plantumlJarPath = pu.dirPath(TRUE)+Portable::pathSeparator();
1887+
// Nothing to be done
18881888
}
18891889
else
18901890
{
1891-
err("path specified via PLANTUML_JAR_PATH does not exist or not a directory: %s\n",
1891+
err("PLANTUML_JAR_PATH is not a directory with a 'plantuml.jar' file or is not an existing file: %s\n",
18921892
qPrint(plantumlJarPath));
18931893
plantumlJarPath="";
18941894
}

0 commit comments

Comments
 (0)