Skip to content

Commit

Permalink
Fix remaining toAscii/fromAscii
Browse files Browse the repository at this point in the history
Qt5 does not have toAscii or fromAscii.  Use toLatin1 and fromLatin1
respectively.  Both replacement functions exist in Qt4.8.
  • Loading branch information
maurerpe authored and wwmayer committed Feb 24, 2016
1 parent e1f3fe1 commit 3f3d8a9
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion src/Gui/ProgressDialog.cpp
Expand Up @@ -195,7 +195,7 @@ void SequencerDialog::showRemainingTime()
QTime time( 0,0, 0);
time = time.addSecs( rest/1000 );
QString remain = Gui::ProgressDialog::tr("Remaining: %1").arg(time.toString());
QString status = QString::fromAscii("%1\t[%2]").arg(txt).arg(remain);
QString status = QString::fromLatin1("%1\t[%2]").arg(txt).arg(remain);

if (thr != currentThread) {
QMetaObject::invokeMethod(d->dlg, "setLabelText",
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sandbox/App/DocumentThread.cpp
Expand Up @@ -53,7 +53,7 @@ void DocumentThread::run()
{
App::Document* doc = App::GetApplication().getActiveDocument();
DocumentProtector dp(doc);
dp.addObject("Mesh::Ellipsoid", (const char*)objectName().toAscii());
dp.addObject("Mesh::Ellipsoid", (const char*)objectName().toLatin1());
dp.recompute();
}

Expand Down
34 changes: 17 additions & 17 deletions src/Mod/Sandbox/Gui/Command.cpp
Expand Up @@ -100,7 +100,7 @@ void CmdSandboxDocumentThread::activated(int iMsg)
App::GetApplication().newDocument("Thread");
for (int i=0; i<5; i++) {
Sandbox::DocumentThread* dt = new Sandbox::DocumentThread();
dt->setObjectName(QString::fromAscii("MyMesh_%1").arg(i));
dt->setObjectName(QString::fromLatin1("MyMesh_%1").arg(i));
QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater()));
dt->start();
}
Expand Down Expand Up @@ -178,7 +178,7 @@ void CmdSandboxDocThreadWithSeq::activated(int iMsg)
{
App::GetApplication().newDocument("Thread");
Sandbox::DocumentThread* dt = new Sandbox::DocumentThread();
dt->setObjectName(QString::fromAscii("MyMesh"));
dt->setObjectName(QString::fromLatin1("MyMesh"));
QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater()));
dt->start();
#ifdef FC_DEBUG
Expand Down Expand Up @@ -217,7 +217,7 @@ void CmdSandboxDocThreadBusy::activated(int iMsg)
{
App::GetApplication().newDocument("Thread");
Sandbox::DocumentThread* dt = new Sandbox::DocumentThread();
dt->setObjectName(QString::fromAscii("MyMesh"));
dt->setObjectName(QString::fromLatin1("MyMesh"));
QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater()));
dt->start();
#ifdef FC_DEBUG
Expand Down Expand Up @@ -410,7 +410,7 @@ void CmdSandboxPythonThread::activated(int iMsg)
App::GetApplication().newDocument("Thread");
for (int i=0; i<5; i++) {
Sandbox::PythonThread* pt = new Sandbox::PythonThread();
pt->setObjectName(QString::fromAscii("MyMesh_%1").arg(i));
pt->setObjectName(QString::fromLatin1("MyMesh_%1").arg(i));
QObject::connect(pt, SIGNAL(finished()), pt, SLOT(deleteLater()));
pt->start();
}
Expand Down Expand Up @@ -462,7 +462,7 @@ void CmdSandboxDocThreadWithDialog::activated(int iMsg)
{
App::GetApplication().newDocument("Thread");
Sandbox::DocumentThread* dt = new Sandbox::DocumentThread();
dt->setObjectName(QString::fromAscii("MyMesh"));
dt->setObjectName(QString::fromLatin1("MyMesh"));
QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater()));
dt->start();
//QFileDialog::getOpenFileName();
Expand All @@ -489,7 +489,7 @@ void CmdSandboxDocThreadWithFileDlg::activated(int iMsg)
{
App::GetApplication().newDocument("Thread");
Sandbox::DocumentThread* dt = new Sandbox::DocumentThread();
dt->setObjectName(QString::fromAscii("MyMesh"));
dt->setObjectName(QString::fromLatin1("MyMesh"));
QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater()));
dt->start();
QFileDialog::getOpenFileName();
Expand Down Expand Up @@ -1014,9 +1014,9 @@ class RenderArea : public QWidget
painter.drawPath(path);
painter.setPen(Qt::white);
painter.drawText(25, 40, 70, 20, Qt::AlignHCenter|Qt::AlignVCenter,
QString::fromAscii("Distance: 2.784mm"));
QString::fromLatin1("Distance: 2.784mm"));
//QPainterPath text;
//text.addText(25,55,QFont(), QString::fromAscii("Distance"));
//text.addText(25,55,QFont(), QString::fromLatin1("Distance"));
//painter.setBrush(QBrush(Qt::white, Qt::SolidPattern));
//painter.drawPath(text);
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@ CmdTestImageNode::CmdTestImageNode()

void CmdTestImageNode::activated(int iMsg)
{
QString text = QString::fromAscii("Distance: 2.7jgiorjgor84mm");
QString text = QString::fromLatin1("Distance: 2.7jgiorjgor84mm");
QFont font;
QFontMetrics fm(font);
int w = fm.width(text);
Expand Down Expand Up @@ -1168,10 +1168,10 @@ void CmdTestRedirectPaint::activated(int iMsg)
QCalendarWidget* cal = new QCalendarWidget();
QLabel* label = new QLabel();
QPainter::setRedirected(cal,label);
cal->setWindowTitle(QString::fromAscii("QCalendarWidget"));
cal->setWindowTitle(QString::fromLatin1("QCalendarWidget"));
cal->show();
label->show();
label->setWindowTitle(QString::fromAscii("QLabel"));
label->setWindowTitle(QString::fromLatin1("QLabel"));
}

//===========================================================================
Expand All @@ -1193,7 +1193,7 @@ void CmdTestCryptographicHash::activated(int iMsg)
{
QByteArray data = "FreeCAD";
QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5);
QMessageBox::information(0,QLatin1String("Hash of: FreeCAD"),QString::fromAscii(hash));
QMessageBox::information(0,QLatin1String("Hash of: FreeCAD"),QString::fromLatin1(hash));
}

//===========================================================================
Expand Down Expand Up @@ -1353,13 +1353,13 @@ void CmdMengerSponge::activated(int iMsg)
{
bool ok;
int level = QInputDialog::getInteger(Gui::getMainWindow(),
QString::fromAscii("Menger sponge"),
QString::fromAscii("Recursion depth:"),
QString::fromLatin1("Menger sponge"),
QString::fromLatin1("Recursion depth:"),
3, 1, 5, 1, &ok);
if (!ok) return;
int ret = QMessageBox::question(Gui::getMainWindow(),
QString::fromAscii("Parallel"),
QString::fromAscii("Do you want to run this in a thread pool?"),
QString::fromLatin1("Parallel"),
QString::fromLatin1("Do you want to run this in a thread pool?"),
QMessageBox::Yes|QMessageBox::No);
bool parallel=(ret == QMessageBox::Yes);
float x0=0,y0=0,z0=0;
Expand Down Expand Up @@ -1405,7 +1405,7 @@ CmdTestGraphicsView::CmdTestGraphicsView()
void CmdTestGraphicsView::activated(int iMsg)
{
Gui::GraphicsView3D* view3D = new Gui::GraphicsView3D(getActiveGuiDocument(), Gui::getMainWindow());
view3D->setWindowTitle(QString::fromAscii("Graphics scene"));
view3D->setWindowTitle(QString::fromLatin1("Graphics scene"));
view3D->setWindowIcon(QApplication::windowIcon());
view3D->resize(400, 300);
Gui::getMainWindow()->addWindow(view3D);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sandbox/Gui/GLGraphicsView.cpp
Expand Up @@ -265,7 +265,7 @@ void GraphicsScene::drawBackground(QPainter *painter, const QRectF &)

painter->save();
painter->fillRect(40,40,40,60,Qt::lightGray);
painter->drawText(50,50, QString::fromAscii("Done with QPainter"));
painter->drawText(50,50, QString::fromLatin1("Done with QPainter"));
painter->restore();

QTimer::singleShot(20, this, SLOT(update()));
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Sandbox/Gui/Overlay.cpp
Expand Up @@ -59,7 +59,7 @@ class MyPaintable : public Gui::GLGraphicsItem
{
QPainter p(&img);
p.setPen(Qt::white);
p.drawText(200,200,QString::fromAscii("Render to QImage"));
p.drawText(200,200,QString::fromLatin1("Render to QImage"));
}

img = QGLWidget::convertToGLFormat(img);
Expand All @@ -70,7 +70,7 @@ class MyPaintable : public Gui::GLGraphicsItem
{
QPainter p(fbo);
p.setPen(Qt::white);
p.drawText(200,200,QString::fromAscii("Render to QGLFramebufferObject"));
p.drawText(200,200,QString::fromLatin1("Render to QGLFramebufferObject"));
p.end();
//img = fbo->toImage();
//img = QGLWidget::convertToGLFormat(img);
Expand Down Expand Up @@ -498,7 +498,7 @@ void DrawingPlane::terminate()
SoGLRenderAction a(SbViewportRegion(128,128));
a.apply(_pcView3D->getSoRenderManager()->getSceneGraph());
fbo->release();
fbo->toImage().save(QString::fromAscii("C:/Temp/DrawingPlane.png"));
fbo->toImage().save(QString::fromLatin1("C:/Temp/DrawingPlane.png"));
delete fbo;
}

Expand Down
76 changes: 38 additions & 38 deletions src/Mod/Sandbox/Gui/TaskPanelView.cpp
Expand Up @@ -388,62 +388,62 @@ TaskPanelView::TaskPanelView(QWidget *parent)
tabWidget->addTab(page1, QLatin1String("Action Box"));

// setup ActionBox 1
ui->ActionBox1->setIcon(QPixmap(QString::fromAscii(":/icons/document-open.svg")));
ui->ActionBox1->header()->setText(QString::fromAscii("Header of the group"));
ui->ActionBox1->setIcon(QPixmap(QString::fromLatin1(":/icons/document-open.svg")));
ui->ActionBox1->header()->setText(QString::fromLatin1("Header of the group"));
connect(ui->ActionBox1->header(), SIGNAL(clicked()), action, SIGNAL(triggered()));

QSint::ActionLabel *a1 = ui->ActionBox1->createItem(QString::fromAscii("This action has no icon"));
QSint::ActionLabel *a1 = ui->ActionBox1->createItem(QString::fromLatin1("This action has no icon"));
connect(a1, SIGNAL(clicked()), action, SIGNAL(triggered()));
QSint::ActionLabel *a2 = ui->ActionBox1->createItem(QPixmap(QString::fromAscii(":/icons/document-print.svg")),
QString::fromAscii("This action has icon"));
QSint::ActionLabel *a2 = ui->ActionBox1->createItem(QPixmap(QString::fromLatin1(":/icons/document-print.svg")),
QString::fromLatin1("This action has icon"));
connect(a2, SIGNAL(clicked()), action, SIGNAL(triggered()));

QLayout *hbl1 = ui->ActionBox1->createHBoxLayout();
QSint::ActionLabel *a3 = ui->ActionBox1->createItem(QString::fromAscii("1st action in row"), hbl1);
QSint::ActionLabel *a3 = ui->ActionBox1->createItem(QString::fromLatin1("1st action in row"), hbl1);
connect(a3, SIGNAL(clicked()), action, SIGNAL(triggered()));
QSint::ActionLabel *a4 = ui->ActionBox1->createItem(QString::fromAscii("2nd action in row"), hbl1);
QSint::ActionLabel *a4 = ui->ActionBox1->createItem(QString::fromLatin1("2nd action in row"), hbl1);
connect(a4, SIGNAL(clicked()), action, SIGNAL(triggered()));

// setup ActionBox 2
ui->ActionBox2->setIcon(QPixmap(QString::fromAscii(":/icons/document-save.png")));
ui->ActionBox2->header()->setText(QString::fromAscii("Checkable actions allowed"));
ui->ActionBox2->setIcon(QPixmap(QString::fromLatin1(":/icons/document-save.png")));
ui->ActionBox2->header()->setText(QString::fromLatin1("Checkable actions allowed"));
connect(ui->ActionBox2->header(), SIGNAL(clicked()), action, SIGNAL(triggered()));

QSint::ActionLabel *b1 = ui->ActionBox2->createItem(QString::fromAscii("Action 1 (Exclusive)"));
QSint::ActionLabel *b1 = ui->ActionBox2->createItem(QString::fromLatin1("Action 1 (Exclusive)"));
b1->setCheckable(true);
b1->setAutoExclusive(true);
b1->setChecked(true);
QSint::ActionLabel *b2 = ui->ActionBox2->createItem(QString::fromAscii("Action 2 (Exclusive)"));
QSint::ActionLabel *b2 = ui->ActionBox2->createItem(QString::fromLatin1("Action 2 (Exclusive)"));
b2->setCheckable(true);
b2->setAutoExclusive(true);
QSint::ActionLabel *b3 = ui->ActionBox2->createItem(QString::fromAscii("Action 3 (Exclusive)"));
QSint::ActionLabel *b3 = ui->ActionBox2->createItem(QString::fromLatin1("Action 3 (Exclusive)"));
b3->setCheckable(true);
b3->setAutoExclusive(true);

QSint::ActionLabel *b4 = ui->ActionBox2->createItem(QString::fromAscii("Non-exclusive but still checkable"));
QSint::ActionLabel *b4 = ui->ActionBox2->createItem(QString::fromLatin1("Non-exclusive but still checkable"));
b4->setCheckable(true);

// setup ActionBox 3
ui->ActionBox3->setIcon(QPixmap(QString::fromAscii(":/icons/document-print.png")));
ui->ActionBox3->header()->setText(QString::fromAscii("Also, widgets allowed as well"));
ui->ActionBox3->setIcon(QPixmap(QString::fromLatin1(":/icons/document-print.png")));
ui->ActionBox3->header()->setText(QString::fromLatin1("Also, widgets allowed as well"));

ui->ActionBox3->addWidget(new QPushButton(QString::fromAscii("PushButton"), this));
ui->ActionBox3->addWidget(new QCheckBox(QString::fromAscii("CheckBox"), this));
ui->ActionBox3->addWidget(new QPushButton(QString::fromLatin1("PushButton"), this));
ui->ActionBox3->addWidget(new QCheckBox(QString::fromLatin1("CheckBox"), this));
QLayout *hbl3 = ui->ActionBox3->createHBoxLayout();
ui->ActionBox3->addWidget(new QRadioButton(QString::fromAscii("RadioButton 1"), this), hbl3);
ui->ActionBox3->addWidget(new QRadioButton(QString::fromAscii("RadioButton 2"), this), hbl3);
ui->ActionBox3->addWidget(new QRadioButton(QString::fromLatin1("RadioButton 1"), this), hbl3);
ui->ActionBox3->addWidget(new QRadioButton(QString::fromLatin1("RadioButton 2"), this), hbl3);

// setup ActionBox 4
ui->ActionBox4->setIcon(QPixmap(QString::fromAscii(":/icons/document-open.png")));
ui->ActionBox4->header()->setText(QString::fromAscii("ActionBox with different scheme"));
ui->ActionBox4->setIcon(QPixmap(QString::fromLatin1(":/icons/document-open.png")));
ui->ActionBox4->header()->setText(QString::fromLatin1("ActionBox with different scheme"));

ui->ActionBox4->createItem(QString::fromAscii("This action has no icon"));
ui->ActionBox4->createItem(QPixmap(QString::fromAscii(":/icons/document-print.png")),
QString::fromAscii("This action has icon"));
ui->ActionBox4->createItem(QString::fromLatin1("This action has no icon"));
ui->ActionBox4->createItem(QPixmap(QString::fromLatin1(":/icons/document-print.png")),
QString::fromLatin1("This action has icon"));
QLayout *hbl4 = ui->ActionBox4->createHBoxLayout();
ui->ActionBox4->createItem(QString::fromAscii("1st action in row"), hbl4);
ui->ActionBox4->createItem(QString::fromAscii("2nd action in row"), hbl4);
ui->ActionBox4->createItem(QString::fromAscii("3rd action in row"), hbl4);
ui->ActionBox4->createItem(QString::fromLatin1("1st action in row"), hbl4);
ui->ActionBox4->createItem(QString::fromLatin1("2nd action in row"), hbl4);
ui->ActionBox4->createItem(QString::fromLatin1("3rd action in row"), hbl4);

const char* ActionBoxNewStyle =
"QSint--ActionBox {"
Expand Down Expand Up @@ -490,17 +490,17 @@ TaskPanelView::TaskPanelView(QWidget *parent)
"}"
;

ui->ActionBox4->setStyleSheet(QString::fromAscii(ActionBoxNewStyle));
ui->ActionBox4->setStyleSheet(QString::fromLatin1(ActionBoxNewStyle));

// setup ActionBox 5
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
ui->ActionBox5->setIcon(QPixmap(QString::fromAscii(":/icons/document-save.png")));
ui->ActionBox5->header()->setText(QString::fromAscii("TaskGroup with different scheme"));
ui->ActionBox5->setIcon(QPixmap(QString::fromLatin1(":/icons/document-save.png")));
ui->ActionBox5->header()->setText(QString::fromLatin1("TaskGroup with different scheme"));

rcCmdMgr.addTo("Std_New", ui->ActionBox5);
rcCmdMgr.addTo("Std_Open", ui->ActionBox5);
rcCmdMgr.addTo("Std_Save", ui->ActionBox5);
ui->ActionBox5->setStyleSheet(QString::fromAscii(ActionBoxNewStyle));
ui->ActionBox5->setStyleSheet(QString::fromLatin1(ActionBoxNewStyle));
}
{
Ui_TaskGroup* ui(new Ui_TaskGroup);
Expand All @@ -512,22 +512,22 @@ TaskPanelView::TaskPanelView(QWidget *parent)

// create ActionGroups on ActionPanel
QIcon save = QIcon::fromTheme(QString::fromLatin1("document-save"));
QSint::ActionGroup *group1 = ui->ActionPanel->createGroup(save.pixmap(24,24), QString::fromAscii("Expandable Group"));
QSint::ActionGroup *group1 = ui->ActionPanel->createGroup(save.pixmap(24,24), QString::fromLatin1("Expandable Group"));
group1->addAction(ui->actionNew);
group1->addAction(ui->actionLoad);
group1->addWidget(new QPushButton(QString::fromAscii("Just a button"), this));
group1->addWidget(new QPushButton(QString::fromLatin1("Just a button"), this));
group1->addAction(ui->actionSave);
group1->addAction(ui->actionPrint);
group1->addWidget(new QPushButton(QString::fromAscii("Just another button"), this));
group1->addWidget(new QPushButton(QString::fromLatin1("Just another button"), this));

QIcon redo = QIcon::fromTheme(QString::fromLatin1("edit-redo"));
QSint::ActionGroup *group2 = ui->ActionPanel->createGroup(redo.pixmap(24,24), QString::fromAscii("Non-Expandable Group"), false);
QSint::ActionGroup *group2 = ui->ActionPanel->createGroup(redo.pixmap(24,24), QString::fromLatin1("Non-Expandable Group"), false);
group2->addAction(ui->actionNew);
group2->addAction(ui->actionLoad);
group2->addAction(ui->actionSave);
group2->addAction(ui->actionPrint);

ui->ActionPanel->addWidget(new QLabel(QString::fromAscii("Action Group without header"), this));
ui->ActionPanel->addWidget(new QLabel(QString::fromLatin1("Action Group without header"), this));

QSint::ActionGroup *group3 = ui->ActionPanel->createGroup();
group3->addAction(ui->actionNew);
Expand Down Expand Up @@ -585,7 +585,7 @@ TaskPanelView::TaskPanelView(QWidget *parent)
QGridLayout* gridLayout = new QGridLayout(this);
iisTaskPanel *taskPanel = new iisTaskPanel(this);
iisTaskBox *tb1 = new iisTaskBox(
QPixmap(QString::fromAscii(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this);
QPixmap(QString::fromLatin1(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this);
taskPanel->addWidget(tb1);
gridLayout->addWidget(taskPanel, 0, 0, 2, 1);

Expand Down Expand Up @@ -678,7 +678,7 @@ TaskPanelView::~TaskPanelView()

void TaskPanelView::executeAction()
{
QMessageBox::about(0, QString::fromAscii("Action clicked"), QString::fromAscii("Do something here :)"));
QMessageBox::about(0, QString::fromLatin1("Action clicked"), QString::fromLatin1("Do something here :)"));
}

void TaskPanelView::on_rbDefaultScheme_toggled(bool b)
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Sandbox/Gui/Workbench.cpp
Expand Up @@ -51,7 +51,7 @@ Workbench::Workbench()
{
// Tree view
Gui::DockWindow* tree = new Gui::DockWindow(0, Gui::getMainWindow());
tree->setWindowTitle(QString::fromAscii("Tree view"));
tree->setWindowTitle(QString::fromLatin1("Tree view"));
Gui::TreeView* treeWidget = new Gui::TreeView(tree);
treeWidget->setRootIsDecorated(false);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView");
Expand All @@ -63,7 +63,7 @@ Workbench::Workbench()
pLayout->addWidget(treeWidget, 0, 0);

tree->setObjectName
(QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Tree view (MVC)")));
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Tree view (MVC)")));
tree->setMinimumWidth(210);
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
pDockMgr->registerDockWindow("Std_TreeViewMVC", tree);
Expand Down

0 comments on commit 3f3d8a9

Please sign in to comment.