1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/exporthtmldialog.ui.h Thu Jul 06 15:39:54 2006 +0000
1.3 @@ -0,0 +1,218 @@
1.4 +/****************************************************************************
1.5 +** ui.h extension file, included from the uic-generated form implementation.
1.6 +**
1.7 +** If you wish to add, delete or rename functions or slots use
1.8 +** Qt Designer which will update this file, preserving your code. Create an
1.9 +** init() function in place of a constructor, and a destroy() function in
1.10 +** place of a destructor.
1.11 +*****************************************************************************/
1.12 +
1.13 +
1.14 +extern Settings settings;
1.15 +
1.16 +void ExportHTMLDialog::init()
1.17 +{
1.18 + dir=settings.readEntry ("/vym/export/html/dir","" );
1.19 + lineEdit1->setText(dir);
1.20 +
1.21 + if ( settings.readEntry ("/vym/export/html/image","yes")=="yes")
1.22 + image=true;
1.23 + else
1.24 + image=false;
1.25 + checkBox4->setChecked(image);
1.26 +
1.27 + if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes")
1.28 + imageOnly=true;
1.29 + else
1.30 + imageOnly=false;
1.31 + checkBox5_2->setChecked(imageOnly);
1.32 +
1.33 + if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes")
1.34 + wikistyle=true;
1.35 + else
1.36 + wikistyle=false;
1.37 + checkBox5->setChecked(wikistyle);
1.38 +
1.39 + if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
1.40 + useHeading=true;
1.41 + else
1.42 + useHeading=false;
1.43 + checkBox4_2->setChecked(useHeading);
1.44 +
1.45 + if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes")
1.46 + useURLImage=true;
1.47 + else
1.48 + useURLImage=false;
1.49 + checkBox6->setChecked(useURLImage);
1.50 +
1.51 + if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes")
1.52 + showOutput=true;
1.53 + else
1.54 + showOutput=false;
1.55 + checkBox3->setChecked(showOutput);
1.56 +
1.57 + stylepath=settings.readEntry
1.58 + ("/vym/export/html/styles","styles");
1.59 + scriptpath=settings.readEntry
1.60 + ("/vym/export/html/scripts","scripts");
1.61 + xsl=settings.readEntry
1.62 + ("/vym/export/html/xsl","vym2html.xsl");
1.63 + css=settings.readEntry
1.64 + ("/vym/export/html/css","vym.css");
1.65 + script=settings.readEntry
1.66 + ("/vym/export/html/script","vym2html.sh");
1.67 +
1.68 + proc = new QProcess( this );
1.69 + connect( proc, SIGNAL(readyReadStdout()),
1.70 + this, SLOT(readOutput()) );
1.71 +
1.72 + dia=new ShowTextDialog ();
1.73 +}
1.74 +
1.75 +void ExportHTMLDialog::destroy()
1.76 +{
1.77 + delete (proc);
1.78 + delete (dia);
1.79 +}
1.80 +
1.81 +void ExportHTMLDialog::browseDirectory()
1.82 +{
1.83 + QFileDialog fd( this, tr("VYM - Export HTML to directory"));
1.84 + fd.setMode (QFileDialog::DirectoryOnly);
1.85 + fd.setCaption(tr("VYM - Export HTML to directory"));
1.86 + fd.setModal (true);
1.87 + fd.show();
1.88 +
1.89 + if ( fd.exec() == QDialog::Accepted )
1.90 + {
1.91 + dir=fd.selectedFile();
1.92 + lineEdit1->setText (dir );
1.93 + }
1.94 +}
1.95 +
1.96 +void ExportHTMLDialog::useWIKIpressed(bool b)
1.97 +{
1.98 + wikistyle=b;
1.99 +}
1.100 +
1.101 +void ExportHTMLDialog::includeImage(bool b)
1.102 +{
1.103 + image=b;
1.104 +}
1.105 +
1.106 +void ExportHTMLDialog::imgOnly(bool b)
1.107 +{
1.108 + imageOnly=b;
1.109 +}
1.110 +
1.111 +void ExportHTMLDialog::useHeadingPressed(bool b)
1.112 +{
1.113 + useHeading=b;
1.114 +}
1.115 +
1.116 +void ExportHTMLDialog::useURLImagePressed(bool b)
1.117 +{
1.118 + useURLImage=b;
1.119 +}
1.120 +
1.121 +void ExportHTMLDialog::showOut(bool b)
1.122 +{
1.123 + showOutput=b;
1.124 +}
1.125 +
1.126 +void ExportHTMLDialog::dirChanged()
1.127 +{
1.128 + dir=lineEdit1->text();
1.129 +}
1.130 +
1.131 +
1.132 +
1.133 +
1.134 +void ExportHTMLDialog::doExport (const QString &mapname)
1.135 +{
1.136 + // Save options to settings file
1.137 + // (but don't save at destructor, which
1.138 + // is called for "cancel", too)
1.139 + settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() );
1.140 +
1.141 + if (wikistyle)
1.142 + settings.writeEntry ("/vym/export/html/wiki","yes");
1.143 + else
1.144 + settings.writeEntry ("/vym/export/html/wiki","no");
1.145 +
1.146 + if (image)
1.147 + settings.writeEntry ("/vym/export/html/image","yes");
1.148 + else
1.149 + settings.writeEntry ("/vym/export/html/image","no");
1.150 +
1.151 + if (imageOnly)
1.152 + settings.writeEntry ("/vym/export/html/imageOnly","yes");
1.153 + else
1.154 + settings.writeEntry ("/vym/export/html/imageOnly","no");
1.155 +
1.156 + if (useHeading)
1.157 + settings.writeEntry ("/vym/export/html/useHeading","yes");
1.158 + else
1.159 + settings.writeEntry ("/vym/export/html/useHeading","no");
1.160 +
1.161 + if (showOutput)
1.162 + settings.writeEntry ("/vym/export/html/showOutput","yes");
1.163 + else
1.164 + settings.writeEntry ("/vym/export/html/showOutput","no");
1.165 +
1.166 + settings.writeEntry
1.167 + ("/vym/export/html/styles",stylepath);
1.168 + settings.writeEntry
1.169 + ("/vym/export/html/scripts",scriptpath);
1.170 + settings.writeEntry
1.171 + ("/vym/export/html/xsl",xsl);
1.172 + settings.writeEntry
1.173 + ("/vym/export/html/css",css);
1.174 + settings.writeEntry
1.175 + ("/vym/export/html/script",script);
1.176 +
1.177 + proc->addArgument (scriptpath + "/" + script );
1.178 + proc->addArgument(dir + maskPath(mapname) + ".xml");
1.179 + proc->addArgument("-sp=" + stylepath +"/" + xsl );
1.180 + proc->addArgument("-css=" + css );
1.181 + if (image) proc->addArgument("-image" );
1.182 + if (wikistyle) proc->addArgument("-wikistyle" );
1.183 + if (useHeading) proc->addArgument("-useURLHeading" );
1.184 + if (useURLImage)
1.185 + {
1.186 + proc->addArgument("-useURLImage" );
1.187 + QPixmap pm (flag_url_xpm);
1.188 + pm.save (dir + "/flags/url.png","PNG");
1.189 + }
1.190 +
1.191 + dia->append ("vym is executing: " + proc->arguments().join(" ") );
1.192 + if ( !proc->start() )
1.193 + {
1.194 + // error handling
1.195 + dia->show();
1.196 + QString s;
1.197 + QStringList list = proc->arguments();
1.198 + QStringList::Iterator it = list.begin();
1.199 + while( it != list.end() )
1.200 + {
1.201 + s+= ( *it ) + "\n";
1.202 + ++it;
1.203 + }
1.204 + QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s);
1.205 + } else
1.206 + if (showOutput) dia->exec();
1.207 +
1.208 +
1.209 +}
1.210 +
1.211 +
1.212 +QString ExportHTMLDialog::getDir()
1.213 +{
1.214 + return dir;
1.215 +}
1.216 +
1.217 +
1.218 +void ExportHTMLDialog::readOutput()
1.219 +{
1.220 + dia->append (proc->readStdout() );
1.221 +}