# HG changeset patch # User insilmaril # Date 1267538359 0 # Node ID 1ad892c1a70938d6e59a3b839a1528d45b4b4755 # Parent 36eb4b8f409e9198d02f6fef7ca4397855b53d2e Added file for later dockwidget showing all search results at once diff -r 36eb4b8f409e -r 1ad892c1a709 branchitem.cpp --- a/branchitem.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/branchitem.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -166,7 +166,7 @@ ol=cl; } else { - qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading())); + qWarning (QString("BranchItem::saveToDir Ignoring of duplicate xLink in %1").arg(getHeading())); } } diff -r 36eb4b8f409e -r 1ad892c1a709 bugagent.cpp --- a/bugagent.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/bugagent.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -30,29 +30,11 @@ qWarning()<<"BugAgent::getBugzillaData couldn't start "<setText(css); - prescript=settings.readLocalEntry - (filepath,"/export/html/prescript",""); - ui.lineEditPreScript->setText (prescript); - postscript=settings.readLocalEntry (filepath,"/export/html/postscript",""); ui.lineEditPostScript->setText (postscript); - if (!prescript.isEmpty() || !postscript.isEmpty()) + if (!postscript.isEmpty()) { QMessageBox::warning( 0, tr( "Warning" ),tr( "The settings saved in the map " - "would like to run scripts:\n\n" + "would like to run script:\n\n" "%1\n\n" "Please check, if you really\n" - "want to allow this in your system!").arg(prescript+" "+postscript)); + "want to allow this in your system!").arg(postscript)); } } @@ -195,35 +188,12 @@ } } -void ExportHTMLDialog::prescriptChanged() -{ - prescript=ui.lineEditPreScript->text(); - settingsChanged=true; -} - void ExportHTMLDialog::postscriptChanged() { postscript=ui.lineEditPostScript->text(); settingsChanged=true; } -void ExportHTMLDialog::browsePreExportButtonPressed() -{ - QFileDialog fd( this); - fd.setModal (true); - fd.setFilter ("Scripts (*.sh *.pl *.py *.php)"); - fd.setDirectory (QDir::current()); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - prescript=fd.selectedFile(); - ui.lineEditPreScript->setText (prescript ); - settingsChanged=true; - } - -} - void ExportHTMLDialog::browsePostExportButtonPressed() { QFileDialog fd( this); @@ -241,14 +211,13 @@ } -void ExportHTMLDialog::doExport (const QString &mapname) +void ExportHTMLDialog::saveSettings () { // Save options to settings file // (but don't save at destructor, which // is called for "cancel", too) settings.setLocalEntry (filepath,"/export/html/exportDir",dir); - settings.setLocalEntry (filepath,"/export/html/prescript",prescript); settings.setLocalEntry (filepath,"/export/html/postscript",postscript); if (useImage) @@ -285,7 +254,7 @@ settings.setLocalEntry (filepath,"/export/html/saveSettingsInMap","yes"); - // Provide a smaller URL-icon to improve Layout //FIXME-1 + // Provide a smaller URL-icon to improve Layout //FIXME-1 add option to choose this QPixmap pm; if (!pm.load(ipath,"PNG") ) QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath)); @@ -294,22 +263,6 @@ if(!pm.save (dir + "flags/flag-url-16x16.png","PNG")) QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath)); - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml"); - - /* FIXME-1 - if (useImage) - p.addStringParam ("imagemap","images/"+mapname+".png"); - if (useTextColor) - p.addStringParam ("use.textcolor","1"); - p.addStringParam ("mapname",mapname+".vym"); - - p.setOutputFile (dir+mapname+".html"); - p.setInputFile (dir+mapname+".xml"); - p.process(); - */ - - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html"); - } void ExportHTMLDialog::setFilePath(const QString &s) @@ -338,31 +291,3 @@ } -void ExportHTMLDialog::runScript(QString spath, QString fpath) -{ - spath.replace ("%f",fpath); - QStringList args=QStringList::split (' ',spath,false); - - //FIXME-1 p.addOutput ("vym is executing: \n" + spath+" "+args.join(" ") ); - scriptProc->start (spath,args); - if (!scriptProc->waitForStarted() ) - { - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Could not start %1").arg(spath) ); - } else - { - if (!scriptProc->waitForFinished()) - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("%1 didn't exit normally").arg(spath) + - scriptProc->getErrout() ); - else - if (scriptProc->exitStatus()>0) showOutput=true; - - } - /* FIXME-1 - p.addOutput ("\n"); - p.addOutput (scriptProc->getErrout()); - p.addOutput (scriptProc->getStdout()); - */ -} - diff -r 36eb4b8f409e -r 1ad892c1a709 exporthtmldialog.h --- a/exporthtmldialog.h Thu Feb 25 11:03:52 2010 +0000 +++ b/exporthtmldialog.h Tue Mar 02 13:59:19 2010 +0000 @@ -32,34 +32,30 @@ virtual void cssChanged(); virtual QString getCSSPath(); virtual void browseCSSPressed(); - virtual void prescriptChanged(); virtual void postscriptChanged(); - virtual void browsePreExportButtonPressed(); virtual void browsePostExportButtonPressed(); - virtual void doExport( const QString & mapname ); + virtual void saveSettings (); virtual void setFilePath( const QString & s ); virtual void setMapName( const QString & s ); +public: + bool useImage; + bool useTextColor; + QString postscript; + protected: - bool useTextColor; bool showWarnings; QString css; - bool useImage; bool showOutput; QString dir; QString filepath; - QString prescript; - QString postscript; bool settingsChanged; QString mapname; bool saveSettingsInMap; - Process *scriptProc; private: Ui::ExportHTMLDialog ui; void init(); - void destroy(); - void runScript( QString spath, QString fpath ); }; diff -r 36eb4b8f409e -r 1ad892c1a709 exporthtmldialog.ui --- a/exporthtmldialog.ui Thu Feb 25 11:03:52 2010 +0000 +++ b/exporthtmldialog.ui Tue Mar 02 13:59:19 2010 +0000 @@ -6,8 +6,8 @@ 0 0 - 684 - 471 + 681 + 434 @@ -89,7 +89,7 @@ Options - + 20 @@ -257,54 +257,6 @@ 0 - - - - 0 - 0 - - - - - 125 - 0 - - - - Before export: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 0 - 0 - - - - Browse - - - - - - - - - 6 - - - 0 - - diff -r 36eb4b8f409e -r 1ad892c1a709 exports.cpp --- a/exports.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/exports.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -484,7 +484,6 @@ singularDelimiter=": "; noSingulars=true; frameURLs=true; - useMapColors=true; cssFileName="vym.css"; cssOriginalPath=""; // Is set in VymModel, based on default setting in ExportHTMLDialog @@ -506,7 +505,7 @@ } QString col; QString id=model->getSelectString(current); - if (useMapColors) + if (dia.useTextColor) col=QString("style='color:%1'").arg(current->getHeadingColor().name()); QString s=QString("") .arg(current->depth()) @@ -531,7 +530,7 @@ s+=quotemeta(current->getHeading()); s+=""; - if (vis) + if (vis && dia.useImage) imageMap+=QString(" \n") .arg(hr.left()-offset.x()) .arg(hr.top()-offset.y()) @@ -595,9 +594,39 @@ cssOriginalPath=p; } -void ExportHTML::doExport() +void ExportHTML::doExport(bool useDialog) { - //FIXME-1 check for errors// Copy CSS file + // Execute dialog + dia.setFilePath (model->getFilePath()); + dia.setMapName (model->getMapName()); + dia.readSettings(); + if (useDialog && dia.exec()!=QDialog::Accepted) return; + + // Check if destination is not empty + QDir d=dia.getDir(); + // Check, if warnings should be used before overwriting + // the output directory + if (d.exists() && d.count()>0) + { + WarningDialog warn; + warn.showCancelButton (true); + warn.setText(QString( + "The directory %1 is not empty.\n" + "Do you risk to overwrite some of its contents?").arg(d.path() )); + warn.setCaption("Warning: Directory not empty"); + warn.setShowAgainName("mainwindow/export-XML-overwrite-dir"); + + if (warn.exec()!=QDialog::Accepted) + { + mainWindow->statusMessage(QString(QObject::tr("Export aborted."))); + return; + } + } + + setFile (d.path()+"/"+model->getMapName()+".html"); + setCSSPath( dia.getCSSPath() ); + + // Copy CSS file QFile css_src (cssOriginalPath); QFile css_dst (outDir.path()+"/"+cssFileName); if (!css_src.open ( QIODevice::ReadOnly)) @@ -631,13 +660,19 @@ QTextStream ts( &file ); // use LANG decoding here... ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8 + // Hide stuff during export + model->setExportMode (true); + // Write header ts<<""+model->getMapName()<<""; ts<<" \n"; // Include image - ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; - + if (dia.useImage) + { + ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; + model->exportImage (d.path()+"/"+model->getMapName()+".png",false,"PNG"); + } // Main loop over all mapcenters QString s; @@ -667,6 +702,16 @@ \n"; ts<<""; file.close(); + + if (!dia.postscript.isEmpty()) + { + Process p; + p.runScript (dia.postscript,d.path()+"/"+model->getMapName()+".html"); + } + + + dia.saveSettings(); + model->setExportMode (true); } //////////////////////////////////////////////////////////////////////// diff -r 36eb4b8f409e -r 1ad892c1a709 exports.h --- a/exports.h Thu Feb 25 11:03:52 2010 +0000 +++ b/exports.h Tue Mar 02 13:59:19 2010 +0000 @@ -93,6 +93,7 @@ virtual void doExport(); }; +#include "exporthtmldialog.h" /////////////////////////////////////////////////////////////////////// class ExportHTML:public ExportBase { @@ -101,7 +102,7 @@ ExportHTML(VymModel *m); virtual void init(); virtual void setCSSPath(const QString &path); - virtual void doExport(); + virtual void doExport(bool useDialog=true); private: QString getBranchText(BranchItem *); QString buildList (BranchItem *); @@ -112,9 +113,10 @@ bool frameURLs; bool noSingulars; QString singularDelimiter; - bool useMapColors; QPointF offset; + + ExportHTMLDialog dia; }; /////////////////////////////////////////////////////////////////////// diff -r 36eb4b8f409e -r 1ad892c1a709 findresultitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultitem.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,109 @@ +#include + +#include "findresultitem.h" + +FindResultItem::FindResultItem(const QVector &data, FindResultItem *parent) +{ + parentItem = parent; + itemData = data; +} + +FindResultItem::~FindResultItem() +{ + qDeleteAll(childItems); +} + +FindResultItem *FindResultItem::child(int number) +{ + return childItems.value(number); +} + +int FindResultItem::childCount() const +{ + return childItems.count(); +} + +int FindResultItem::childNumber() const +{ + if (parentItem) + return parentItem->childItems.indexOf(const_cast(this)); + + return 0; +} + +int FindResultItem::columnCount() const +{ + return itemData.count(); +} + +QVariant FindResultItem::data(int column) const +{ + return itemData.value(column); +} + +bool FindResultItem::insertChildren(int position, int count, int columns) +{ + if (position < 0 || position > childItems.size()) + return false; + + for (int row = 0; row < count; ++row) { + QVector data(columns); + FindResultItem *item = new FindResultItem(data, this); + childItems.insert(position, item); + } + + return true; +} + +bool FindResultItem::insertColumns(int position, int columns) +{ + if (position < 0 || position > itemData.size()) + return false; + + for (int column = 0; column < columns; ++column) + itemData.insert(position, QVariant()); + + foreach (FindResultItem *child, childItems) + child->insertColumns(position, columns); + + return true; +} + +FindResultItem *FindResultItem::parent() +{ + return parentItem; +} + +bool FindResultItem::removeChildren(int position, int count) +{ + if (position < 0 || position + count > childItems.size()) + return false; + + for (int row = 0; row < count; ++row) + delete childItems.takeAt(position); + + return true; +} + +bool FindResultItem::removeColumns(int position, int columns) +{ + if (position < 0 || position + columns > itemData.size()) + return false; + + for (int column = 0; column < columns; ++column) + itemData.remove(position); + + foreach (FindResultItem *child, childItems) + child->removeColumns(position, columns); + + return true; +} + +bool FindResultItem::setData(int column, const QVariant &value) +{ + if (column < 0 || column >= itemData.size()) + return false; + + itemData[column] = value; + return true; +} diff -r 36eb4b8f409e -r 1ad892c1a709 findresultitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultitem.h Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,32 @@ +#ifndef FINDRESULTITEM_H +#define FINDRESULTITEM_H + +#include +#include +#include + +class FindResultItem +{ +public: + FindResultItem(const QVector &data, FindResultItem *parent = 0); + ~FindResultItem(); + + FindResultItem *child(int number); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + bool insertChildren(int position, int count, int columns); + bool insertColumns(int position, int columns); + FindResultItem *parent(); + bool removeChildren(int position, int count); + bool removeColumns(int position, int columns); + int childNumber() const; + bool setData(int column, const QVariant &value); + +private: + QList childItems; + QVector itemData; + FindResultItem *parentItem; +}; + +#endif diff -r 36eb4b8f409e -r 1ad892c1a709 findresultmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultmodel.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,229 @@ +#include + +#include "findresultitem.h" +#include "findresultmodel.h" + +FindResultModel::FindResultModel( QObject *parent) + : QAbstractItemModel(parent) +{ + QVector rootData; + rootData << "Foo"<<"bar"; + + rootItem = new FindResultItem(rootData); + //setupModelData(data.split(QString("\n")), rootItem); +} + + +FindResultModel::~FindResultModel() +{ + delete rootItem; +} + +int FindResultModel::columnCount(const QModelIndex & /* parent */) const +{ + return rootItem->columnCount(); +} + +QVariant FindResultModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole && role != Qt::EditRole) + return QVariant(); + + FindResultItem *item = getItem(index); + + return item->data(index.column()); +} + +Qt::ItemFlags FindResultModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return 0; + + return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; +} + +FindResultItem *FindResultModel::getItem(const QModelIndex &index) const +{ + if (index.isValid()) { + FindResultItem *item = static_cast(index.internalPointer()); + if (item) return item; + } + return rootItem; +} + +QVariant FindResultModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) + return rootItem->data(section); + + return QVariant(); +} + +QModelIndex FindResultModel::index(int row, int column, const QModelIndex &parent) const +{ + if (parent.isValid() && parent.column() != 0) + return QModelIndex(); + + FindResultItem *parentItem = getItem(parent); + + FindResultItem *childItem = parentItem->child(row); + if (childItem) + return createIndex(row, column, childItem); + else + return QModelIndex(); +} + +bool FindResultModel::insertColumns(int position, int columns, const QModelIndex &parent) +{ + bool success; + + beginInsertColumns(parent, position, position + columns - 1); + success = rootItem->insertColumns(position, columns); + endInsertColumns(); + + return success; +} + +bool FindResultModel::insertRows(int position, int rows, const QModelIndex &parent) +{ + FindResultItem *parentItem = getItem(parent); + bool success; + + beginInsertRows(parent, position, position + rows - 1); + success = parentItem->insertChildren(position, rows, rootItem->columnCount()); + endInsertRows(); + + return success; +} + +QModelIndex FindResultModel::parent(const QModelIndex &index) const +{ + if (!index.isValid()) + return QModelIndex(); + + FindResultItem *childItem = getItem(index); + FindResultItem *parentItem = childItem->parent(); + + if (parentItem == rootItem) + return QModelIndex(); + + return createIndex(parentItem->childNumber(), 0, parentItem); +} + +bool FindResultModel::removeColumns(int position, int columns, const QModelIndex &parent) +{ + bool success; + + beginRemoveColumns(parent, position, position + columns - 1); + success = rootItem->removeColumns(position, columns); + endRemoveColumns(); + + if (rootItem->columnCount() == 0) + removeRows(0, rowCount()); + + return success; +} + +bool FindResultModel::removeRows(int position, int rows, const QModelIndex &parent) +{ + FindResultItem *parentItem = getItem(parent); + bool success = true; + + beginRemoveRows(parent, position, position + rows - 1); + success = parentItem->removeChildren(position, rows); + endRemoveRows(); + + return success; +} + +int FindResultModel::rowCount(const QModelIndex &parent) const +{ + FindResultItem *parentItem = getItem(parent); + + return parentItem->childCount(); +} + +bool FindResultModel::setData(const QModelIndex &index, const QVariant &value, + int role) +{ + if (role != Qt::EditRole) + return false; + + FindResultItem *item = getItem(index); + bool result = item->setData(index.column(), value); + + if (result) + emit dataChanged(index, index); + + return result; +} + +bool FindResultModel::setHeaderData(int section, Qt::Orientation orientation, + const QVariant &value, int role) +{ + if (role != Qt::EditRole || orientation != Qt::Horizontal) + return false; + + bool result = rootItem->setData(section, value); + + if (result) + emit headerDataChanged(orientation, section, section); + + return result; +} + +void FindResultModel::setupModelData(const QStringList &lines, FindResultItem *parent) +{ + QList parents; + QList indentations; + parents << parent; + indentations << 0; + + int number = 0; + + while (number < lines.count()) { + int position = 0; + while (position < lines[number].length()) { + if (lines[number].mid(position, 1) != " ") + break; + position++; + } + + QString lineData = lines[number].mid(position).trimmed(); + + if (!lineData.isEmpty()) { + // Read the column data from the rest of the line. + QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts); + QVector columnData; + for (int column = 0; column < columnStrings.count(); ++column) + columnData << columnStrings[column]; + + if (position > indentations.last()) { + // The last child of the current parent is now the new parent + // unless the current parent has no children. + + if (parents.last()->childCount() > 0) { + parents << parents.last()->child(parents.last()->childCount()-1); + indentations << position; + } + } else { + while (position < indentations.last() && parents.count() > 0) { + parents.pop_back(); + indentations.pop_back(); + } + } + + // Append a new item to the current parent's list of children. + FindResultItem *parent = parents.last(); + parent->insertChildren(parent->childCount(), 1, rootItem->columnCount()); + for (int column = 0; column < columnData.size(); ++column) + parent->child(parent->childCount() - 1)->setData(column, columnData[column]); + } + + number++; + } +} diff -r 36eb4b8f409e -r 1ad892c1a709 findresultmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultmodel.h Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,51 @@ +#ifndef FINDRESULTMODEL_H +#define FINDRESULTMODEL_H + +#include +#include +#include + +class FindResultItem; + +class FindResultModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + FindResultModel( QObject *parent = 0); + ~FindResultModel(); + + QVariant data(const QModelIndex &index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + Qt::ItemFlags flags(const QModelIndex &index) const; + bool setData(const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole); + bool setHeaderData(int section, Qt::Orientation orientation, + const QVariant &value, int role = Qt::EditRole); + + bool insertColumns(int position, int columns, + const QModelIndex &parent = QModelIndex()); + bool removeColumns(int position, int columns, + const QModelIndex &parent = QModelIndex()); + bool insertRows(int position, int rows, + const QModelIndex &parent = QModelIndex()); + bool removeRows(int position, int rows, + const QModelIndex &parent = QModelIndex()); + +private: + void setupModelData(const QStringList &lines, FindResultItem *parent); + FindResultItem *getItem(const QModelIndex &index) const; + + FindResultItem *rootItem; +}; + +#endif diff -r 36eb4b8f409e -r 1ad892c1a709 findresultwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultwidget.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,65 @@ +#include "findresultwidget.h" + +#include +#include +#include +#include + +#include +#include + +#include "findresultmodel.h" + +extern QString iconPath; + +FindResultWidget::FindResultWidget(QWidget *) +{ + // Create model + model=new FindResultModel; + + // Create TreeView + view = new QTreeView; + view->setModel (model); + + QVBoxLayout* mainLayout = new QVBoxLayout; + QHBoxLayout *row2Layout = new QHBoxLayout; + + // Create Buttons + cancelbutton = new QPushButton; + //cancelbutton->setText(tr("Cancel")); + cancelbutton->setIcon (QIcon (iconPath+"fileclose.png")); + cancelbutton->setShortcut (Qt::Key_Escape); + connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); + + row2Layout->addWidget (cancelbutton); + //row2Layout->addWidget(findcombo); + //row2Layout->addWidget(nextbutton); + + QMenuBar *mb=new QMenuBar; + QAction *a=new QAction ("Foo action",NULL); + mb->addAction (a); + mb->insertSeparator(); + mainLayout->addWidget(mb); + mainLayout->addWidget(view); + mainLayout->addLayout (row2Layout); + + setLayout (mainLayout); +} + +void FindResultWidget::popup() +{ + show(); +} + +void FindResultWidget::cancelPressed() +{ + emit (hideFindResultWidget() ); +} + +#include +void FindResultWidget::hideEvent(QHideEvent *event) //FIXME-2 testing only +{ + qDebug()<<"FRW::hideEvent()"; + event->ignore(); +} + diff -r 36eb4b8f409e -r 1ad892c1a709 findresultwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findresultwidget.h Tue Mar 02 13:59:19 2010 +0000 @@ -0,0 +1,35 @@ +#ifndef FINDRESULTWIDGET_H +#define FINDRESULTWIDGET_H + +#include + +class QTreeView; +class QPushButton; +class FindResultModel; + +class FindResultWidget: public QWidget +{ + Q_OBJECT + +public: + FindResultWidget (QWidget *parent=NULL); + +public slots: + void popup(); + void cancelPressed(); + +protected: + virtual void hideEvent (QHideEvent *event); + + +signals: + void hideFindResultWidget(); + +private: + FindResultModel *model; + QTreeView *view; + QPushButton *cancelbutton; +}; + +#endif + diff -r 36eb4b8f409e -r 1ad892c1a709 findwidget.cpp --- a/findwidget.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/findwidget.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -2,10 +2,15 @@ #include #include +#include +#include +#include +#include + + #include "findwidget.h" -extern QString vymName; extern QString iconPath; FindWidget::FindWidget(QWidget *) diff -r 36eb4b8f409e -r 1ad892c1a709 findwidget.h --- a/findwidget.h Thu Feb 25 11:03:52 2010 +0000 +++ b/findwidget.h Tue Mar 02 13:59:19 2010 +0000 @@ -1,12 +1,11 @@ #ifndef FINDWIDGET_H #define FINDWIDGET_H -#include -#include -#include -#include -#include +#include +class QGroupBox; +class QComboBox; +class QPushButton; class FindWidget: public QWidget { diff -r 36eb4b8f409e -r 1ad892c1a709 mainwindow.cpp --- a/mainwindow.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/mainwindow.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -11,6 +11,7 @@ #include "exportoofiledialog.h" #include "exports.h" #include "file.h" +#include "findresultwidget.h" #include "flagrow.h" #include "historywindow.h" #include "imports.h" @@ -126,6 +127,14 @@ browserPID=new qint64; *browserPID=0; + // Dock widgets //FIXME-2 testing... + + FindResultWidget *findResultWidget=new FindResultWidget; + QDockWidget *dw= new QDockWidget ("Dock Widget",this); + dw->setWidget (findResultWidget); + dw->hide(); + addDockWidget (Qt::RightDockWidgetArea,dw); + // Satellite windows ////////////////////////////////////////// // history window historyWindow=new HistoryWindow(); @@ -1073,7 +1082,7 @@ a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color &branch","Edit menu" ), this); a->setStatusTip ( tr( "Color branch" ) ); - a->setShortcut (Qt::CTRL + Qt::Key_B); + a->setShortcut (Qt::CTRL + Qt::Key_B + Qt::SHIFT); connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) ); a->setEnabled (false); a->addTo( tb ); @@ -1083,7 +1092,7 @@ a= new QAction(QPixmap(iconPath+"formatcolorsubtree.png"), tr( "Color sub&tree","Edit menu" ), this); a->setStatusTip ( tr( "Color Subtree" )); - //FIXME-2 switch back to that a->setShortcut (Qt::CTRL + Qt::Key_T); // Color subtree + a->setShortcut (Qt::CTRL + Qt::Key_B); // Color subtree connect( a, SIGNAL( triggered() ), this, SLOT( formatColorSubtree() ) ); a->setEnabled (false); formatMenu->addAction (a); diff -r 36eb4b8f409e -r 1ad892c1a709 process.cpp --- a/process.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/process.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -1,5 +1,10 @@ #include "process.h" +#include +#include + +extern bool debug; + ///////////////////////////////////////////////////////////////// // Process ///////////////////////////////////////////////////////////////// @@ -22,6 +27,40 @@ stdOut=""; } +void Process::runScript(QString spath, QString fpath) +{ + spath.replace ("%f",fpath); + QStringList args=QStringList::split (' ',spath,false); + spath=args.takeFirst(); + + if (debug) + qDebug()<<"Process::runScript : " + spath+" "+args.join(" "); + + start (spath,args); + if (!waitForStarted() ) + { + QMessageBox::critical( 0, tr( "Critical Error" ), + tr("Could not start %1").arg(spath) ); + } else + { + if (!waitForFinished()) + QMessageBox::critical( 0, tr( "Critical Error" ), + tr("%1 didn't exit normally").arg(spath) + + getErrout() ); + // else + // if (exitStatus()>0) showOutput=true; + + } + /* FIXME-3 output for Process::runScript + qDebug()< #include - -using namespace std; - class Process:public QProcess { Q_OBJECT @@ -14,9 +11,9 @@ Process (); ~Process (); void clear(); + void runScript( QString spath, QString fpath ); QString getErrout(); QString getStdout(); - public slots: virtual void readProcErrout(); diff -r 36eb4b8f409e -r 1ad892c1a709 settings.cpp --- a/settings.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/settings.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -258,7 +258,7 @@ "setting", attribut ("key",*itk) +attribut ("value",*itv) - )+"\n"; + ); itp++; itk++; itv++; diff -r 36eb4b8f409e -r 1ad892c1a709 texteditor.cpp --- a/texteditor.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/texteditor.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -1,6 +1,5 @@ #include "texteditor.h" -#include #include #include @@ -17,8 +16,6 @@ extern bool debug; -using namespace std; - /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// diff -r 36eb4b8f409e -r 1ad892c1a709 treeeditor.cpp --- a/treeeditor.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/treeeditor.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -3,9 +3,6 @@ #include #include -#include -using namespace std; - #include "vymmodel.h" /////////////////////////////////////////////////////////////////////// @@ -14,7 +11,7 @@ { model=m; - // FIXME-2 use proxmodel + // FIXME-3 use proxmodel //proxyModel = new MySortFilterProxyModel(this); //setModel(proxyModel); setModel(m); diff -r 36eb4b8f409e -r 1ad892c1a709 treemodel.cpp --- a/treemodel.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/treemodel.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -1,8 +1,5 @@ #include -#include -using namespace std; - #include "attributeitem.h" #include "branchitem.h" #include "imageitem.h" diff -r 36eb4b8f409e -r 1ad892c1a709 version.h --- a/version.h Thu Feb 25 11:03:52 2010 +0000 +++ b/version.h Tue Mar 02 13:59:19 2010 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version, not for production!" -#define __VYM_BUILD_DATE "2010-02-22" +#define __VYM_BUILD_DATE "2010-02-26" bool checkVersion(const QString &); diff -r 36eb4b8f409e -r 1ad892c1a709 vym.pro --- a/vym.pro Thu Feb 25 11:03:52 2010 +0000 +++ b/vym.pro Tue Mar 02 13:59:19 2010 +0000 @@ -51,6 +51,9 @@ extrainfodialog.h \ file.h \ findwidget.h \ + findresultwidget.h \ + findresultitem.h \ + findresultmodel.h \ flag.h \ flagobj.h \ flagrowobj.h \ @@ -118,6 +121,9 @@ extrainfodialog.cpp \ file.cpp \ findwidget.cpp \ + findresultwidget.cpp \ + findresultitem.cpp \ + findresultmodel.cpp \ flag.cpp \ flagobj.cpp \ flagrow.cpp \ diff -r 36eb4b8f409e -r 1ad892c1a709 vymmodel.cpp --- a/vymmodel.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/vymmodel.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -4258,14 +4258,21 @@ } } -void VymModel::exportHTML (const QString &dir, bool askForName) //FIXME-2 own dialogue missing and also option to save settings in map -{ - ExportHTMLDialog dia(NULL); +void VymModel::exportHTML (const QString &dir, bool useDialog) +{ + ExportHTML ex (this); + ex.setDir (dir); + ex.doExport(useDialog); +} + +void VymModel::exportXHTML (const QString &dir, bool askForName) +{ + ExportXHTMLDialog dia(NULL); dia.setFilePath (filePath ); dia.setMapName (mapName ); dia.readSettings(); if (dir!="") dia.setDir (dir); - QDir d; + bool ok=true; if (askForName) @@ -4274,7 +4281,7 @@ ok=false; else { - d=dia.getDir(); + QDir d (dia.getDir()); // Check, if warnings should be used before overwriting // the output directory if (d.exists() && d.count()>0) @@ -4285,75 +4292,21 @@ "The directory %1 is not empty.\n" "Do you risk to overwrite some of its contents?").arg(d.path() )); warn.setCaption("Warning: Directory not empty"); - warn.setShowAgainName("mainwindow/export-XML-overwrite-dir"); + warn.setShowAgainName("mainwindow/overwrite-dir-xhtml"); if (warn.exec()!=QDialog::Accepted) ok=false; } } } + if (ok) { - // Hide stuff during export, if settings want this - setExportMode (true); - - ExportHTML ex (this); - ex.setFile (d.path()+"/"+mapName+".html"); - //qDebug()<< "VM::exportHTML writing "<0) - { - WarningDialog warn; - warn.showCancelButton (true); - warn.setText(QString( - "The directory %1 is not empty.\n" - "Do you risk to overwrite some of its contents?").arg(d.path() )); - warn.setCaption("Warning: Directory not empty"); - warn.setShowAgainName("mainwindow/overwrite-dir-xhtml"); - - if (warn.exec()!=QDialog::Accepted) ok=false; - } - } - } - - if (ok) - { - exportXML (dia.getDir(),false ); - dia.doExport(mapName ); - //if (dia.hasChanged()) setChanged(); - } -} - void VymModel::exportOOPresentation(const QString &fn, const QString &cf) { ExportOO ex; @@ -4695,7 +4648,7 @@ } -void VymModel::animate() //FIXME-2 animation causes flicker after cut/undo cut ?!? +void VymModel::animate() { animationTimer->stop(); BranchObj *bo; @@ -4724,7 +4677,6 @@ void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest) { - qDebug()<<"Start animation for "<getTreeItem()<getTreeItem()->depth()>0) { diff -r 36eb4b8f409e -r 1ad892c1a709 vymmodel.h --- a/vymmodel.h Thu Feb 25 11:03:52 2010 +0000 +++ b/vymmodel.h Tue Mar 02 13:59:19 2010 +0000 @@ -447,7 +447,7 @@ void exportASCII (QString fname="",bool askForName=true); /*! Export as HTML to directory */ - void exportHTML(const QString& dir="", bool askForName=true); + void exportHTML(const QString& dir="", bool useDialog=true); void exportXHTML(const QString& dir="", bool askForName=true); /*! Export as OpenOfficeOrg presentation */ diff -r 36eb4b8f409e -r 1ad892c1a709 vymview.cpp --- a/vymview.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/vymview.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -1,8 +1,5 @@ #include "vymview.h" -#include -using namespace std; - #include "branchitem.h" #include "findwidget.h" #include "mainwindow.h" diff -r 36eb4b8f409e -r 1ad892c1a709 xlinkitem.cpp --- a/xlinkitem.cpp Thu Feb 25 11:03:52 2010 +0000 +++ b/xlinkitem.cpp Tue Mar 02 13:59:19 2010 +0000 @@ -6,9 +6,6 @@ #include "vymmodel.h" #include "xlinkobj.h" -#include -using namespace std; - ///////////////////////////////////////////////////////////////// // XLinkItem ///////////////////////////////////////////////////////////////// @@ -22,12 +19,16 @@ XLinkItem::~XLinkItem () { - cout << "Destr XLinkItem "< +using namespace std; + #include #include "process.h"