Commit 2a22c7d4 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Merge branch 'master' of github.com:doxygen/doxygen

parents ea436bd6 9ba0c0ff
...@@ -323,6 +323,32 @@ static QString getDocsForNode(const QDomElement &child) ...@@ -323,6 +323,32 @@ static QString getDocsForNode(const QDomElement &child)
} }
} }
} }
else if (child.attribute(SA("format")) == SA("image"))
{
QString abspath = child.attribute(SA("abspath"));
if (defval != SA(""))
{
docs+=SA("<br/>");
if (abspath != SA("1"))
{
docs += SA(" The default image is: <code>") + defval + SA("</code>.");
}
else
{
docs += SA(" The default image (with absolute path) is: <code>") + defval + SA("</code>.");
}
docs += SA("<br/>");
}
else
{
if (abspath == SA("1"))
{
docs+=SA("<br/>");
docs += SA(" The image has to be specified with full path.");
docs += SA("<br/>");
}
}
}
else // if (child.attribute(SA("format")) == SA("string")) else // if (child.attribute(SA("format")) == SA("string"))
{ {
if (defval != SA("")) if (defval != SA(""))
...@@ -477,6 +503,10 @@ QWidget *Expert::createTopicWidget(QDomElement &elem) ...@@ -477,6 +503,10 @@ QWidget *Expert::createTopicWidget(QDomElement &elem)
{ {
mode = InputString::StringFile; mode = InputString::StringFile;
} }
else if (format==SA("image"))
{
mode = InputString::StringImage;
}
else // format=="string" else // format=="string"
{ {
mode = InputString::StringFree; mode = InputString::StringFree;
......
...@@ -44,6 +44,7 @@ InputString::InputString( QGridLayout *layout,int &row, ...@@ -44,6 +44,7 @@ InputString::InputString( QGridLayout *layout,int &row,
layout->addWidget( m_com, row, 1, 1, 3, Qt::AlignLeft ); layout->addWidget( m_com, row, 1, 1, 3, Qt::AlignLeft );
m_le=0; m_le=0;
m_br=0; m_br=0;
m_im=0;
row++; row++;
} }
else else
...@@ -51,28 +52,39 @@ InputString::InputString( QGridLayout *layout,int &row, ...@@ -51,28 +52,39 @@ InputString::InputString( QGridLayout *layout,int &row,
layout->addWidget( m_lab, row, 0 ); layout->addWidget( m_lab, row, 0 );
m_le = new QLineEdit; m_le = new QLineEdit;
m_le->setText( s ); m_le->setText( s );
m_im = 0;
//layout->setColumnMinimumWidth(2,150); //layout->setColumnMinimumWidth(2,150);
if (m==StringFile || m==StringDir) if (m==StringFile || m==StringDir || m==StringImage)
{ {
layout->addWidget( m_le, row, 1 ); layout->addWidget( m_le, row, 1 );
m_br = new QToolBar; m_br = new QToolBar;
m_br->setIconSize(QSize(24,24)); m_br->setIconSize(QSize(24,24));
if (m==StringFile) if (m==StringFile || m==StringImage)
{ {
QAction *file = m_br->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),this,SLOT(browse())); QAction *file = m_br->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),this,SLOT(browse()));
file->setToolTip(tr("Browse to a file")); file->setToolTip(tr("Browse to a file"));
layout->addWidget( m_br,row,2 );
if (m==StringImage)
{
m_im = new QLabel;
m_im->setMinimumSize(1,55);
m_im->setAlignment(Qt::AlignLeft|Qt::AlignTop);
row++;
layout->addWidget( m_im,row,1 );
}
} }
else else
{ {
QAction *dir = m_br->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),this,SLOT(browse())); QAction *dir = m_br->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),this,SLOT(browse()));
dir->setToolTip(tr("Browse to a folder")); dir->setToolTip(tr("Browse to a folder"));
}
layout->addWidget( m_br,row,2 ); layout->addWidget( m_br,row,2 );
} }
}
else else
{ {
layout->addWidget( m_le, row, 1, 1, 2 ); layout->addWidget( m_le, row, 1, 1, 2 );
m_br=0; m_br=0;
m_im=0;
} }
m_com=0; m_com=0;
row++; row++;
...@@ -119,6 +131,33 @@ void InputString::updateDefault() ...@@ -119,6 +131,33 @@ void InputString::updateDefault()
{ {
m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>")); m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>"));
} }
if (m_im)
{
if (m_str.isEmpty())
{
m_im->setText(tr("No Project logo selected."));
}
else
{
QFile Fout(m_str);
if(!Fout.exists())
{
m_im->setText(tr("Sorry, cannot find file(")+m_str+QString::fromAscii(");"));
}
else
{
QPixmap pm(m_str);
if (!pm.isNull())
{
m_im->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));
}
else
{
m_im->setText(tr("Sorry, no preview available (")+m_str+QString::fromAscii(");"));
}
}
}
}
if (m_le && m_le->text()!=m_str) m_le->setText( m_str ); if (m_le && m_le->text()!=m_str) m_le->setText( m_str );
emit changed(); emit changed();
} }
...@@ -128,6 +167,7 @@ void InputString::setEnabled(bool state) ...@@ -128,6 +167,7 @@ void InputString::setEnabled(bool state)
{ {
m_lab->setEnabled(state); m_lab->setEnabled(state);
if (m_le) m_le->setEnabled(state); if (m_le) m_le->setEnabled(state);
if (m_im) m_le->setEnabled(state);
if (m_br) m_br->setEnabled(state); if (m_br) m_br->setEnabled(state);
if (m_com) m_com->setEnabled(state); if (m_com) m_com->setEnabled(state);
updateDefault(); updateDefault();
...@@ -136,7 +176,7 @@ void InputString::setEnabled(bool state) ...@@ -136,7 +176,7 @@ void InputString::setEnabled(bool state)
void InputString::browse() void InputString::browse()
{ {
QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString path = QFileInfo(MainWindow::instance().configFileName()).path();
if (m_sm==StringFile) if (m_sm==StringFile || m_sm==StringImage)
{ {
QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(), QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(),
tr("Select file"),path); tr("Select file"),path);
......
...@@ -35,7 +35,8 @@ class InputString : public QObject, public Input ...@@ -35,7 +35,8 @@ class InputString : public QObject, public Input
enum StringMode { StringFree=0, enum StringMode { StringFree=0,
StringFile=1, StringFile=1,
StringDir=2, StringDir=2,
StringFixed=3 StringFixed=3,
StringImage=4
}; };
InputString( QGridLayout *layout,int &row, InputString( QGridLayout *layout,int &row,
...@@ -77,6 +78,7 @@ class InputString : public QObject, public Input ...@@ -77,6 +78,7 @@ class InputString : public QObject, public Input
void updateDefault(); void updateDefault();
QLabel *m_lab; QLabel *m_lab;
QLineEdit *m_le; QLineEdit *m_le;
QLabel *m_im;
QToolBar *m_br; QToolBar *m_br;
QComboBox *m_com; QComboBox *m_com;
QString m_str; QString m_str;
......
...@@ -468,6 +468,7 @@ Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(w ...@@ -468,6 +468,7 @@ Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(w
projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter); projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
// project icon // project icon
QLabel *projLogo = new QLabel(this); QLabel *projLogo = new QLabel(this);
projLogo->setMinimumSize(1,55);
projLogo->setText(tr("Project logo:")); projLogo->setText(tr("Project logo:"));
projLogo->setAlignment(Qt::AlignRight|Qt::AlignVCenter); projLogo->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
...@@ -564,6 +565,12 @@ void Step1::selectProjectIcon() ...@@ -564,6 +565,12 @@ void Step1::selectProjectIcon()
QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString path = QFileInfo(MainWindow::instance().configFileName()).path();
QString iconName = QFileDialog::getOpenFileName(this, QString iconName = QFileDialog::getOpenFileName(this,
tr("Select project icon/image"),path); tr("Select project icon/image"),path);
if (iconName.isEmpty())
{
m_projIconLab->setText(tr("No Project logo selected."));
}
else
{
QFile Fout(iconName); QFile Fout(iconName);
if(!Fout.exists()) if(!Fout.exists())
{ {
...@@ -581,6 +588,7 @@ void Step1::selectProjectIcon() ...@@ -581,6 +588,7 @@ void Step1::selectProjectIcon()
m_projIconLab->setText(tr("Sorry, no preview available (")+iconName+QString::fromAscii(");")); m_projIconLab->setText(tr("Sorry, no preview available (")+iconName+QString::fromAscii(");"));
} }
} }
}
updateStringOption(m_modelData,STR_PROJECT_LOGO,iconName); updateStringOption(m_modelData,STR_PROJECT_LOGO,iconName);
} }
......
...@@ -165,7 +165,7 @@ class ConfigEnum : public ConfigOption ...@@ -165,7 +165,7 @@ class ConfigEnum : public ConfigOption
class ConfigString : public ConfigOption class ConfigString : public ConfigOption
{ {
public: public:
enum WidgetType { String, File, Dir }; enum WidgetType { String, File, Dir, Image };
ConfigString(const char *name,const char *doc) ConfigString(const char *name,const char *doc)
: ConfigOption(O_String) : ConfigOption(O_String)
{ {
......
...@@ -247,7 +247,7 @@ Go to the <a href="commands.html">next</a> section or return to the ...@@ -247,7 +247,7 @@ Go to the <a href="commands.html">next</a> section or return to the
</docs> </docs>
</option> </option>
<option type='string' id='PROJECT_LOGO' format='file' defval=''> <option type='string' id='PROJECT_LOGO' format='image' defval=''>
<docs> <docs>
<![CDATA[ <![CDATA[
With the \c PROJECT_LOGO tag one can specify an logo or icon that is With the \c PROJECT_LOGO tag one can specify an logo or icon that is
......
...@@ -201,6 +201,19 @@ def prepCDocs(node): ...@@ -201,6 +201,19 @@ def prepCDocs(node):
else: else:
if abspath == '1': if abspath == '1':
doc += "<br/>The file has to be specified with full path." doc += "<br/>The file has to be specified with full path."
elif file =='image':
abspath = node.getAttribute('abspath')
if defval != '':
if abspath != '1':
doc += "<br/>The default image is: <code>%s</code>." % (
defval)
else:
doc += "<br/>%s: %s%s%s." % (
"The default image (with absolute path) is",
"<code>",defval,"</code>")
else:
if abspath == '1':
doc += "<br/>The image has to be specified with full path."
else: # format == 'string': else: # format == 'string':
if defval != '': if defval != '':
doc += "<br/>The default value is: <code>%s</code>." % ( doc += "<br/>The default value is: <code>%s</code>." % (
...@@ -262,6 +275,8 @@ def parseOption(node): ...@@ -262,6 +275,8 @@ def parseOption(node):
print " cs->setDefaultValue(\"%s\");" % (defval) print " cs->setDefaultValue(\"%s\");" % (defval)
if format == 'file': if format == 'file':
print " cs->setWidgetType(ConfigString::File);" print " cs->setWidgetType(ConfigString::File);"
elif format == 'image':
print " cs->setWidgetType(ConfigString::Image);"
elif format == 'dir': elif format == 'dir':
print " cs->setWidgetType(ConfigString::Dir);" print " cs->setWidgetType(ConfigString::Dir);"
if depends != '': if depends != '':
...@@ -453,6 +468,21 @@ def parseOptionDoc(node, first): ...@@ -453,6 +468,21 @@ def parseOptionDoc(node, first):
if abspath == '1': if abspath == '1':
print "" print ""
print "The file has to be specified with full path." print "The file has to be specified with full path."
elif file =='image':
abspath = node.getAttribute('abspath')
if defval != '':
print ""
if abspath != '1':
print "The default image is: <code>%s</code>." % (
defval)
else:
print "%s: %s%s%s." % (
"The default image (with absolute path) is",
"<code>",defval,"</code>")
else:
if abspath == '1':
print ""
print "The image has to be specified with full path."
else: # format == 'string': else: # format == 'string':
if defval != '': if defval != '':
print "" print ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment