exporthtmldialog.ui.h
author insilmaril
Thu Jul 27 15:13:16 2006 +0000 (2006-07-27)
changeset 359 343d55383450
permissions -rw-r--r--
added changelog entry for last fix
insilmaril@0
     1
/****************************************************************************
insilmaril@0
     2
** ui.h extension file, included from the uic-generated form implementation.
insilmaril@0
     3
**
insilmaril@0
     4
** If you wish to add, delete or rename functions or slots use
insilmaril@0
     5
** Qt Designer which will update this file, preserving your code. Create an
insilmaril@0
     6
** init() function in place of a constructor, and a destroy() function in
insilmaril@0
     7
** place of a destructor.
insilmaril@0
     8
*****************************************************************************/
insilmaril@0
     9
insilmaril@0
    10
insilmaril@0
    11
extern Settings settings;
insilmaril@0
    12
insilmaril@0
    13
void ExportHTMLDialog::init()
insilmaril@0
    14
{
insilmaril@0
    15
	dir=settings.readEntry ("/vym/export/html/dir","" );
insilmaril@0
    16
	lineEdit1->setText(dir);
insilmaril@0
    17
	
insilmaril@0
    18
    if ( settings.readEntry ("/vym/export/html/image","yes")=="yes")
insilmaril@0
    19
		image=true;
insilmaril@0
    20
	else	
insilmaril@0
    21
		image=false;
insilmaril@0
    22
	checkBox4->setChecked(image);
insilmaril@0
    23
	
insilmaril@0
    24
	if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes")
insilmaril@0
    25
		imageOnly=true;
insilmaril@0
    26
	else	
insilmaril@0
    27
		imageOnly=false;
insilmaril@0
    28
	checkBox5_2->setChecked(imageOnly);
insilmaril@0
    29
		
insilmaril@0
    30
    if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes")
insilmaril@0
    31
		wikistyle=true;
insilmaril@0
    32
	else	
insilmaril@0
    33
		wikistyle=false;
insilmaril@0
    34
	checkBox5->setChecked(wikistyle);
insilmaril@0
    35
	
insilmaril@0
    36
	if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
insilmaril@0
    37
		useHeading=true;
insilmaril@0
    38
	else	
insilmaril@0
    39
		useHeading=false;
insilmaril@0
    40
	checkBox4_2->setChecked(useHeading);
insilmaril@0
    41
		
insilmaril@0
    42
	if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes")
insilmaril@0
    43
		useURLImage=true;
insilmaril@0
    44
	else	
insilmaril@0
    45
		useURLImage=false;
insilmaril@0
    46
	checkBox6->setChecked(useURLImage);
insilmaril@0
    47
	
insilmaril@0
    48
	if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes")
insilmaril@0
    49
		showOutput=true;
insilmaril@0
    50
	else	
insilmaril@0
    51
		showOutput=false;
insilmaril@0
    52
	checkBox3->setChecked(showOutput);
insilmaril@0
    53
		
insilmaril@0
    54
	stylepath=settings.readEntry
insilmaril@0
    55
		("/vym/export/html/styles","styles");
insilmaril@0
    56
	scriptpath=settings.readEntry 
insilmaril@0
    57
		("/vym/export/html/scripts","scripts");
insilmaril@0
    58
	xsl=settings.readEntry 
insilmaril@0
    59
		("/vym/export/html/xsl","vym2html.xsl");
insilmaril@0
    60
	css=settings.readEntry 
insilmaril@0
    61
		("/vym/export/html/css","vym.css");	
insilmaril@0
    62
	script=settings.readEntry 
insilmaril@0
    63
		("/vym/export/html/script","vym2html.sh");	
insilmaril@0
    64
	
insilmaril@0
    65
	proc = new QProcess( this );
insilmaril@0
    66
	connect( proc, SIGNAL(readyReadStdout()),
insilmaril@0
    67
			 this, SLOT(readOutput()) );
insilmaril@0
    68
insilmaril@0
    69
	dia=new ShowTextDialog ();
insilmaril@0
    70
}
insilmaril@0
    71
insilmaril@0
    72
void ExportHTMLDialog::destroy()
insilmaril@0
    73
{
insilmaril@0
    74
	delete (proc);
insilmaril@0
    75
	delete (dia);
insilmaril@0
    76
}
insilmaril@0
    77
insilmaril@0
    78
void ExportHTMLDialog::browseDirectory()
insilmaril@0
    79
{
insilmaril@0
    80
   	QFileDialog fd( this, tr("VYM - Export HTML to directory"));
insilmaril@0
    81
	fd.setMode (QFileDialog::DirectoryOnly);
insilmaril@0
    82
	fd.setCaption(tr("VYM - Export HTML to directory"));
insilmaril@0
    83
	fd.setModal (true);
insilmaril@0
    84
	fd.show();
insilmaril@0
    85
insilmaril@0
    86
	if ( fd.exec() == QDialog::Accepted )
insilmaril@0
    87
	{
insilmaril@0
    88
		dir=fd.selectedFile();
insilmaril@0
    89
		lineEdit1->setText (dir );
insilmaril@0
    90
	}
insilmaril@0
    91
}
insilmaril@0
    92
insilmaril@0
    93
void ExportHTMLDialog::useWIKIpressed(bool b)
insilmaril@0
    94
{
insilmaril@0
    95
	wikistyle=b;
insilmaril@0
    96
}
insilmaril@0
    97
insilmaril@0
    98
void ExportHTMLDialog::includeImage(bool b)
insilmaril@0
    99
{
insilmaril@0
   100
	image=b;
insilmaril@0
   101
}
insilmaril@0
   102
insilmaril@0
   103
void ExportHTMLDialog::imgOnly(bool b)
insilmaril@0
   104
{
insilmaril@0
   105
	imageOnly=b;
insilmaril@0
   106
}
insilmaril@0
   107
insilmaril@0
   108
void ExportHTMLDialog::useHeadingPressed(bool b)
insilmaril@0
   109
{
insilmaril@0
   110
	useHeading=b;
insilmaril@0
   111
}
insilmaril@0
   112
insilmaril@0
   113
void ExportHTMLDialog::useURLImagePressed(bool b)
insilmaril@0
   114
{
insilmaril@0
   115
	useURLImage=b;
insilmaril@0
   116
}
insilmaril@0
   117
insilmaril@0
   118
void ExportHTMLDialog::showOut(bool b)
insilmaril@0
   119
{
insilmaril@0
   120
	showOutput=b;
insilmaril@0
   121
}
insilmaril@0
   122
insilmaril@0
   123
void ExportHTMLDialog::dirChanged()
insilmaril@0
   124
{
insilmaril@0
   125
	dir=lineEdit1->text();
insilmaril@0
   126
}
insilmaril@0
   127
insilmaril@0
   128
insilmaril@0
   129
insilmaril@0
   130
insilmaril@0
   131
void ExportHTMLDialog::doExport (const QString &mapname)
insilmaril@0
   132
{
insilmaril@0
   133
	// Save options to settings file 
insilmaril@0
   134
	// (but don't save at destructor, which
insilmaril@0
   135
	// is called for "cancel", too)
insilmaril@0
   136
	settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() );
insilmaril@0
   137
insilmaril@0
   138
	if (wikistyle)
insilmaril@0
   139
		settings.writeEntry ("/vym/export/html/wiki","yes");
insilmaril@0
   140
	else	
insilmaril@0
   141
		settings.writeEntry ("/vym/export/html/wiki","no");
insilmaril@0
   142
insilmaril@0
   143
    if (image)
insilmaril@0
   144
		settings.writeEntry ("/vym/export/html/image","yes");
insilmaril@0
   145
    else
insilmaril@0
   146
		settings.writeEntry ("/vym/export/html/image","no");	
insilmaril@0
   147
	
insilmaril@0
   148
  if (imageOnly)
insilmaril@0
   149
		settings.writeEntry ("/vym/export/html/imageOnly","yes");
insilmaril@0
   150
    else
insilmaril@0
   151
		settings.writeEntry ("/vym/export/html/imageOnly","no");	
insilmaril@0
   152
	
insilmaril@0
   153
  if (useHeading)
insilmaril@0
   154
		settings.writeEntry ("/vym/export/html/useHeading","yes");
insilmaril@0
   155
    else
insilmaril@0
   156
		settings.writeEntry ("/vym/export/html/useHeading","no");	
insilmaril@0
   157
			
insilmaril@0
   158
    if (showOutput)
insilmaril@0
   159
		settings.writeEntry ("/vym/export/html/showOutput","yes");
insilmaril@0
   160
    else
insilmaril@0
   161
		settings.writeEntry ("/vym/export/html/showOutput","no");	
insilmaril@0
   162
		
insilmaril@0
   163
	settings.writeEntry
insilmaril@0
   164
		("/vym/export/html/styles",stylepath);
insilmaril@0
   165
	settings.writeEntry 
insilmaril@0
   166
		("/vym/export/html/scripts",scriptpath);
insilmaril@0
   167
	settings.writeEntry 
insilmaril@0
   168
		("/vym/export/html/xsl",xsl);
insilmaril@0
   169
	settings.writeEntry 
insilmaril@0
   170
		("/vym/export/html/css",css);	
insilmaril@0
   171
	settings.writeEntry 
insilmaril@0
   172
		("/vym/export/html/script",script);	
insilmaril@0
   173
insilmaril@0
   174
	proc->addArgument (scriptpath + "/" + script );
insilmaril@0
   175
	proc->addArgument(dir + maskPath(mapname) + ".xml");
insilmaril@0
   176
	proc->addArgument("-sp=" + stylepath +"/" + xsl );
insilmaril@0
   177
	proc->addArgument("-css=" + css );
insilmaril@0
   178
	if (image) proc->addArgument("-image" );
insilmaril@0
   179
	if (wikistyle) proc->addArgument("-wikistyle" );
insilmaril@0
   180
	if (useHeading) proc->addArgument("-useURLHeading" );
insilmaril@0
   181
	if (useURLImage) 
insilmaril@0
   182
	{	
insilmaril@0
   183
		proc->addArgument("-useURLImage" );
insilmaril@0
   184
		QPixmap pm (flag_url_xpm);
insilmaril@0
   185
		pm.save (dir + "/flags/url.png","PNG");
insilmaril@0
   186
	}	
insilmaril@0
   187
insilmaril@0
   188
	dia->append ("vym is executing: " + proc->arguments().join(" ") );
insilmaril@0
   189
	if ( !proc->start() ) 
insilmaril@0
   190
	{
insilmaril@0
   191
		// error handling
insilmaril@0
   192
		dia->show();
insilmaril@0
   193
		QString s;
insilmaril@0
   194
		QStringList list = proc->arguments();
insilmaril@0
   195
		QStringList::Iterator it = list.begin();
insilmaril@0
   196
		while( it != list.end() ) 
insilmaril@0
   197
		{
insilmaril@0
   198
			s+= ( *it ) + "\n";
insilmaril@0
   199
			++it;
insilmaril@0
   200
		}
insilmaril@0
   201
		QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s);
insilmaril@0
   202
	} else 
insilmaril@0
   203
		if (showOutput) dia->exec();
insilmaril@0
   204
	
insilmaril@0
   205
insilmaril@0
   206
}
insilmaril@0
   207
insilmaril@0
   208
insilmaril@0
   209
QString ExportHTMLDialog::getDir()
insilmaril@0
   210
{
insilmaril@0
   211
	return dir;
insilmaril@0
   212
}
insilmaril@0
   213
insilmaril@0
   214
insilmaril@0
   215
void ExportHTMLDialog::readOutput()
insilmaril@0
   216
{
insilmaril@0
   217
	dia->append (proc->readStdout() );
insilmaril@0
   218
}