Commit 4062c181 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

Introduce QString conversion to UTF8 bytes

parent c902720d
......@@ -74,7 +74,7 @@ void SourceToolbarActions::onAction(QAction* a)
{
stack->beginUndoSet(QString("Create %1").arg(source_type));
}
builder->createSource("sources", source_type.toLocal8Bit().data(), s);
builder->createSource("sources", source_type.toUtf8().data(), s);
if (stack)
{
stack->endUndoSet();
......
#include "pqOpenVRControls.h"
#include "pqAnimationManager.h"
#include "pqPVApplicationCore.h"
#include "pqParaViewMenuBuilders.h"
......@@ -65,7 +66,7 @@ void pqOpenVRControls::constructor(vtkPVOpenVRHelper* val)
QObject::connect(
this->Internals->rightTrigger, &QComboBox::currentTextChanged, [&](QString const& text) {
std::string mode = text.toLocal8Bit().constData();
std::string mode = text.toUtf8().toStdString();
this->Helper->SetRightTriggerMode(mode);
});
......@@ -101,7 +102,7 @@ void pqOpenVRControls::constructor(vtkPVOpenVRHelper* val)
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (!this->NoForward && text.length())
{
this->Helper->SetScaleFactor(std::stof(text.toLocal8Bit().constData()));
this->Helper->SetScaleFactor(std::stof(text.toUtf8().toStdString()));
}
});
......@@ -109,7 +110,7 @@ void pqOpenVRControls::constructor(vtkPVOpenVRHelper* val)
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (!this->NoForward && text.length())
{
this->Helper->SetMotionFactor(std::stof(text.toLocal8Bit().constData()));
this->Helper->SetMotionFactor(std::stof(text.toUtf8().toStdString()));
}
});
......@@ -117,7 +118,7 @@ void pqOpenVRControls::constructor(vtkPVOpenVRHelper* val)
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (!this->NoForward && text.length())
{
this->Helper->LoadCameraPose(std::stoi(text.toLocal8Bit().constData()));
this->Helper->LoadCameraPose(std::stoi(text.toUtf8().toStdString()));
}
});
......@@ -125,7 +126,7 @@ void pqOpenVRControls::constructor(vtkPVOpenVRHelper* val)
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (text.length())
{
this->Helper->SaveCameraPose(std::stoi(text.toLocal8Bit().constData()));
this->Helper->SaveCameraPose(std::stoi(text.toUtf8().toStdString()));
}
});
......@@ -148,7 +149,7 @@ void pqOpenVRControls::resetPositions()
void pqOpenVRControls::assignFieldValue()
{
// get the current combo setting
std::string val = this->Internals->fieldValueCombo->currentText().toLocal8Bit().constData();
std::string val = this->Internals->fieldValueCombo->currentText().toUtf8().toStdString();
this->Helper->SetEditableFieldValue(val);
}
......
......@@ -109,8 +109,8 @@ void pqOpenVRDockPanel::constructor()
// hide/show widgets based on Imago support
#ifdef OPENVR_HAS_IMAGO_SUPPORT
QObject::connect(this->Internals->imagoLoginButton, &QPushButton::clicked, [&]() {
std::string uid = this->Internals->imagoUserValue->text().toLocal8Bit().constData();
std::string pw = this->Internals->imagoPasswordValue->text().toLocal8Bit().constData();
std::string uid = this->Internals->imagoUserValue->text().toUtf8().toStdString();
std::string pw = this->Internals->imagoPasswordValue->text().toUtf8().toStdString();
if (this->Helper->GetWidgets()->LoginToImago(uid, pw))
{
// set the background of the login button to light green
......@@ -197,28 +197,28 @@ void pqOpenVRDockPanel::constructor()
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (text.length())
{
this->Helper->GetWidgets()->SetImagoWorkspace(text.toLocal8Bit().constData());
this->Helper->GetWidgets()->SetImagoWorkspace(text.toUtf8().toStdString());
}
});
QObject::connect(this->Internals->imagoDatasetCombo,
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (text.length())
{
this->Helper->GetWidgets()->SetImagoDataset(text.toLocal8Bit().constData());
this->Helper->GetWidgets()->SetImagoDataset(text.toUtf8().toStdString());
}
});
QObject::connect(this->Internals->imagoImageryTypeCombo,
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (text.length())
{
this->Helper->GetWidgets()->SetImagoImageryType(text.toLocal8Bit().constData());
this->Helper->GetWidgets()->SetImagoImageryType(text.toUtf8().toStdString());
}
});
QObject::connect(this->Internals->imagoImageTypeCombo,
QOverload<const QString&>::of(&QComboBox::activated), [=](QString const& text) {
if (text.length())
{
this->Helper->GetWidgets()->SetImagoImageType(text.toLocal8Bit().constData());
this->Helper->GetWidgets()->SetImagoImageType(text.toUtf8().toStdString());
}
});
#else
......
......@@ -377,7 +377,7 @@ void pqSLACManager::checkActionEnabled()
//-----------------------------------------------------------------------------
void pqSLACManager::showField(QString name)
{
this->showField(name.toLocal8Bit().data());
this->showField(name.toUtf8().data());
}
void pqSLACManager::showField(const char* name)
......@@ -459,7 +459,7 @@ void pqSLACManager::showField(const char* name)
if (!rangeData)
{
QString magName = QString("%1_M").arg(name);
rangeData = ranges->GetColumnByName(magName.toLocal8Bit().data());
rangeData = ranges->GetColumnByName(magName.toUtf8().data());
}
this->CurrentFieldRangeKnown = true;
......@@ -552,14 +552,12 @@ void pqSLACManager::updatePlotField()
visibility << seriesName << 1;
double color[3] = { 0.0, 0.0, 0.0 };
vtkSMPropertyHelper(reprProxy, "SeriesColor")
.SetStatus(seriesName.toLocal8Bit().data(), color, 3);
vtkSMPropertyHelper(reprProxy, "SeriesColor").SetStatus(seriesName.toUtf8().data(), color, 3);
vtkSMPropertyHelper(reprProxy, "SeriesLineThickness")
.SetStatus(seriesName.toLocal8Bit().data(), 1);
.SetStatus(seriesName.toUtf8().data(), 1);
vtkSMPropertyHelper(reprProxy, "SeriesLineStyle")
.SetStatus(seriesName.toLocal8Bit().data(), 1);
vtkSMPropertyHelper(reprProxy, "SeriesLineStyle").SetStatus(seriesName.toUtf8().data(), 1);
}
else
{
......
......@@ -155,10 +155,10 @@ void pqSaveStateAndScreenshotReaction::onTriggered()
QString stateFile = pathNoExt + ".pvsm";
pqSaveStateReaction::saveState(stateFile);
QString screenshotFile = pathNoExt + ".png";
shProxy->WriteImage(screenshotFile.toLocal8Bit().data());
shProxy->WriteImage(screenshotFile.toUtf8().data());
QString textFile = pathNoExt + ".txt";
std::ofstream ofs(textFile.toLocal8Bit().data(), std::ofstream::out);
ofs << nameNoExt.toLocal8Bit().data() << std::endl;
std::ofstream ofs(textFile.toUtf8().data(), std::ofstream::out);
ofs << nameNoExt.toUtf8().data() << std::endl;
ofs.close();
}
}
......
......@@ -322,7 +322,7 @@ void pqVRDockPanel::removeConnection()
void pqVRDockPanel::addStyle()
{
vtkSMProxy* proxy = this->Internals->propertyCombo->getCurrentProxy();
QByteArray property = this->Internals->propertyCombo->getCurrentPropertyName().toLocal8Bit();
QByteArray property = this->Internals->propertyCombo->getCurrentPropertyName().toUtf8();
QString styleString = this->Internals->stylesCombo->currentText();
vtkVRInteractorStyleFactory* styleFactory = vtkVRInteractorStyleFactory::GetInstance();
......@@ -504,9 +504,7 @@ void pqVRDockPanel::saveState()
queueHandler->saveStylesConfiguration(root.GetPointer());
}
// Avoid temporary QByteArrays in QString --> const char * conversion:
QByteArray filename_ba = filename.toLocal8Bit();
vtksys::ofstream os(filename_ba.constData(), ios::out);
vtksys::ofstream os(filename.toUtf8().data(), ios::out);
root->PrintXML(os, vtkIndent());
}
......
......@@ -135,7 +135,7 @@ void pqBlotShell::executePythonCommand(const QString& command)
{
Q_EMIT this->executing(true);
// this->printMessage(command);
this->Interpretor->RunSimpleString(command.toLocal8Bit().data());
this->Interpretor->RunSimpleString(command.toUtf8().data());
Q_EMIT this->executing(false);
}
......
......@@ -139,7 +139,7 @@ void pqAnimatedExportReaction::Export(const QString& filename)
{ // Save file
vtkNew<vtkSMAnimationSceneWebWriter> writer;
writer->SetFileName(filename.toLocal8Bit().data());
writer->SetFileName(filename.toUtf8().data());
writer->SetAnimationScene(scene->getProxy());
writer->SetRenderView(rview->getRenderViewProxy());
if (!writer->Save())
......
......@@ -334,7 +334,7 @@ QVariant pqAnnotationsModel::data(const QModelIndex& idx, int role) const
{
auto value = this->Internals->Items[idx.row()].Value;
unsigned int unused = 0;
res = this->VisibilityDomain->IsInDomain(value.toLocal8Bit().data(), unused) != 0;
res = this->VisibilityDomain->IsInDomain(value.toUtf8().data(), unused) != 0;
}
return res ? true : false;
......
......@@ -71,7 +71,7 @@ void pqCTHArraySelectionDecorator::updateSelection()
foreach (const QString& pname, this->PropertyNames)
{
vtkSMProperty* prop = proxy->GetProperty(pname.toLocal8Bit().data());
vtkSMProperty* prop = proxy->GetProperty(pname.toUtf8().data());
if (prop && prop != curProperty)
{
vtkSMUncheckedPropertyHelper(prop).SetNumberOfElements(0);
......
......@@ -118,7 +118,7 @@ bool pqCatalystExportReaction::exportScript(const QString& filename)
return false;
}
vtkSmartPyObject name(PyString_FromString("save_catalyst_state"));
vtkSmartPyObject pyfilename(PyString_FromString(filename.toLocal8Bit().data()));
vtkSmartPyObject pyfilename(PyString_FromString(filename.toUtf8().data()));
vtkSmartPyObject pyproxy(vtkPythonUtil::GetObjectFromPointer(proxy));
vtkSmartPyObject result(PyObject_CallMethodObjArgs(
module, name, pyfilename.GetPointer(), pyproxy.GetPointer(), nullptr));
......
......@@ -113,7 +113,7 @@ void pqChangePipelineInputReaction::changeInput()
}
vtkSMInputProperty* ip = vtkSMInputProperty::SafeDownCast(
filter->getProxy()->GetProperty(inputPortName.toLocal8Bit().data()));
filter->getProxy()->GetProperty(inputPortName.toUtf8().data()));
ip->SetProxies(static_cast<unsigned int>(inputPtrs.size()), &inputPtrs[0], &inputPorts[0]);
}
filter->getProxy()->UpdateVTKObjects();
......
......@@ -133,7 +133,7 @@ void pqColorPaletteSelectorWidget::loadPalette(int index)
QString name = this->ComboBox->itemData(index).toString();
vtkSMSessionProxyManager* pxm = smproxy->GetSessionProxyManager();
vtkSMProxy* paletteProxy = pxm->GetPrototypeProxy("palettes", name.toLocal8Bit().data());
vtkSMProxy* paletteProxy = pxm->GetPrototypeProxy("palettes", name.toUtf8().data());
assert(paletteProxy);
smproxy->Copy(paletteProxy);
......
......@@ -271,7 +271,7 @@ void pqCommandLineOptionsBehavior::playTests()
// Play the test script if specified.
pqTestUtility* testUtility = pqApplicationCore::instance()->testUtility();
options->SetCurrentImageThreshold(options->GetTestImageThreshold(cc));
cout << "Playing: " << options->GetTestScript(cc).toLocal8Bit().data() << endl;
cout << "Playing: " << options->GetTestScript(cc).toUtf8().data() << endl;
success = testUtility->playTests(options->GetTestScript(cc));
if (success && !options->GetTestBaseline(cc).isEmpty())
......
......@@ -302,7 +302,7 @@ void pqDefaultContextMenu::colorMenuTriggered(QAction* action)
vtkSMProxy* oldLutProxy = vtkSMPropertyHelper(reprProxy, "LookupTable", true).GetAsProxy();
vtkSMPVRepresentationProxy::SetScalarColoring(
reprProxy, array.second.toLocal8Bit().data(), array.first);
reprProxy, array.second.toUtf8().data(), array.first);
vtkNew<vtkSMTransferFunctionManager> tmgr;
......
......@@ -138,7 +138,7 @@ QString pqExportReaction::exportActiveView()
{
QString filename = file_dialog.getSelectedFiles().first();
vtkSmartPointer<vtkSMExporterProxy> proxy;
proxy.TakeReference(helper->CreateExporter(filename.toLocal8Bit().data(), viewProxy));
proxy.TakeReference(helper->CreateExporter(filename.toUtf8().data(), viewProxy));
if (!proxy)
{
qCritical("Couldn't handle export filename");
......@@ -175,7 +175,7 @@ QString pqExportReaction::exportActiveView()
SM_SCOPED_TRACE(ExportView)
.arg("view", viewProxy)
.arg("exporter", proxy)
.arg("filename", filename.toLocal8Bit().data());
.arg("filename", filename.toUtf8().data());
proxy->Write();
return filename;
}
......
......@@ -182,7 +182,7 @@ pqExtractor* pqExtractorsMenuReaction::createExtractor(
auto view = activeObjects.activeView() ? activeObjects.activeView()->getProxy() : nullptr;
auto port =
activeObjects.activePort() ? activeObjects.activePort()->getOutputPortProxy() : nullptr;
auto prototype = pxm->GetPrototypeProxy(group.toLocal8Bit().data(), name.toLocal8Bit().data());
auto prototype = pxm->GetPrototypeProxy(group.toUtf8().data(), name.toUtf8().data());
vtkNew<vtkSMExtractsController> controller;
vtkSMProxy* input = nullptr;
......@@ -200,7 +200,7 @@ pqExtractor* pqExtractorsMenuReaction::createExtractor(
}
BEGIN_UNDO_SET(QString("Create Extract Generator '%1'").arg(name));
auto generator = controller->CreateExtractor(input, name.toLocal8Bit());
auto generator = controller->CreateExtractor(input, name.toUtf8());
END_UNDO_SET();
auto smmodel = pqApplicationCore::instance()->getServerManagerModel();
return generator ? smmodel->findItem<pqExtractor*>(generator) : nullptr;
......
......@@ -327,8 +327,7 @@ pqPipelineSource* pqFiltersMenuReaction::createFilter(
}
vtkSMSessionProxyManager* pxm = server->proxyManager();
vtkSMProxy* prototype =
pxm->GetPrototypeProxy(xmlgroup.toLocal8Bit().data(), xmlname.toLocal8Bit().data());
vtkSMProxy* prototype = pxm->GetPrototypeProxy(xmlgroup.toUtf8().data(), xmlname.toUtf8().data());
if (!prototype)
{
qCritical() << "Unknown proxy type: " << xmlname;
......@@ -366,7 +365,7 @@ pqPipelineSource* pqFiltersMenuReaction::createFilter(
// future to be smarter.
if (pqPipelineFilter::getRequiredInputPorts(prototype).size() > 1)
{
vtkSMProxy* filterProxy = pxm->GetPrototypeProxy("filters", xmlname.toLocal8Bit().data());
vtkSMProxy* filterProxy = pxm->GetPrototypeProxy("filters", xmlname.toUtf8().data());
vtkSMPropertyHelper helper(filterProxy, inputPortNames[0]);
helper.RemoveAllValues();
......
......@@ -126,14 +126,14 @@ void pqLoadPaletteReaction::actionTriggered(QAction* actn)
vtkSMProxy* paletteProxy = pxm->GetProxy("settings", "ColorPalette");
vtkSMProxy* palettePrototype = pxm->GetPrototypeProxy(
"palettes", actn->property("PV_XML_NAME").toString().toLocal8Bit().data());
vtkSMProxy* palettePrototype =
pxm->GetPrototypeProxy("palettes", actn->property("PV_XML_NAME").toString().toUtf8().data());
assert(palettePrototype);
BEGIN_UNDO_SET("Load color palette");
SM_SCOPED_TRACE(CallFunction)
.arg("LoadPalette")
.arg("paletteName", actn->property("PV_XML_NAME").toString().toLocal8Bit().data());
.arg("paletteName", actn->property("PV_XML_NAME").toString().toUtf8().data());
paletteProxy->Copy(palettePrototype);
paletteProxy->UpdateVTKObjects();
END_UNDO_SET();
......
......@@ -90,9 +90,9 @@ void pqLoadStateReaction::loadState(const QString& filename, bool dialogBlocked,
aproxy.TakeReference(pxm->NewProxy("options", "LoadStateOptions"));
vtkSMLoadStateOptionsProxy* proxy = vtkSMLoadStateOptionsProxy::SafeDownCast(aproxy);
vtkSMPropertyHelper(proxy, "DataDirectory")
.Set(vtksys::SystemTools::GetParentDirectory(filename.toLocal8Bit().data()).c_str());
.Set(vtksys::SystemTools::GetParentDirectory(filename.toUtf8().toStdString()).c_str());
if (proxy && proxy->PrepareToLoad(filename.toLocal8Bit().data()))
if (proxy && proxy->PrepareToLoad(filename.toUtf8().data()))
{
vtkNew<vtkSMParaViewPipelineController> controller;
controller->InitializeProxy(proxy);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment