On Wed, Jun 11, 2014 at 11:30 PM, Dirk Hohndel <[email protected]> wrote:
> Gehad, > > you said earlier that you have problems with this patch, but didn't go > into any more details. > It looks solid to me, so unless there's a good reason not to take it... > > Please let us know! > I changed the organization of the exported files as described in my previous email. anyway I will update my patches after you push this patch and resend it. > > /D > On Tue, Jun 10, 2014 at 11:06:39AM -0300, Tomaz Canabrava wrote: > > From 79a9e2c2432321ec73ed3034458c42e11ebf25b2 Mon Sep 17 00:00:00 2001 > > From: Tomaz Canabrava <[email protected]> > > Date: Tue, 10 Jun 2014 08:02:55 -0300 > > Subject: [PATCH 4/9] Much needed clean on the HTML export dialog code. > > > > Correct usage of QFile, QString and code cleanup. > > > > Signed-off-by: Tomaz Canabrava <[email protected]> > > --- > > qt-ui/divelogexportdialog.cpp | 49 > ++++++++++++++++--------------------------- > > qt-ui/divelogexportdialog.h | 4 ++-- > > 2 files changed, 20 insertions(+), 33 deletions(-) > > > > diff --git a/qt-ui/divelogexportdialog.cpp > b/qt-ui/divelogexportdialog.cpp > > index 84be70b..a206e78 100644 > > --- a/qt-ui/divelogexportdialog.cpp > > +++ b/qt-ui/divelogexportdialog.cpp > > @@ -5,6 +5,7 @@ > > #include <QTextStream> > > #include <QSettings> > > #include <QDir> > > +#include <QDebug> > > > > #include "mainwindow.h" > > #include "divelogexportdialog.h" > > @@ -66,52 +67,38 @@ void DiveLogExportDialog::showExplanation() > > } > > } > > > > -void DiveLogExportDialog::exportHtmlInit(QString filename) > > +void DiveLogExportDialog::exportHtmlInit(const QString& filename) > > { > > QDir dir(filename); > > if (!dir.exists()) { > > - /* I think this will not work as expected on windows */ > > - QDir::home().mkpath(filename); > > + dir.mkpath(filename); > > } > > > > QString json_dive_data = filename + QDir::separator() + > "file.json"; > > - QString json_settings = filename + "/settings.json"; > > + QString json_settings = filename + QDir::separator() + > "settings.json"; > > > > exportHTMLsettings(json_settings); > > export_HTML(json_dive_data.toUtf8().data(), > ui->exportSelectedDives->isChecked()); > > > > QString searchPath = getSubsurfaceDataPath("theme"); > > - if (searchPath.isEmpty()) > > - return; > > - > > - QFile *tmpFile; > > - > > - tmpFile = new QFile(searchPath + "/dive_export.html"); > > - tmpFile->copy(filename + "/dive_export.html"); > > - delete tmpFile; > > - > > - tmpFile = new QFile(searchPath + "/list_lib.js"); > > - tmpFile->copy(filename + "/list_lib.js"); > > - delete tmpFile; > > - > > - tmpFile = new QFile(searchPath + "/poster.png"); > > - tmpFile->copy(filename + "/poster.png"); > > - delete tmpFile; > > + if (searchPath.isEmpty()){ > > + qDebug() << "empty search path"; > > + return; > > + } > > > > - tmpFile = new QFile(searchPath + "/index.html"); > > - tmpFile->copy(filename + "/index.html"); > > - delete tmpFile; > > + searchPath += QDir::separator(); > > + QString dirname = filename + QDir::separator(); > > > > - if (ui->themeSelection->currentText() == "Light") { > > - tmpFile = new QFile(searchPath + "/light.css"); > > - } else { > > - tmpFile = new QFile(searchPath + "/sand.css"); > > - } > > - tmpFile->copy(filename + "/theme.css"); > > - delete tmpFile; > > + qDebug() << "from" << searchPath << "to" << dirname; > > + QFile::copy(searchPath + "dive_export.html",dirname + > "dive_export.html"); > > + QFile::copy(searchPath + "list_lib.js", dirname + "list_lib.js"); > > + QFile::copy(searchPath + "poster.png", dirname + "poster.png"); > > + QFile::copy(searchPath + "index.html",dirname + "index.html"); > > + QFile::copy(searchPath + ui->themeSelection->currentText() == > "Light" ? "light.css" : "sand.css", > > + filename + "theme.css"); > > } > > > > -void DiveLogExportDialog::exportHTMLsettings(QString filename) > > +void DiveLogExportDialog::exportHTMLsettings(const QString& filename) > > { > > QSettings settings; > > settings.beginGroup("HTML"); > > diff --git a/qt-ui/divelogexportdialog.h b/qt-ui/divelogexportdialog.h > > index 8322fa1..fc1bfd3 100644 > > --- a/qt-ui/divelogexportdialog.h > > +++ b/qt-ui/divelogexportdialog.h > > @@ -23,8 +23,8 @@ slots: > > private: > > Ui::DiveLogExportDialog *ui; > > void showExplanation(); > > - void exportHtmlInit(QString filename); > > - void exportHTMLsettings(QString filename); > > + void exportHtmlInit(const QString& filename); > > + void exportHTMLsettings(const QString& filename); > > }; > > > > #endif // DIVELOGEXPORTDIALOG_H > > -- > > 2.0.0 > > > >
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
