#include "mainwindow.h"
#include <QTemporaryFile>
+extern int errorPipe(char *errMsg);
+
#define WIDGET(t,f) ((t*)findChild<t *>(#f))
typedef struct {
const char *data;
bool CFrmSettings::loadGraph(MdiChild * m)
{
- if (graph)
+ if (graph) {
agclose(graph);
+ graph = NULL;
+ }
graphData.clear();
graphData.append(m->toPlainText());
setActiveWindow(m);
/* Reset line number and file name;
* If known, might want to use real name
*/
- agsetfile("<gvedit>");
+ agsetfile((char*)"<gvedit>");
QByteArray bytes = graphData.toUtf8();
rdr.data = bytes.constData();
rdr.len = strlen(rdr.data);
Agraph_t *G = this->graph;
QString layout;
- if(agfindnodeattr(G, "pos"))
+ if(agfindnodeattr(G, (char*)"pos"))
layout="nop2";
else
layout=WIDGET(QComboBox, cbLayout)->currentText();
if (fileName != activeWindow->outputFile)
activeWindow->outputFile = fileName;
+#ifdef WIN32
+ if ((!fileName.contains('/')) && (!fileName.contains('\\')))
+#else
+ if (!fileName.contains('/'))
+#endif
+ { // no directory info => can we create/write the file?
+ QFile outf(fileName);
+ if (outf.open(QIODevice::WriteOnly))
+ outf.close();
+ else {
+ QString pathName = QDir::homePath();
+ pathName.append("/").append(fileName);
+ fileName = QDir::toNativeSeparators (pathName);
+ QString msg ("Output written to ");
+ msg.append(fileName);
+ msg.append("\n");
+ errorPipe((char *) msg.toAscii().constData());
+ }
+ }
+
if (gvRenderFilename
(gvc, graph, (char *) sfx.toUtf8().constData(),
(char *) fileName.toUtf8().constData()))
<< QApplication::translate("Dialog", "sfdp", 0, QApplication::UnicodeUTF8)
<< QApplication::translate("Dialog", "twopi", 0, QApplication::UnicodeUTF8)
);
- label_3->setText(QApplication::translate("Dialog", "Output file Type", 0, QApplication::UnicodeUTF8));
+ label_3->setText(QApplication::translate("Dialog", "Output File Type", 0, QApplication::UnicodeUTF8));
cbExtension->clear();
cbExtension->insertItems(0, QStringList()
<< QApplication::translate("Dialog", "png", 0, QApplication::UnicodeUTF8)