summaryrefslogtreecommitdiff
path: root/src/mainwin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r--src/mainwin.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 9cb59dd..dd855fb 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -522,7 +522,7 @@ MainWindow::setFileName(const QString &filename)
this->fileName = fileinfo.fileName();
}
- this->root_ctx.setDocumentPath(fileinfo.dir().absolutePath().toStdString());
+ this->root_ctx.setDocumentPath(fileinfo.dir().absolutePath().toLocal8Bit().constData());
QDir::setCurrent(fileinfo.dir().absolutePath());
}
@@ -586,13 +586,13 @@ void MainWindow::refreshDocument()
QFile file(this->fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
PRINTB("Failed to open file %s: %s",
- this->fileName.toStdString() % file.errorString().toStdString());
+ this->fileName.toLocal8Bit().constData() % file.errorString().toLocal8Bit().constData());
}
else {
QTextStream reader(&file);
reader.setCodec("UTF-8");
QString text = reader.readAll();
- PRINTB("Loaded design '%s'.", this->fileName.toStdString());
+ PRINTB("Loaded design '%s'.", this->fileName.toLocal8Bit().constData());
editor->setPlainText(text);
}
}
@@ -904,13 +904,13 @@ void MainWindow::actionSave()
setCurrentOutput();
QFile file(this->fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
- PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString());
+ PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toLocal8Bit().constData() % file.errorString().toLocal8Bit().constData());
}
else {
QTextStream writer(&file);
writer.setCodec("UTF-8");
writer << this->editor->toPlainText();
- PRINTB("Saved design '%s'.", this->fileName.toStdString());
+ PRINTB("Saved design '%s'.", this->fileName.toLocal8Bit().constData());
this->editor->setContentModified(false);
}
clearCurrentOutput();
@@ -1054,7 +1054,8 @@ bool MainWindow::compileTopLevelDocument(bool reload)
this->last_compiled_doc = editor->toPlainText();
std::string fulltext =
- this->last_compiled_doc.toStdString() + "\n" + commandline_commands;
+ std::string(this->last_compiled_doc.toLocal8Bit().constData()) +
+ "\n" + commandline_commands;
delete this->root_module;
this->root_module = NULL;
@@ -1293,7 +1294,7 @@ void MainWindow::actionDisplayAST()
e->setWindowTitle("AST Dump");
e->setReadOnly(true);
if (root_module) {
- e->setPlainText(QString::fromStdString(root_module->dump("", "")));
+ e->setPlainText(QString::fromLocal8Bit(root_module->dump("", "").c_str()));
} else {
e->setPlainText("No AST to dump. Please try compiling first...");
}
@@ -1311,7 +1312,7 @@ void MainWindow::actionDisplayCSGTree()
e->setWindowTitle("CSG Tree Dump");
e->setReadOnly(true);
if (this->root_node) {
- e->setPlainText(QString::fromStdString(this->tree.getString(*this->root_node)));
+ e->setPlainText(QString::fromLocal8Bit(this->tree.getString(*this->root_node).c_str()));
} else {
e->setPlainText("No CSG to dump. Please try compiling first...");
}
@@ -1328,7 +1329,12 @@ void MainWindow::actionDisplayCSGProducts()
e->setTabStopWidth(30);
e->setWindowTitle("CSG Products Dump");
e->setReadOnly(true);
- e->setPlainText(QString("\nCSG before normalization:\n%1\n\n\nCSG after normalization:\n%2\n\n\nCSG rendering chain:\n%3\n\n\nHighlights CSG rendering chain:\n%4\n\n\nBackground CSG rendering chain:\n%5\n").arg(root_raw_term ? QString::fromStdString(root_raw_term->dump()) : "N/A", root_norm_term ? QString::fromStdString(root_norm_term->dump()) : "N/A", this->root_chain ? QString::fromStdString(this->root_chain->dump()) : "N/A", highlights_chain ? QString::fromStdString(highlights_chain->dump()) : "N/A", background_chain ? QString::fromStdString(background_chain->dump()) : "N/A"));
+ e->setPlainText(QString("\nCSG before normalization:\n%1\n\n\nCSG after normalization:\n%2\n\n\nCSG rendering chain:\n%3\n\n\nHighlights CSG rendering chain:\n%4\n\n\nBackground CSG rendering chain:\n%5\n")
+ .arg(root_raw_term ? QString::fromLocal8Bit(root_raw_term->dump().c_str()) : "N/A",
+ root_norm_term ? QString::fromLocal8Bit(root_norm_term->dump().c_str()) : "N/A",
+ this->root_chain ? QString::fromLocal8Bit(this->root_chain->dump().c_str()) : "N/A",
+ highlights_chain ? QString::fromLocal8Bit(highlights_chain->dump().c_str()) : "N/A",
+ background_chain ? QString::fromLocal8Bit(background_chain->dump().c_str()) : "N/A"));
e->show();
e->resize(600, 400);
clearCurrentOutput();
@@ -1376,7 +1382,7 @@ void MainWindow::actionExportSTLorOFF(bool)
std::ofstream fstream(stl_filename.toUtf8());
if (!fstream.is_open()) {
- PRINTB("Can't open file \"%s\" for export", stl_filename.toStdString());
+ PRINTB("Can't open file \"%s\" for export", stl_filename.toLocal8Bit().constData());
}
else {
if (stl_mode) export_stl(this->root_N, fstream);
@@ -1429,7 +1435,7 @@ void MainWindow::actionExportDXF()
std::ofstream fstream(dxf_filename.toUtf8());
if (!fstream.is_open()) {
- PRINTB("Can't open file \"%s\" for export", dxf_filename.toStdString());
+ PRINTB("Can't open file \"%s\" for export", dxf_filename.toLocal8Bit().constData());
}
else {
export_dxf(this->root_N, fstream);
@@ -1462,7 +1468,7 @@ void MainWindow::actionExportCSG()
std::ofstream fstream(csg_filename.toUtf8());
if (!fstream.is_open()) {
- PRINTB("Can't open file \"%s\" for export", csg_filename.toStdString());
+ PRINTB("Can't open file \"%s\" for export", csg_filename.toLocal8Bit().constData());
}
else {
fstream << this->tree.getString(*this->root_node) << "\n";
@@ -1482,7 +1488,7 @@ void MainWindow::actionExportImage()
if (img_filename.isEmpty()) {
PRINT("No filename specified. Image export aborted.");
} else {
- qglview->save(img_filename.toStdString().c_str());
+ qglview->save(img_filename.toLocal8Bit().constData());
}
clearCurrentOutput();
return;
@@ -1832,7 +1838,7 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata)
// originates in a worker thread.
MainWindow *thisp = static_cast<MainWindow*>(userdata);
QMetaObject::invokeMethod(thisp->console, "append", Qt::QueuedConnection,
- Q_ARG(QString, QString::fromStdString(msg)));
+ Q_ARG(QString, QString::fromLocal8Bit(msg.c_str())));
}
void MainWindow::setCurrentOutput()
contact: Jan Huwald // Impressum