insilmaril@0: /**************************************************************************** insilmaril@0: ** ui.h extension file, included from the uic-generated form implementation. insilmaril@0: ** insilmaril@0: ** If you wish to add, delete or rename functions or slots use insilmaril@0: ** Qt Designer which will update this file, preserving your code. Create an insilmaril@0: ** init() function in place of a constructor, and a destroy() function in insilmaril@0: ** place of a destructor. insilmaril@0: *****************************************************************************/ insilmaril@0: insilmaril@0: insilmaril@0: extern Settings settings; insilmaril@0: insilmaril@0: void ExportHTMLDialog::init() insilmaril@0: { insilmaril@0: dir=settings.readEntry ("/vym/export/html/dir","" ); insilmaril@0: lineEdit1->setText(dir); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/image","yes")=="yes") insilmaril@0: image=true; insilmaril@0: else insilmaril@0: image=false; insilmaril@0: checkBox4->setChecked(image); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes") insilmaril@0: imageOnly=true; insilmaril@0: else insilmaril@0: imageOnly=false; insilmaril@0: checkBox5_2->setChecked(imageOnly); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes") insilmaril@0: wikistyle=true; insilmaril@0: else insilmaril@0: wikistyle=false; insilmaril@0: checkBox5->setChecked(wikistyle); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes") insilmaril@0: useHeading=true; insilmaril@0: else insilmaril@0: useHeading=false; insilmaril@0: checkBox4_2->setChecked(useHeading); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes") insilmaril@0: useURLImage=true; insilmaril@0: else insilmaril@0: useURLImage=false; insilmaril@0: checkBox6->setChecked(useURLImage); insilmaril@0: insilmaril@0: if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes") insilmaril@0: showOutput=true; insilmaril@0: else insilmaril@0: showOutput=false; insilmaril@0: checkBox3->setChecked(showOutput); insilmaril@0: insilmaril@0: stylepath=settings.readEntry insilmaril@0: ("/vym/export/html/styles","styles"); insilmaril@0: scriptpath=settings.readEntry insilmaril@0: ("/vym/export/html/scripts","scripts"); insilmaril@0: xsl=settings.readEntry insilmaril@0: ("/vym/export/html/xsl","vym2html.xsl"); insilmaril@0: css=settings.readEntry insilmaril@0: ("/vym/export/html/css","vym.css"); insilmaril@0: script=settings.readEntry insilmaril@0: ("/vym/export/html/script","vym2html.sh"); insilmaril@0: insilmaril@0: proc = new QProcess( this ); insilmaril@0: connect( proc, SIGNAL(readyReadStdout()), insilmaril@0: this, SLOT(readOutput()) ); insilmaril@0: insilmaril@0: dia=new ShowTextDialog (); insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::destroy() insilmaril@0: { insilmaril@0: delete (proc); insilmaril@0: delete (dia); insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::browseDirectory() insilmaril@0: { insilmaril@0: QFileDialog fd( this, tr("VYM - Export HTML to directory")); insilmaril@0: fd.setMode (QFileDialog::DirectoryOnly); insilmaril@0: fd.setCaption(tr("VYM - Export HTML to directory")); insilmaril@0: fd.setModal (true); insilmaril@0: fd.show(); insilmaril@0: insilmaril@0: if ( fd.exec() == QDialog::Accepted ) insilmaril@0: { insilmaril@0: dir=fd.selectedFile(); insilmaril@0: lineEdit1->setText (dir ); insilmaril@0: } insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::useWIKIpressed(bool b) insilmaril@0: { insilmaril@0: wikistyle=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::includeImage(bool b) insilmaril@0: { insilmaril@0: image=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::imgOnly(bool b) insilmaril@0: { insilmaril@0: imageOnly=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::useHeadingPressed(bool b) insilmaril@0: { insilmaril@0: useHeading=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::useURLImagePressed(bool b) insilmaril@0: { insilmaril@0: useURLImage=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::showOut(bool b) insilmaril@0: { insilmaril@0: showOutput=b; insilmaril@0: } insilmaril@0: insilmaril@0: void ExportHTMLDialog::dirChanged() insilmaril@0: { insilmaril@0: dir=lineEdit1->text(); insilmaril@0: } insilmaril@0: insilmaril@0: insilmaril@0: insilmaril@0: insilmaril@0: void ExportHTMLDialog::doExport (const QString &mapname) insilmaril@0: { insilmaril@0: // Save options to settings file insilmaril@0: // (but don't save at destructor, which insilmaril@0: // is called for "cancel", too) insilmaril@0: settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() ); insilmaril@0: insilmaril@0: if (wikistyle) insilmaril@0: settings.writeEntry ("/vym/export/html/wiki","yes"); insilmaril@0: else insilmaril@0: settings.writeEntry ("/vym/export/html/wiki","no"); insilmaril@0: insilmaril@0: if (image) insilmaril@0: settings.writeEntry ("/vym/export/html/image","yes"); insilmaril@0: else insilmaril@0: settings.writeEntry ("/vym/export/html/image","no"); insilmaril@0: insilmaril@0: if (imageOnly) insilmaril@0: settings.writeEntry ("/vym/export/html/imageOnly","yes"); insilmaril@0: else insilmaril@0: settings.writeEntry ("/vym/export/html/imageOnly","no"); insilmaril@0: insilmaril@0: if (useHeading) insilmaril@0: settings.writeEntry ("/vym/export/html/useHeading","yes"); insilmaril@0: else insilmaril@0: settings.writeEntry ("/vym/export/html/useHeading","no"); insilmaril@0: insilmaril@0: if (showOutput) insilmaril@0: settings.writeEntry ("/vym/export/html/showOutput","yes"); insilmaril@0: else insilmaril@0: settings.writeEntry ("/vym/export/html/showOutput","no"); insilmaril@0: insilmaril@0: settings.writeEntry insilmaril@0: ("/vym/export/html/styles",stylepath); insilmaril@0: settings.writeEntry insilmaril@0: ("/vym/export/html/scripts",scriptpath); insilmaril@0: settings.writeEntry insilmaril@0: ("/vym/export/html/xsl",xsl); insilmaril@0: settings.writeEntry insilmaril@0: ("/vym/export/html/css",css); insilmaril@0: settings.writeEntry insilmaril@0: ("/vym/export/html/script",script); insilmaril@0: insilmaril@0: proc->addArgument (scriptpath + "/" + script ); insilmaril@0: proc->addArgument(dir + maskPath(mapname) + ".xml"); insilmaril@0: proc->addArgument("-sp=" + stylepath +"/" + xsl ); insilmaril@0: proc->addArgument("-css=" + css ); insilmaril@0: if (image) proc->addArgument("-image" ); insilmaril@0: if (wikistyle) proc->addArgument("-wikistyle" ); insilmaril@0: if (useHeading) proc->addArgument("-useURLHeading" ); insilmaril@0: if (useURLImage) insilmaril@0: { insilmaril@0: proc->addArgument("-useURLImage" ); insilmaril@0: QPixmap pm (flag_url_xpm); insilmaril@0: pm.save (dir + "/flags/url.png","PNG"); insilmaril@0: } insilmaril@0: insilmaril@0: dia->append ("vym is executing: " + proc->arguments().join(" ") ); insilmaril@0: if ( !proc->start() ) insilmaril@0: { insilmaril@0: // error handling insilmaril@0: dia->show(); insilmaril@0: QString s; insilmaril@0: QStringList list = proc->arguments(); insilmaril@0: QStringList::Iterator it = list.begin(); insilmaril@0: while( it != list.end() ) insilmaril@0: { insilmaril@0: s+= ( *it ) + "\n"; insilmaril@0: ++it; insilmaril@0: } insilmaril@0: QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s); insilmaril@0: } else insilmaril@0: if (showOutput) dia->exec(); insilmaril@0: insilmaril@0: insilmaril@0: } insilmaril@0: insilmaril@0: insilmaril@0: QString ExportHTMLDialog::getDir() insilmaril@0: { insilmaril@0: return dir; insilmaril@0: } insilmaril@0: insilmaril@0: insilmaril@0: void ExportHTMLDialog::readOutput() insilmaril@0: { insilmaril@0: dia->append (proc->readStdout() ); insilmaril@0: }