1.1 --- a/branchitem.cpp Thu Feb 25 11:03:52 2010 +0000
1.2 +++ b/branchitem.cpp Tue Mar 02 13:59:19 2010 +0000
1.3 @@ -166,7 +166,7 @@
1.4 ol=cl;
1.5 } else
1.6 {
1.7 - qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
1.8 + qWarning (QString("BranchItem::saveToDir Ignoring of duplicate xLink in %1").arg(getHeading()));
1.9 }
1.10 }
1.11
2.1 --- a/bugagent.cpp Thu Feb 25 11:03:52 2010 +0000
2.2 +++ b/bugagent.cpp Tue Mar 02 13:59:19 2010 +0000
2.3 @@ -30,29 +30,11 @@
2.4 qWarning()<<"BugAgent::getBugzillaData couldn't start "<<script;
2.5 return;
2.6 }
2.7 -
2.8 - /*
2.9 - QString result=getStdout();
2.10 - while (result.endsWith("\n")) result.chop(1);
2.11 - //qWarning << QString(result);
2.12 - QString err=getErrout();
2.13 - if (!err.isEmpty())
2.14 - {
2.15 - qWarning << "BugAgent::getBugzillaData Error:\n";
2.16 - qWarning <<err;
2.17 - }
2.18 - else if (!result.isEmpty())
2.19 - {
2.20 - qWarning << "ok\n";
2.21 - }
2.22 -
2.23 - */
2.24 }
2.25
2.26 BugAgent::~BugAgent ()
2.27 {
2.28 delete p;
2.29 - qDebug ()<<"dest BugAgent";
2.30 }
2.31
2.32 void BugAgent::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
3.1 --- a/exporthtmldialog.cpp Thu Feb 25 11:03:52 2010 +0000
3.2 +++ b/exporthtmldialog.cpp Tue Mar 02 13:59:19 2010 +0000
3.3 @@ -20,7 +20,6 @@
3.4
3.5 filepath="";
3.6 settingsChanged=false;
3.7 - scriptProc=new Process;
3.8
3.9 // signals and slots connections
3.10 connect(ui.browseExportDirButton, SIGNAL(pressed()), this, SLOT(browseDirectoryPressed()));
3.11 @@ -31,8 +30,6 @@
3.12 connect(ui.lineEditDir, SIGNAL(textChanged(const QString&)), this, SLOT(dirChanged()));
3.13 connect(ui.lineEditCSS, SIGNAL(textChanged(const QString&)), this, SLOT(cssChanged()));
3.14 connect(ui.saveSettingsInMapButton, SIGNAL(toggled(bool)), this, SLOT(saveSettingsInMapButtonPressed(bool)));
3.15 - connect(ui.browsePreExportButton, SIGNAL(pressed()), this, SLOT(browsePreExportButtonPressed()));
3.16 - connect(ui.lineEditPreScript, SIGNAL(textChanged(const QString&)), this, SLOT(prescriptChanged()));
3.17 connect(ui.lineEditPostScript, SIGNAL(textChanged(const QString&)), this, SLOT(postscriptChanged()));
3.18 connect(ui.browsePostExportButton, SIGNAL(pressed()), this, SLOT(browsePostExportButtonPressed()));
3.19 }
3.20 @@ -88,22 +85,18 @@
3.21 }
3.22 ui.lineEditCSS->setText(css);
3.23
3.24 - prescript=settings.readLocalEntry
3.25 - (filepath,"/export/html/prescript","");
3.26 - ui.lineEditPreScript->setText (prescript);
3.27 -
3.28 postscript=settings.readLocalEntry
3.29 (filepath,"/export/html/postscript","");
3.30 ui.lineEditPostScript->setText (postscript);
3.31
3.32 - if (!prescript.isEmpty() || !postscript.isEmpty())
3.33 + if (!postscript.isEmpty())
3.34 {
3.35 QMessageBox::warning( 0, tr( "Warning" ),tr(
3.36 "The settings saved in the map "
3.37 - "would like to run scripts:\n\n"
3.38 + "would like to run script:\n\n"
3.39 "%1\n\n"
3.40 "Please check, if you really\n"
3.41 - "want to allow this in your system!").arg(prescript+" "+postscript));
3.42 + "want to allow this in your system!").arg(postscript));
3.43
3.44 }
3.45 }
3.46 @@ -195,35 +188,12 @@
3.47 }
3.48 }
3.49
3.50 -void ExportHTMLDialog::prescriptChanged()
3.51 -{
3.52 - prescript=ui.lineEditPreScript->text();
3.53 - settingsChanged=true;
3.54 -}
3.55 -
3.56 void ExportHTMLDialog::postscriptChanged()
3.57 {
3.58 postscript=ui.lineEditPostScript->text();
3.59 settingsChanged=true;
3.60 }
3.61
3.62 -void ExportHTMLDialog::browsePreExportButtonPressed()
3.63 -{
3.64 - QFileDialog fd( this);
3.65 - fd.setModal (true);
3.66 - fd.setFilter ("Scripts (*.sh *.pl *.py *.php)");
3.67 - fd.setDirectory (QDir::current());
3.68 - fd.show();
3.69 -
3.70 - if ( fd.exec() == QDialog::Accepted )
3.71 - {
3.72 - prescript=fd.selectedFile();
3.73 - ui.lineEditPreScript->setText (prescript );
3.74 - settingsChanged=true;
3.75 - }
3.76 -
3.77 -}
3.78 -
3.79 void ExportHTMLDialog::browsePostExportButtonPressed()
3.80 {
3.81 QFileDialog fd( this);
3.82 @@ -241,14 +211,13 @@
3.83 }
3.84
3.85
3.86 -void ExportHTMLDialog::doExport (const QString &mapname)
3.87 +void ExportHTMLDialog::saveSettings ()
3.88 {
3.89
3.90 // Save options to settings file
3.91 // (but don't save at destructor, which
3.92 // is called for "cancel", too)
3.93 settings.setLocalEntry (filepath,"/export/html/exportDir",dir);
3.94 - settings.setLocalEntry (filepath,"/export/html/prescript",prescript);
3.95 settings.setLocalEntry (filepath,"/export/html/postscript",postscript);
3.96
3.97 if (useImage)
3.98 @@ -285,7 +254,7 @@
3.99 settings.setLocalEntry
3.100 (filepath,"/export/html/saveSettingsInMap","yes");
3.101
3.102 - // Provide a smaller URL-icon to improve Layout //FIXME-1
3.103 + // Provide a smaller URL-icon to improve Layout //FIXME-1 add option to choose this
3.104 QPixmap pm;
3.105 if (!pm.load(ipath,"PNG") )
3.106 QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
3.107 @@ -294,22 +263,6 @@
3.108 if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
3.109 QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
3.110
3.111 - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
3.112 -
3.113 - /* FIXME-1
3.114 - if (useImage)
3.115 - p.addStringParam ("imagemap","images/"+mapname+".png");
3.116 - if (useTextColor)
3.117 - p.addStringParam ("use.textcolor","1");
3.118 - p.addStringParam ("mapname",mapname+".vym");
3.119 -
3.120 - p.setOutputFile (dir+mapname+".html");
3.121 - p.setInputFile (dir+mapname+".xml");
3.122 - p.process();
3.123 - */
3.124 -
3.125 - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
3.126 -
3.127 }
3.128
3.129 void ExportHTMLDialog::setFilePath(const QString &s)
3.130 @@ -338,31 +291,3 @@
3.131 }
3.132
3.133
3.134 -void ExportHTMLDialog::runScript(QString spath, QString fpath)
3.135 -{
3.136 - spath.replace ("%f",fpath);
3.137 - QStringList args=QStringList::split (' ',spath,false);
3.138 -
3.139 - //FIXME-1 p.addOutput ("vym is executing: \n" + spath+" "+args.join(" ") );
3.140 - scriptProc->start (spath,args);
3.141 - if (!scriptProc->waitForStarted() )
3.142 - {
3.143 - QMessageBox::critical( 0, tr( "Critical Error" ),
3.144 - tr("Could not start %1").arg(spath) );
3.145 - } else
3.146 - {
3.147 - if (!scriptProc->waitForFinished())
3.148 - QMessageBox::critical( 0, tr( "Critical Error" ),
3.149 - tr("%1 didn't exit normally").arg(spath) +
3.150 - scriptProc->getErrout() );
3.151 - else
3.152 - if (scriptProc->exitStatus()>0) showOutput=true;
3.153 -
3.154 - }
3.155 - /* FIXME-1
3.156 - p.addOutput ("\n");
3.157 - p.addOutput (scriptProc->getErrout());
3.158 - p.addOutput (scriptProc->getStdout());
3.159 - */
3.160 -}
3.161 -
4.1 --- a/exporthtmldialog.h Thu Feb 25 11:03:52 2010 +0000
4.2 +++ b/exporthtmldialog.h Tue Mar 02 13:59:19 2010 +0000
4.3 @@ -32,34 +32,30 @@
4.4 virtual void cssChanged();
4.5 virtual QString getCSSPath();
4.6 virtual void browseCSSPressed();
4.7 - virtual void prescriptChanged();
4.8 virtual void postscriptChanged();
4.9 - virtual void browsePreExportButtonPressed();
4.10 virtual void browsePostExportButtonPressed();
4.11 - virtual void doExport( const QString & mapname );
4.12 + virtual void saveSettings ();
4.13 virtual void setFilePath( const QString & s );
4.14 virtual void setMapName( const QString & s );
4.15
4.16 +public:
4.17 + bool useImage;
4.18 + bool useTextColor;
4.19 + QString postscript;
4.20 +
4.21 protected:
4.22 - bool useTextColor;
4.23 bool showWarnings;
4.24 QString css;
4.25 - bool useImage;
4.26 bool showOutput;
4.27 QString dir;
4.28 QString filepath;
4.29 - QString prescript;
4.30 - QString postscript;
4.31 bool settingsChanged;
4.32 QString mapname;
4.33 bool saveSettingsInMap;
4.34 - Process *scriptProc;
4.35
4.36 private:
4.37 Ui::ExportHTMLDialog ui;
4.38 void init();
4.39 - void destroy();
4.40 - void runScript( QString spath, QString fpath );
4.41
4.42 };
4.43
5.1 --- a/exporthtmldialog.ui Thu Feb 25 11:03:52 2010 +0000
5.2 +++ b/exporthtmldialog.ui Tue Mar 02 13:59:19 2010 +0000
5.3 @@ -6,8 +6,8 @@
5.4 <rect>
5.5 <x>0</x>
5.6 <y>0</y>
5.7 - <width>684</width>
5.8 - <height>471</height>
5.9 + <width>681</width>
5.10 + <height>434</height>
5.11 </rect>
5.12 </property>
5.13 <property name="sizePolicy">
5.14 @@ -89,7 +89,7 @@
5.15 <property name="title">
5.16 <string>Options</string>
5.17 </property>
5.18 - <widget class="QWidget" name="">
5.19 + <widget class="QWidget" name="layoutWidget">
5.20 <property name="geometry">
5.21 <rect>
5.22 <x>20</x>
5.23 @@ -257,54 +257,6 @@
5.24 <number>0</number>
5.25 </property>
5.26 <item>
5.27 - <widget class="QLabel" name="textLabel1_3">
5.28 - <property name="sizePolicy">
5.29 - <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
5.30 - <horstretch>0</horstretch>
5.31 - <verstretch>0</verstretch>
5.32 - </sizepolicy>
5.33 - </property>
5.34 - <property name="minimumSize">
5.35 - <size>
5.36 - <width>125</width>
5.37 - <height>0</height>
5.38 - </size>
5.39 - </property>
5.40 - <property name="text">
5.41 - <string>Before export:</string>
5.42 - </property>
5.43 - <property name="alignment">
5.44 - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
5.45 - </property>
5.46 - </widget>
5.47 - </item>
5.48 - <item>
5.49 - <widget class="QLineEdit" name="lineEditPreScript"/>
5.50 - </item>
5.51 - <item>
5.52 - <widget class="QPushButton" name="browsePreExportButton">
5.53 - <property name="sizePolicy">
5.54 - <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
5.55 - <horstretch>0</horstretch>
5.56 - <verstretch>0</verstretch>
5.57 - </sizepolicy>
5.58 - </property>
5.59 - <property name="text">
5.60 - <string>Browse</string>
5.61 - </property>
5.62 - </widget>
5.63 - </item>
5.64 - </layout>
5.65 - </item>
5.66 - <item row="1" column="0">
5.67 - <layout class="QHBoxLayout">
5.68 - <property name="spacing">
5.69 - <number>6</number>
5.70 - </property>
5.71 - <property name="margin">
5.72 - <number>0</number>
5.73 - </property>
5.74 - <item>
5.75 <widget class="QLabel" name="textLabel2_2">
5.76 <property name="sizePolicy">
5.77 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
6.1 --- a/exports.cpp Thu Feb 25 11:03:52 2010 +0000
6.2 +++ b/exports.cpp Tue Mar 02 13:59:19 2010 +0000
6.3 @@ -484,7 +484,6 @@
6.4 singularDelimiter=": ";
6.5 noSingulars=true;
6.6 frameURLs=true;
6.7 - useMapColors=true;
6.8 cssFileName="vym.css";
6.9 cssOriginalPath=""; // Is set in VymModel, based on default setting in ExportHTMLDialog
6.10
6.11 @@ -506,7 +505,7 @@
6.12 }
6.13 QString col;
6.14 QString id=model->getSelectString(current);
6.15 - if (useMapColors)
6.16 + if (dia.useTextColor)
6.17 col=QString("style='color:%1'").arg(current->getHeadingColor().name());
6.18 QString s=QString("<span class='vym-branch%1' %2 id='%3'>")
6.19 .arg(current->depth())
6.20 @@ -531,7 +530,7 @@
6.21 s+=quotemeta(current->getHeading());
6.22 s+="</span>";
6.23
6.24 - if (vis)
6.25 + if (vis && dia.useImage)
6.26 imageMap+=QString(" <area shape='rect' coords='%1,%2,%3,%4' href='#%5'>\n")
6.27 .arg(hr.left()-offset.x())
6.28 .arg(hr.top()-offset.y())
6.29 @@ -595,9 +594,39 @@
6.30 cssOriginalPath=p;
6.31 }
6.32
6.33 -void ExportHTML::doExport()
6.34 +void ExportHTML::doExport(bool useDialog)
6.35 {
6.36 - //FIXME-1 check for errors// Copy CSS file
6.37 + // Execute dialog
6.38 + dia.setFilePath (model->getFilePath());
6.39 + dia.setMapName (model->getMapName());
6.40 + dia.readSettings();
6.41 + if (useDialog && dia.exec()!=QDialog::Accepted) return;
6.42 +
6.43 + // Check if destination is not empty
6.44 + QDir d=dia.getDir();
6.45 + // Check, if warnings should be used before overwriting
6.46 + // the output directory
6.47 + if (d.exists() && d.count()>0)
6.48 + {
6.49 + WarningDialog warn;
6.50 + warn.showCancelButton (true);
6.51 + warn.setText(QString(
6.52 + "The directory %1 is not empty.\n"
6.53 + "Do you risk to overwrite some of its contents?").arg(d.path() ));
6.54 + warn.setCaption("Warning: Directory not empty");
6.55 + warn.setShowAgainName("mainwindow/export-XML-overwrite-dir");
6.56 +
6.57 + if (warn.exec()!=QDialog::Accepted)
6.58 + {
6.59 + mainWindow->statusMessage(QString(QObject::tr("Export aborted.")));
6.60 + return;
6.61 + }
6.62 + }
6.63 +
6.64 + setFile (d.path()+"/"+model->getMapName()+".html");
6.65 + setCSSPath( dia.getCSSPath() );
6.66 +
6.67 + // Copy CSS file
6.68 QFile css_src (cssOriginalPath);
6.69 QFile css_dst (outDir.path()+"/"+cssFileName);
6.70 if (!css_src.open ( QIODevice::ReadOnly))
6.71 @@ -631,13 +660,19 @@
6.72 QTextStream ts( &file ); // use LANG decoding here...
6.73 ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8
6.74
6.75 + // Hide stuff during export
6.76 + model->setExportMode (true);
6.77 +
6.78 // Write header
6.79 ts<<"<html><title>"+model->getMapName()<<"</title><body>";
6.80 ts<<" <link rel='stylesheet' id='css.stylesheet' href='"<<cssFileName<<"' />\n";
6.81
6.82 // Include image
6.83 - ts<<"<center><img src=\""<<model->getMapName()<<".png\" usemap='#imagemap'></center>\n";
6.84 -
6.85 + if (dia.useImage)
6.86 + {
6.87 + ts<<"<center><img src=\""<<model->getMapName()<<".png\" usemap='#imagemap'></center>\n";
6.88 + model->exportImage (d.path()+"/"+model->getMapName()+".png",false,"PNG");
6.89 + }
6.90
6.91 // Main loop over all mapcenters
6.92 QString s;
6.93 @@ -667,6 +702,16 @@
6.94 </table>\n";
6.95 ts<<"</body></html>";
6.96 file.close();
6.97 +
6.98 + if (!dia.postscript.isEmpty())
6.99 + {
6.100 + Process p;
6.101 + p.runScript (dia.postscript,d.path()+"/"+model->getMapName()+".html");
6.102 + }
6.103 +
6.104 +
6.105 + dia.saveSettings();
6.106 + model->setExportMode (true);
6.107 }
6.108
6.109 ////////////////////////////////////////////////////////////////////////
7.1 --- a/exports.h Thu Feb 25 11:03:52 2010 +0000
7.2 +++ b/exports.h Tue Mar 02 13:59:19 2010 +0000
7.3 @@ -93,6 +93,7 @@
7.4 virtual void doExport();
7.5 };
7.6
7.7 +#include "exporthtmldialog.h"
7.8 ///////////////////////////////////////////////////////////////////////
7.9 class ExportHTML:public ExportBase
7.10 {
7.11 @@ -101,7 +102,7 @@
7.12 ExportHTML(VymModel *m);
7.13 virtual void init();
7.14 virtual void setCSSPath(const QString &path);
7.15 - virtual void doExport();
7.16 + virtual void doExport(bool useDialog=true);
7.17 private:
7.18 QString getBranchText(BranchItem *);
7.19 QString buildList (BranchItem *);
7.20 @@ -112,9 +113,10 @@
7.21 bool frameURLs;
7.22 bool noSingulars;
7.23 QString singularDelimiter;
7.24 - bool useMapColors;
7.25
7.26 QPointF offset;
7.27 +
7.28 + ExportHTMLDialog dia;
7.29 };
7.30
7.31 ///////////////////////////////////////////////////////////////////////
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/findresultitem.cpp Tue Mar 02 13:59:19 2010 +0000
8.3 @@ -0,0 +1,109 @@
8.4 +#include <QStringList>
8.5 +
8.6 +#include "findresultitem.h"
8.7 +
8.8 +FindResultItem::FindResultItem(const QVector<QVariant> &data, FindResultItem *parent)
8.9 +{
8.10 + parentItem = parent;
8.11 + itemData = data;
8.12 +}
8.13 +
8.14 +FindResultItem::~FindResultItem()
8.15 +{
8.16 + qDeleteAll(childItems);
8.17 +}
8.18 +
8.19 +FindResultItem *FindResultItem::child(int number)
8.20 +{
8.21 + return childItems.value(number);
8.22 +}
8.23 +
8.24 +int FindResultItem::childCount() const
8.25 +{
8.26 + return childItems.count();
8.27 +}
8.28 +
8.29 +int FindResultItem::childNumber() const
8.30 +{
8.31 + if (parentItem)
8.32 + return parentItem->childItems.indexOf(const_cast<FindResultItem*>(this));
8.33 +
8.34 + return 0;
8.35 +}
8.36 +
8.37 +int FindResultItem::columnCount() const
8.38 +{
8.39 + return itemData.count();
8.40 +}
8.41 +
8.42 +QVariant FindResultItem::data(int column) const
8.43 +{
8.44 + return itemData.value(column);
8.45 +}
8.46 +
8.47 +bool FindResultItem::insertChildren(int position, int count, int columns)
8.48 +{
8.49 + if (position < 0 || position > childItems.size())
8.50 + return false;
8.51 +
8.52 + for (int row = 0; row < count; ++row) {
8.53 + QVector<QVariant> data(columns);
8.54 + FindResultItem *item = new FindResultItem(data, this);
8.55 + childItems.insert(position, item);
8.56 + }
8.57 +
8.58 + return true;
8.59 +}
8.60 +
8.61 +bool FindResultItem::insertColumns(int position, int columns)
8.62 +{
8.63 + if (position < 0 || position > itemData.size())
8.64 + return false;
8.65 +
8.66 + for (int column = 0; column < columns; ++column)
8.67 + itemData.insert(position, QVariant());
8.68 +
8.69 + foreach (FindResultItem *child, childItems)
8.70 + child->insertColumns(position, columns);
8.71 +
8.72 + return true;
8.73 +}
8.74 +
8.75 +FindResultItem *FindResultItem::parent()
8.76 +{
8.77 + return parentItem;
8.78 +}
8.79 +
8.80 +bool FindResultItem::removeChildren(int position, int count)
8.81 +{
8.82 + if (position < 0 || position + count > childItems.size())
8.83 + return false;
8.84 +
8.85 + for (int row = 0; row < count; ++row)
8.86 + delete childItems.takeAt(position);
8.87 +
8.88 + return true;
8.89 +}
8.90 +
8.91 +bool FindResultItem::removeColumns(int position, int columns)
8.92 +{
8.93 + if (position < 0 || position + columns > itemData.size())
8.94 + return false;
8.95 +
8.96 + for (int column = 0; column < columns; ++column)
8.97 + itemData.remove(position);
8.98 +
8.99 + foreach (FindResultItem *child, childItems)
8.100 + child->removeColumns(position, columns);
8.101 +
8.102 + return true;
8.103 +}
8.104 +
8.105 +bool FindResultItem::setData(int column, const QVariant &value)
8.106 +{
8.107 + if (column < 0 || column >= itemData.size())
8.108 + return false;
8.109 +
8.110 + itemData[column] = value;
8.111 + return true;
8.112 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/findresultitem.h Tue Mar 02 13:59:19 2010 +0000
9.3 @@ -0,0 +1,32 @@
9.4 +#ifndef FINDRESULTITEM_H
9.5 +#define FINDRESULTITEM_H
9.6 +
9.7 +#include <QList>
9.8 +#include <QVariant>
9.9 +#include <QVector>
9.10 +
9.11 +class FindResultItem
9.12 +{
9.13 +public:
9.14 + FindResultItem(const QVector<QVariant> &data, FindResultItem *parent = 0);
9.15 + ~FindResultItem();
9.16 +
9.17 + FindResultItem *child(int number);
9.18 + int childCount() const;
9.19 + int columnCount() const;
9.20 + QVariant data(int column) const;
9.21 + bool insertChildren(int position, int count, int columns);
9.22 + bool insertColumns(int position, int columns);
9.23 + FindResultItem *parent();
9.24 + bool removeChildren(int position, int count);
9.25 + bool removeColumns(int position, int columns);
9.26 + int childNumber() const;
9.27 + bool setData(int column, const QVariant &value);
9.28 +
9.29 +private:
9.30 + QList<FindResultItem*> childItems;
9.31 + QVector<QVariant> itemData;
9.32 + FindResultItem *parentItem;
9.33 +};
9.34 +
9.35 +#endif
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/findresultmodel.cpp Tue Mar 02 13:59:19 2010 +0000
10.3 @@ -0,0 +1,229 @@
10.4 +#include <QtGui>
10.5 +
10.6 +#include "findresultitem.h"
10.7 +#include "findresultmodel.h"
10.8 +
10.9 +FindResultModel::FindResultModel( QObject *parent)
10.10 + : QAbstractItemModel(parent)
10.11 +{
10.12 + QVector<QVariant> rootData;
10.13 + rootData << "Foo"<<"bar";
10.14 +
10.15 + rootItem = new FindResultItem(rootData);
10.16 + //setupModelData(data.split(QString("\n")), rootItem);
10.17 +}
10.18 +
10.19 +
10.20 +FindResultModel::~FindResultModel()
10.21 +{
10.22 + delete rootItem;
10.23 +}
10.24 +
10.25 +int FindResultModel::columnCount(const QModelIndex & /* parent */) const
10.26 +{
10.27 + return rootItem->columnCount();
10.28 +}
10.29 +
10.30 +QVariant FindResultModel::data(const QModelIndex &index, int role) const
10.31 +{
10.32 + if (!index.isValid())
10.33 + return QVariant();
10.34 +
10.35 + if (role != Qt::DisplayRole && role != Qt::EditRole)
10.36 + return QVariant();
10.37 +
10.38 + FindResultItem *item = getItem(index);
10.39 +
10.40 + return item->data(index.column());
10.41 +}
10.42 +
10.43 +Qt::ItemFlags FindResultModel::flags(const QModelIndex &index) const
10.44 +{
10.45 + if (!index.isValid())
10.46 + return 0;
10.47 +
10.48 + return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
10.49 +}
10.50 +
10.51 +FindResultItem *FindResultModel::getItem(const QModelIndex &index) const
10.52 +{
10.53 + if (index.isValid()) {
10.54 + FindResultItem *item = static_cast<FindResultItem*>(index.internalPointer());
10.55 + if (item) return item;
10.56 + }
10.57 + return rootItem;
10.58 +}
10.59 +
10.60 +QVariant FindResultModel::headerData(int section, Qt::Orientation orientation,
10.61 + int role) const
10.62 +{
10.63 + if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
10.64 + return rootItem->data(section);
10.65 +
10.66 + return QVariant();
10.67 +}
10.68 +
10.69 +QModelIndex FindResultModel::index(int row, int column, const QModelIndex &parent) const
10.70 +{
10.71 + if (parent.isValid() && parent.column() != 0)
10.72 + return QModelIndex();
10.73 +
10.74 + FindResultItem *parentItem = getItem(parent);
10.75 +
10.76 + FindResultItem *childItem = parentItem->child(row);
10.77 + if (childItem)
10.78 + return createIndex(row, column, childItem);
10.79 + else
10.80 + return QModelIndex();
10.81 +}
10.82 +
10.83 +bool FindResultModel::insertColumns(int position, int columns, const QModelIndex &parent)
10.84 +{
10.85 + bool success;
10.86 +
10.87 + beginInsertColumns(parent, position, position + columns - 1);
10.88 + success = rootItem->insertColumns(position, columns);
10.89 + endInsertColumns();
10.90 +
10.91 + return success;
10.92 +}
10.93 +
10.94 +bool FindResultModel::insertRows(int position, int rows, const QModelIndex &parent)
10.95 +{
10.96 + FindResultItem *parentItem = getItem(parent);
10.97 + bool success;
10.98 +
10.99 + beginInsertRows(parent, position, position + rows - 1);
10.100 + success = parentItem->insertChildren(position, rows, rootItem->columnCount());
10.101 + endInsertRows();
10.102 +
10.103 + return success;
10.104 +}
10.105 +
10.106 +QModelIndex FindResultModel::parent(const QModelIndex &index) const
10.107 +{
10.108 + if (!index.isValid())
10.109 + return QModelIndex();
10.110 +
10.111 + FindResultItem *childItem = getItem(index);
10.112 + FindResultItem *parentItem = childItem->parent();
10.113 +
10.114 + if (parentItem == rootItem)
10.115 + return QModelIndex();
10.116 +
10.117 + return createIndex(parentItem->childNumber(), 0, parentItem);
10.118 +}
10.119 +
10.120 +bool FindResultModel::removeColumns(int position, int columns, const QModelIndex &parent)
10.121 +{
10.122 + bool success;
10.123 +
10.124 + beginRemoveColumns(parent, position, position + columns - 1);
10.125 + success = rootItem->removeColumns(position, columns);
10.126 + endRemoveColumns();
10.127 +
10.128 + if (rootItem->columnCount() == 0)
10.129 + removeRows(0, rowCount());
10.130 +
10.131 + return success;
10.132 +}
10.133 +
10.134 +bool FindResultModel::removeRows(int position, int rows, const QModelIndex &parent)
10.135 +{
10.136 + FindResultItem *parentItem = getItem(parent);
10.137 + bool success = true;
10.138 +
10.139 + beginRemoveRows(parent, position, position + rows - 1);
10.140 + success = parentItem->removeChildren(position, rows);
10.141 + endRemoveRows();
10.142 +
10.143 + return success;
10.144 +}
10.145 +
10.146 +int FindResultModel::rowCount(const QModelIndex &parent) const
10.147 +{
10.148 + FindResultItem *parentItem = getItem(parent);
10.149 +
10.150 + return parentItem->childCount();
10.151 +}
10.152 +
10.153 +bool FindResultModel::setData(const QModelIndex &index, const QVariant &value,
10.154 + int role)
10.155 +{
10.156 + if (role != Qt::EditRole)
10.157 + return false;
10.158 +
10.159 + FindResultItem *item = getItem(index);
10.160 + bool result = item->setData(index.column(), value);
10.161 +
10.162 + if (result)
10.163 + emit dataChanged(index, index);
10.164 +
10.165 + return result;
10.166 +}
10.167 +
10.168 +bool FindResultModel::setHeaderData(int section, Qt::Orientation orientation,
10.169 + const QVariant &value, int role)
10.170 +{
10.171 + if (role != Qt::EditRole || orientation != Qt::Horizontal)
10.172 + return false;
10.173 +
10.174 + bool result = rootItem->setData(section, value);
10.175 +
10.176 + if (result)
10.177 + emit headerDataChanged(orientation, section, section);
10.178 +
10.179 + return result;
10.180 +}
10.181 +
10.182 +void FindResultModel::setupModelData(const QStringList &lines, FindResultItem *parent)
10.183 +{
10.184 + QList<FindResultItem*> parents;
10.185 + QList<int> indentations;
10.186 + parents << parent;
10.187 + indentations << 0;
10.188 +
10.189 + int number = 0;
10.190 +
10.191 + while (number < lines.count()) {
10.192 + int position = 0;
10.193 + while (position < lines[number].length()) {
10.194 + if (lines[number].mid(position, 1) != " ")
10.195 + break;
10.196 + position++;
10.197 + }
10.198 +
10.199 + QString lineData = lines[number].mid(position).trimmed();
10.200 +
10.201 + if (!lineData.isEmpty()) {
10.202 + // Read the column data from the rest of the line.
10.203 + QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts);
10.204 + QVector<QVariant> columnData;
10.205 + for (int column = 0; column < columnStrings.count(); ++column)
10.206 + columnData << columnStrings[column];
10.207 +
10.208 + if (position > indentations.last()) {
10.209 + // The last child of the current parent is now the new parent
10.210 + // unless the current parent has no children.
10.211 +
10.212 + if (parents.last()->childCount() > 0) {
10.213 + parents << parents.last()->child(parents.last()->childCount()-1);
10.214 + indentations << position;
10.215 + }
10.216 + } else {
10.217 + while (position < indentations.last() && parents.count() > 0) {
10.218 + parents.pop_back();
10.219 + indentations.pop_back();
10.220 + }
10.221 + }
10.222 +
10.223 + // Append a new item to the current parent's list of children.
10.224 + FindResultItem *parent = parents.last();
10.225 + parent->insertChildren(parent->childCount(), 1, rootItem->columnCount());
10.226 + for (int column = 0; column < columnData.size(); ++column)
10.227 + parent->child(parent->childCount() - 1)->setData(column, columnData[column]);
10.228 + }
10.229 +
10.230 + number++;
10.231 + }
10.232 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/findresultmodel.h Tue Mar 02 13:59:19 2010 +0000
11.3 @@ -0,0 +1,51 @@
11.4 +#ifndef FINDRESULTMODEL_H
11.5 +#define FINDRESULTMODEL_H
11.6 +
11.7 +#include <QAbstractItemModel>
11.8 +#include <QModelIndex>
11.9 +#include <QVariant>
11.10 +
11.11 +class FindResultItem;
11.12 +
11.13 +class FindResultModel : public QAbstractItemModel
11.14 +{
11.15 + Q_OBJECT
11.16 +
11.17 +public:
11.18 + FindResultModel( QObject *parent = 0);
11.19 + ~FindResultModel();
11.20 +
11.21 + QVariant data(const QModelIndex &index, int role) const;
11.22 + QVariant headerData(int section, Qt::Orientation orientation,
11.23 + int role = Qt::DisplayRole) const;
11.24 +
11.25 + QModelIndex index(int row, int column,
11.26 + const QModelIndex &parent = QModelIndex()) const;
11.27 + QModelIndex parent(const QModelIndex &index) const;
11.28 +
11.29 + int rowCount(const QModelIndex &parent = QModelIndex()) const;
11.30 + int columnCount(const QModelIndex &parent = QModelIndex()) const;
11.31 +
11.32 + Qt::ItemFlags flags(const QModelIndex &index) const;
11.33 + bool setData(const QModelIndex &index, const QVariant &value,
11.34 + int role = Qt::EditRole);
11.35 + bool setHeaderData(int section, Qt::Orientation orientation,
11.36 + const QVariant &value, int role = Qt::EditRole);
11.37 +
11.38 + bool insertColumns(int position, int columns,
11.39 + const QModelIndex &parent = QModelIndex());
11.40 + bool removeColumns(int position, int columns,
11.41 + const QModelIndex &parent = QModelIndex());
11.42 + bool insertRows(int position, int rows,
11.43 + const QModelIndex &parent = QModelIndex());
11.44 + bool removeRows(int position, int rows,
11.45 + const QModelIndex &parent = QModelIndex());
11.46 +
11.47 +private:
11.48 + void setupModelData(const QStringList &lines, FindResultItem *parent);
11.49 + FindResultItem *getItem(const QModelIndex &index) const;
11.50 +
11.51 + FindResultItem *rootItem;
11.52 +};
11.53 +
11.54 +#endif
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/findresultwidget.cpp Tue Mar 02 13:59:19 2010 +0000
12.3 @@ -0,0 +1,65 @@
12.4 +#include "findresultwidget.h"
12.5 +
12.6 +#include <QLineEdit>
12.7 +#include <QVBoxLayout>
12.8 +#include <QPushButton>
12.9 +#include <QTreeView>
12.10 +
12.11 +#include <QMenuBar>
12.12 +#include <QDebug>
12.13 +
12.14 +#include "findresultmodel.h"
12.15 +
12.16 +extern QString iconPath;
12.17 +
12.18 +FindResultWidget::FindResultWidget(QWidget *)
12.19 +{
12.20 + // Create model
12.21 + model=new FindResultModel;
12.22 +
12.23 + // Create TreeView
12.24 + view = new QTreeView;
12.25 + view->setModel (model);
12.26 +
12.27 + QVBoxLayout* mainLayout = new QVBoxLayout;
12.28 + QHBoxLayout *row2Layout = new QHBoxLayout;
12.29 +
12.30 + // Create Buttons
12.31 + cancelbutton = new QPushButton;
12.32 + //cancelbutton->setText(tr("Cancel"));
12.33 + cancelbutton->setIcon (QIcon (iconPath+"fileclose.png"));
12.34 + cancelbutton->setShortcut (Qt::Key_Escape);
12.35 + connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) );
12.36 +
12.37 + row2Layout->addWidget (cancelbutton);
12.38 + //row2Layout->addWidget(findcombo);
12.39 + //row2Layout->addWidget(nextbutton);
12.40 +
12.41 + QMenuBar *mb=new QMenuBar;
12.42 + QAction *a=new QAction ("Foo action",NULL);
12.43 + mb->addAction (a);
12.44 + mb->insertSeparator();
12.45 + mainLayout->addWidget(mb);
12.46 + mainLayout->addWidget(view);
12.47 + mainLayout->addLayout (row2Layout);
12.48 +
12.49 + setLayout (mainLayout);
12.50 +}
12.51 +
12.52 +void FindResultWidget::popup()
12.53 +{
12.54 + show();
12.55 +}
12.56 +
12.57 +void FindResultWidget::cancelPressed()
12.58 +{
12.59 + emit (hideFindResultWidget() );
12.60 +}
12.61 +
12.62 +#include <QHideEvent>
12.63 +void FindResultWidget::hideEvent(QHideEvent *event) //FIXME-2 testing only
12.64 +{
12.65 + qDebug()<<"FRW::hideEvent()";
12.66 + event->ignore();
12.67 +}
12.68 +
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/findresultwidget.h Tue Mar 02 13:59:19 2010 +0000
13.3 @@ -0,0 +1,35 @@
13.4 +#ifndef FINDRESULTWIDGET_H
13.5 +#define FINDRESULTWIDGET_H
13.6 +
13.7 +#include <QWidget>
13.8 +
13.9 +class QTreeView;
13.10 +class QPushButton;
13.11 +class FindResultModel;
13.12 +
13.13 +class FindResultWidget: public QWidget
13.14 +{
13.15 + Q_OBJECT
13.16 +
13.17 +public:
13.18 + FindResultWidget (QWidget *parent=NULL);
13.19 +
13.20 +public slots:
13.21 + void popup();
13.22 + void cancelPressed();
13.23 +
13.24 +protected:
13.25 + virtual void hideEvent (QHideEvent *event);
13.26 +
13.27 +
13.28 +signals:
13.29 + void hideFindResultWidget();
13.30 +
13.31 +private:
13.32 + FindResultModel *model;
13.33 + QTreeView *view;
13.34 + QPushButton *cancelbutton;
13.35 +};
13.36 +
13.37 +#endif
13.38 +
14.1 --- a/findwidget.cpp Thu Feb 25 11:03:52 2010 +0000
14.2 +++ b/findwidget.cpp Tue Mar 02 13:59:19 2010 +0000
14.3 @@ -2,10 +2,15 @@
14.4 #include <QVBoxLayout>
14.5 #include <QLabel>
14.6
14.7 +#include <QComboBox>
14.8 +#include <QPushButton>
14.9 +#include <QGroupBox>
14.10 +#include <QLabel>
14.11 +
14.12 +
14.13 #include "findwidget.h"
14.14
14.15
14.16 -extern QString vymName;
14.17 extern QString iconPath;
14.18
14.19 FindWidget::FindWidget(QWidget *)
15.1 --- a/findwidget.h Thu Feb 25 11:03:52 2010 +0000
15.2 +++ b/findwidget.h Tue Mar 02 13:59:19 2010 +0000
15.3 @@ -1,12 +1,11 @@
15.4 #ifndef FINDWIDGET_H
15.5 #define FINDWIDGET_H
15.6
15.7 -#include <QComboBox>
15.8 -#include <QPushButton>
15.9 -#include <QGroupBox>
15.10 -#include <QLayout>
15.11 -#include <QLabel>
15.12 +#include <QWidget>
15.13
15.14 +class QGroupBox;
15.15 +class QComboBox;
15.16 +class QPushButton;
15.17
15.18 class FindWidget: public QWidget
15.19 {
16.1 --- a/mainwindow.cpp Thu Feb 25 11:03:52 2010 +0000
16.2 +++ b/mainwindow.cpp Tue Mar 02 13:59:19 2010 +0000
16.3 @@ -11,6 +11,7 @@
16.4 #include "exportoofiledialog.h"
16.5 #include "exports.h"
16.6 #include "file.h"
16.7 +#include "findresultwidget.h"
16.8 #include "flagrow.h"
16.9 #include "historywindow.h"
16.10 #include "imports.h"
16.11 @@ -126,6 +127,14 @@
16.12 browserPID=new qint64;
16.13 *browserPID=0;
16.14
16.15 + // Dock widgets //FIXME-2 testing...
16.16 +
16.17 + FindResultWidget *findResultWidget=new FindResultWidget;
16.18 + QDockWidget *dw= new QDockWidget ("Dock Widget",this);
16.19 + dw->setWidget (findResultWidget);
16.20 + dw->hide();
16.21 + addDockWidget (Qt::RightDockWidgetArea,dw);
16.22 +
16.23 // Satellite windows //////////////////////////////////////////
16.24 // history window
16.25 historyWindow=new HistoryWindow();
16.26 @@ -1073,7 +1082,7 @@
16.27
16.28 a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this);
16.29 a->setStatusTip ( tr( "Color branch" ) );
16.30 - a->setShortcut (Qt::CTRL + Qt::Key_B);
16.31 + a->setShortcut (Qt::CTRL + Qt::Key_B + Qt::SHIFT);
16.32 connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
16.33 a->setEnabled (false);
16.34 a->addTo( tb );
16.35 @@ -1083,7 +1092,7 @@
16.36
16.37 a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this);
16.38 a->setStatusTip ( tr( "Color Subtree" ));
16.39 - //FIXME-2 switch back to that a->setShortcut (Qt::CTRL + Qt::Key_T); // Color subtree
16.40 + a->setShortcut (Qt::CTRL + Qt::Key_B); // Color subtree
16.41 connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) );
16.42 a->setEnabled (false);
16.43 formatMenu->addAction (a);
17.1 --- a/process.cpp Thu Feb 25 11:03:52 2010 +0000
17.2 +++ b/process.cpp Tue Mar 02 13:59:19 2010 +0000
17.3 @@ -1,5 +1,10 @@
17.4 #include "process.h"
17.5
17.6 +#include <QMessageBox>
17.7 +#include <QDebug>
17.8 +
17.9 +extern bool debug;
17.10 +
17.11 /////////////////////////////////////////////////////////////////
17.12 // Process
17.13 /////////////////////////////////////////////////////////////////
17.14 @@ -22,6 +27,40 @@
17.15 stdOut="";
17.16 }
17.17
17.18 +void Process::runScript(QString spath, QString fpath)
17.19 +{
17.20 + spath.replace ("%f",fpath);
17.21 + QStringList args=QStringList::split (' ',spath,false);
17.22 + spath=args.takeFirst();
17.23 +
17.24 + if (debug)
17.25 + qDebug()<<"Process::runScript : " + spath+" "+args.join(" ");
17.26 +
17.27 + start (spath,args);
17.28 + if (!waitForStarted() )
17.29 + {
17.30 + QMessageBox::critical( 0, tr( "Critical Error" ),
17.31 + tr("Could not start %1").arg(spath) );
17.32 + } else
17.33 + {
17.34 + if (!waitForFinished())
17.35 + QMessageBox::critical( 0, tr( "Critical Error" ),
17.36 + tr("%1 didn't exit normally").arg(spath) +
17.37 + getErrout() );
17.38 + // else
17.39 + // if (exitStatus()>0) showOutput=true;
17.40 +
17.41 + }
17.42 + /* FIXME-3 output for Process::runScript
17.43 + qDebug()<<readAllStandardOutput();
17.44 + qDebug()<<getStdout();
17.45 + qDebug()<<getErrout();
17.46 + addOutput ("\n");
17.47 + addOutput (getErrout());
17.48 + addOutput (getStdout());
17.49 + */
17.50 +}
17.51 +
17.52 void Process::readProcErrout()
17.53 {
17.54 errOut+=readAllStandardError();
18.1 --- a/process.h Thu Feb 25 11:03:52 2010 +0000
18.2 +++ b/process.h Tue Mar 02 13:59:19 2010 +0000
18.3 @@ -4,9 +4,6 @@
18.4 #include <QProcess>
18.5 #include <QString>
18.6
18.7 -
18.8 -using namespace std;
18.9 -
18.10 class Process:public QProcess
18.11 {
18.12 Q_OBJECT
18.13 @@ -14,9 +11,9 @@
18.14 Process ();
18.15 ~Process ();
18.16 void clear();
18.17 + void runScript( QString spath, QString fpath );
18.18 QString getErrout();
18.19 QString getStdout();
18.20 -
18.21
18.22 public slots:
18.23 virtual void readProcErrout();
19.1 --- a/settings.cpp Thu Feb 25 11:03:52 2010 +0000
19.2 +++ b/settings.cpp Tue Mar 02 13:59:19 2010 +0000
19.3 @@ -258,7 +258,7 @@
19.4 "setting",
19.5 attribut ("key",*itk)
19.6 +attribut ("value",*itv)
19.7 - )+"\n";
19.8 + );
19.9 itp++;
19.10 itk++;
19.11 itv++;
20.1 --- a/texteditor.cpp Thu Feb 25 11:03:52 2010 +0000
20.2 +++ b/texteditor.cpp Tue Mar 02 13:59:19 2010 +0000
20.3 @@ -1,6 +1,5 @@
20.4 #include "texteditor.h"
20.5
20.6 -#include <iostream>
20.7 #include <cstdlib>
20.8 #include <typeinfo>
20.9
20.10 @@ -17,8 +16,6 @@
20.11
20.12 extern bool debug;
20.13
20.14 -using namespace std;
20.15 -
20.16
20.17 ///////////////////////////////////////////////////////////////////////
20.18 ///////////////////////////////////////////////////////////////////////
21.1 --- a/treeeditor.cpp Thu Feb 25 11:03:52 2010 +0000
21.2 +++ b/treeeditor.cpp Tue Mar 02 13:59:19 2010 +0000
21.3 @@ -3,9 +3,6 @@
21.4 #include <QAction>
21.5 #include <QRegExp>
21.6
21.7 -#include <iostream>
21.8 -using namespace std;
21.9 -
21.10 #include "vymmodel.h"
21.11
21.12 ///////////////////////////////////////////////////////////////////////
21.13 @@ -14,7 +11,7 @@
21.14 {
21.15 model=m;
21.16
21.17 - // FIXME-2 use proxmodel
21.18 + // FIXME-3 use proxmodel
21.19 //proxyModel = new MySortFilterProxyModel(this);
21.20 //setModel(proxyModel);
21.21 setModel(m);
22.1 --- a/treemodel.cpp Thu Feb 25 11:03:52 2010 +0000
22.2 +++ b/treemodel.cpp Tue Mar 02 13:59:19 2010 +0000
22.3 @@ -1,8 +1,5 @@
22.4 #include <QtGui>
22.5
22.6 -#include <iostream>
22.7 -using namespace std;
22.8 -
22.9 #include "attributeitem.h"
22.10 #include "branchitem.h"
22.11 #include "imageitem.h"
23.1 --- a/version.h Thu Feb 25 11:03:52 2010 +0000
23.2 +++ b/version.h Tue Mar 02 13:59:19 2010 +0000
23.3 @@ -7,7 +7,7 @@
23.4 #define __VYM_VERSION "1.13.0"
23.5 //#define __VYM_CODENAME "Codename: RC-1"
23.6 #define __VYM_CODENAME "Codename: development version, not for production!"
23.7 -#define __VYM_BUILD_DATE "2010-02-22"
23.8 +#define __VYM_BUILD_DATE "2010-02-26"
23.9
23.10
23.11 bool checkVersion(const QString &);
24.1 --- a/vym.pro Thu Feb 25 11:03:52 2010 +0000
24.2 +++ b/vym.pro Tue Mar 02 13:59:19 2010 +0000
24.3 @@ -51,6 +51,9 @@
24.4 extrainfodialog.h \
24.5 file.h \
24.6 findwidget.h \
24.7 + findresultwidget.h \
24.8 + findresultitem.h \
24.9 + findresultmodel.h \
24.10 flag.h \
24.11 flagobj.h \
24.12 flagrowobj.h \
24.13 @@ -118,6 +121,9 @@
24.14 extrainfodialog.cpp \
24.15 file.cpp \
24.16 findwidget.cpp \
24.17 + findresultwidget.cpp \
24.18 + findresultitem.cpp \
24.19 + findresultmodel.cpp \
24.20 flag.cpp \
24.21 flagobj.cpp \
24.22 flagrow.cpp \
25.1 --- a/vymmodel.cpp Thu Feb 25 11:03:52 2010 +0000
25.2 +++ b/vymmodel.cpp Tue Mar 02 13:59:19 2010 +0000
25.3 @@ -4258,14 +4258,21 @@
25.4 }
25.5 }
25.6
25.7 -void VymModel::exportHTML (const QString &dir, bool askForName) //FIXME-2 own dialogue missing and also option to save settings in map
25.8 -{
25.9 - ExportHTMLDialog dia(NULL);
25.10 +void VymModel::exportHTML (const QString &dir, bool useDialog)
25.11 +{
25.12 + ExportHTML ex (this);
25.13 + ex.setDir (dir);
25.14 + ex.doExport(useDialog);
25.15 +}
25.16 +
25.17 +void VymModel::exportXHTML (const QString &dir, bool askForName)
25.18 +{
25.19 + ExportXHTMLDialog dia(NULL);
25.20 dia.setFilePath (filePath );
25.21 dia.setMapName (mapName );
25.22 dia.readSettings();
25.23 if (dir!="") dia.setDir (dir);
25.24 - QDir d;
25.25 +
25.26 bool ok=true;
25.27
25.28 if (askForName)
25.29 @@ -4274,7 +4281,7 @@
25.30 ok=false;
25.31 else
25.32 {
25.33 - d=dia.getDir();
25.34 + QDir d (dia.getDir());
25.35 // Check, if warnings should be used before overwriting
25.36 // the output directory
25.37 if (d.exists() && d.count()>0)
25.38 @@ -4285,75 +4292,21 @@
25.39 "The directory %1 is not empty.\n"
25.40 "Do you risk to overwrite some of its contents?").arg(d.path() ));
25.41 warn.setCaption("Warning: Directory not empty");
25.42 - warn.setShowAgainName("mainwindow/export-XML-overwrite-dir");
25.43 + warn.setShowAgainName("mainwindow/overwrite-dir-xhtml");
25.44
25.45 if (warn.exec()!=QDialog::Accepted) ok=false;
25.46 }
25.47 }
25.48 }
25.49 +
25.50 if (ok)
25.51 {
25.52 - // Hide stuff during export, if settings want this
25.53 - setExportMode (true);
25.54 -
25.55 - ExportHTML ex (this);
25.56 - ex.setFile (d.path()+"/"+mapName+".html");
25.57 - //qDebug()<< "VM::exportHTML writing "<<ex.getFile();
25.58 - ex.setCSSPath(dia.getCSSPath() );
25.59 - ex.doExport();
25.60 - setExportMode (false);
25.61 -
25.62 - //dia.doExport(mapName );
25.63 + exportXML (dia.getDir(),false );
25.64 + dia.doExport(mapName );
25.65 //if (dia.hasChanged()) setChanged();
25.66 -
25.67 - // Write image, too
25.68 - exportImage (d.path()+"/"+mapName+".png",false,"PNG");
25.69 -
25.70 }
25.71 }
25.72
25.73 -void VymModel::exportXHTML (const QString &dir, bool askForName)
25.74 -{
25.75 - ExportXHTMLDialog dia(NULL);
25.76 - dia.setFilePath (filePath );
25.77 - dia.setMapName (mapName );
25.78 - dia.readSettings();
25.79 - if (dir!="") dia.setDir (dir);
25.80 -
25.81 - bool ok=true;
25.82 -
25.83 - if (askForName)
25.84 - {
25.85 - if (dia.exec()!=QDialog::Accepted)
25.86 - ok=false;
25.87 - else
25.88 - {
25.89 - QDir d (dia.getDir());
25.90 - // Check, if warnings should be used before overwriting
25.91 - // the output directory
25.92 - if (d.exists() && d.count()>0)
25.93 - {
25.94 - WarningDialog warn;
25.95 - warn.showCancelButton (true);
25.96 - warn.setText(QString(
25.97 - "The directory %1 is not empty.\n"
25.98 - "Do you risk to overwrite some of its contents?").arg(d.path() ));
25.99 - warn.setCaption("Warning: Directory not empty");
25.100 - warn.setShowAgainName("mainwindow/overwrite-dir-xhtml");
25.101 -
25.102 - if (warn.exec()!=QDialog::Accepted) ok=false;
25.103 - }
25.104 - }
25.105 - }
25.106 -
25.107 - if (ok)
25.108 - {
25.109 - exportXML (dia.getDir(),false );
25.110 - dia.doExport(mapName );
25.111 - //if (dia.hasChanged()) setChanged();
25.112 - }
25.113 -}
25.114 -
25.115 void VymModel::exportOOPresentation(const QString &fn, const QString &cf)
25.116 {
25.117 ExportOO ex;
25.118 @@ -4695,7 +4648,7 @@
25.119 }
25.120
25.121
25.122 -void VymModel::animate() //FIXME-2 animation causes flicker after cut/undo cut ?!?
25.123 +void VymModel::animate()
25.124 {
25.125 animationTimer->stop();
25.126 BranchObj *bo;
25.127 @@ -4724,7 +4677,6 @@
25.128
25.129 void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest)
25.130 {
25.131 - qDebug()<<"Start animation for "<<bo->getTreeItem()<<getHeading();
25.132 if (start==dest) return;
25.133 if (bo && bo->getTreeItem()->depth()>0)
25.134 {
26.1 --- a/vymmodel.h Thu Feb 25 11:03:52 2010 +0000
26.2 +++ b/vymmodel.h Tue Mar 02 13:59:19 2010 +0000
26.3 @@ -447,7 +447,7 @@
26.4 void exportASCII (QString fname="",bool askForName=true);
26.5
26.6 /*! Export as HTML to directory */
26.7 - void exportHTML(const QString& dir="", bool askForName=true);
26.8 + void exportHTML(const QString& dir="", bool useDialog=true);
26.9 void exportXHTML(const QString& dir="", bool askForName=true);
26.10
26.11 /*! Export as OpenOfficeOrg presentation */
27.1 --- a/vymview.cpp Thu Feb 25 11:03:52 2010 +0000
27.2 +++ b/vymview.cpp Tue Mar 02 13:59:19 2010 +0000
27.3 @@ -1,8 +1,5 @@
27.4 #include "vymview.h"
27.5
27.6 -#include <iostream>
27.7 -using namespace std;
27.8 -
27.9 #include "branchitem.h"
27.10 #include "findwidget.h"
27.11 #include "mainwindow.h"
28.1 --- a/xlinkitem.cpp Thu Feb 25 11:03:52 2010 +0000
28.2 +++ b/xlinkitem.cpp Tue Mar 02 13:59:19 2010 +0000
28.3 @@ -6,9 +6,6 @@
28.4 #include "vymmodel.h"
28.5 #include "xlinkobj.h"
28.6
28.7 -#include <iostream>
28.8 -using namespace std;
28.9 -
28.10 /////////////////////////////////////////////////////////////////
28.11 // XLinkItem
28.12 /////////////////////////////////////////////////////////////////
28.13 @@ -22,12 +19,16 @@
28.14
28.15 XLinkItem::~XLinkItem ()
28.16 {
28.17 - cout << "Destr XLinkItem "<<this<<" lmo="<<lmo<<endl;
28.18 - if (lmo){cout <<" calling delete\n"; delete (lmo);}
28.19 + //cout << "Destr XLinkItem "<<this<<" lmo="<<lmo<<endl;
28.20 + if (lmo)
28.21 + {
28.22 + //cout <<" calling delete (lmo)\n";
28.23 + delete (lmo);
28.24 + }
28.25 if (partnerXLink)
28.26 {
28.27 // Also delete partner
28.28 - cout << " deleting partner="<<partnerXLink<<endl;
28.29 + //cout << " deleting partner="<<partnerXLink<<endl;
28.30 partnerXLink->partnerXLink=NULL; // avoid endless recusion
28.31 model->deleteItem (partnerXLink);
28.32 }
29.1 --- a/xsltproc.cpp Thu Feb 25 11:03:52 2010 +0000
29.2 +++ b/xsltproc.cpp Tue Mar 02 13:59:19 2010 +0000
29.3 @@ -1,6 +1,8 @@
29.4 #include "xsltproc.h"
29.5
29.6 #include <iostream>
29.7 +using namespace std;
29.8 +
29.9 #include <qmessagebox.h>
29.10
29.11 #include "process.h"