From 2c73ccdf45212ab2a43582955be0eff21c70f971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Mon, 2 Nov 2020 22:33:43 +0100 Subject: Added controlled conversions to char* instead of automatic ascii conversions. The definition of -UTQT_NO_ASCII_CAST is no longer needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeLists.txt | 2 +- microbe/instruction.cpp | 6 +++--- microbe/main.cpp | 4 ++-- microbe/pic14.cpp | 2 +- src/itemdocument.cpp | 14 +++++++++----- src/itemdocumentdata.cpp | 4 ++-- src/ktechlab.cpp | 2 +- src/languages/language.cpp | 2 +- src/textdocument.cpp | 2 +- src/view.cpp | 4 ++-- src/viewcontainer.cpp | 8 ++++---- 11 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd0d6c1..899ea46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ include( ConfigureChecks.cmake ) ###### global compiler settings -add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST ) +add_definitions( -DHAVE_CONFIG_H ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) diff --git a/microbe/instruction.cpp b/microbe/instruction.cpp index 26332c0..2a77b98 100644 --- a/microbe/instruction.cpp +++ b/microbe/instruction.cpp @@ -517,8 +517,8 @@ bool RegisterState::operator == ( const RegisterState & state ) const void RegisterState::print() { - cout << " known="<arg(1)); - out << s; + out << s.local8Bit(); return 0; } } diff --git a/microbe/pic14.cpp b/microbe/pic14.cpp index 5c92ef3..1ac4c27 100644 --- a/microbe/pic14.cpp +++ b/microbe/pic14.cpp @@ -135,7 +135,7 @@ PIC14::Type PIC14::toType( const TQString & _text ) if ( text == "16F628" ) return P16F628; - cerr << TQString("%1 is not a known PIC identifier\n").arg(_text); + cerr << TQString("%1 is not a known PIC identifier\n").arg(_text).local8Bit(); return unknown; } diff --git a/src/itemdocument.cpp b/src/itemdocument.cpp index 9a73877..7ed27dd 100644 --- a/src/itemdocument.cpp +++ b/src/itemdocument.cpp @@ -811,7 +811,7 @@ void ItemDocument::exportToImage() // we need an object so we can retrieve which image type was selected by the user // so setup the filedialog. - KFileDialog exportDialog(TQString(), "*.png|PNG Image\n*.bmp|BMP Image\n*.svg|SVG Image" , p_ktechlab, i18n("Export As Image"), true, cropCheck); + KFileDialog exportDialog(TQString(), "*.png|PNG Image\n*.bmp|BMP Image\n*.svg|SVG Image" , p_ktechlab, i18n("Export As Image").utf8(), true, cropCheck); exportDialog.setOperationMode( KFileDialog::Saving ); // now actually show it @@ -911,21 +911,25 @@ void ItemDocument::exportToImage() if ( cropCheck->isChecked() ) { if( type == "SVG" ) - saveResult = dynamic_cast(outputImage)->save( url.path(), type); + saveResult = dynamic_cast(outputImage)->save(url.path(), type.utf8()); else { TQImage img = dynamic_cast(outputImage)->convertToImage(); img = img.copy(cropArea); - saveResult = img.save(url.path(),type); + saveResult = img.save(url.path(), type.utf8()); } } else { if ( type=="SVG" ) - saveResult = dynamic_cast(outputImage)->save( url.path(), type ); + { + saveResult = dynamic_cast(outputImage)->save(url.path(), type.utf8()); + } else - saveResult = dynamic_cast(outputImage)->save( url.path(), type ); + { + saveResult = dynamic_cast(outputImage)->save(url.path(), type.utf8()); + } } //if(saveResult == true) KMessageBox::information( this, i18n("Sucessfully exported to \"%1\"").arg( url.filename() ), i18n("Image Export") ); diff --git a/src/itemdocumentdata.cpp b/src/itemdocumentdata.cpp index c0efc5d..669d1c8 100644 --- a/src/itemdocumentdata.cpp +++ b/src/itemdocumentdata.cpp @@ -683,7 +683,7 @@ void ItemDocumentData::elementToConnectorData( TQDomElement element ) ConnectorData connectorData; - connectorData.manualRoute = element.attribute( "manual-route", "0" ); + connectorData.manualRoute = element.attribute("manual-route", "0").toInt(); TQString route = element.attribute( "route", "" ); TQStringList points = TQStringList::split( ",", route ); @@ -992,7 +992,7 @@ void ItemDocumentData::mergeWithDocument( ItemDocument *itemDocument, bool selec { if ( !it.data().type.isEmpty() && !itemDocument->itemWithID( it.key() ) ) { - Item *item = itemLibrary()->createItem( it.data().type, itemDocument, false, it.key(), false ); + Item *item = itemLibrary()->createItem(it.data().type, itemDocument, false, it.key().utf8(), false); if ( item && !itemDocument->isValidItem(item) ) { kdWarning() << "Attempted to create invalid item with id: " << it.key() << endl; diff --git a/src/ktechlab.cpp b/src/ktechlab.cpp index e0294e1..ff35a0e 100644 --- a/src/ktechlab.cpp +++ b/src/ktechlab.cpp @@ -592,7 +592,7 @@ void KTechlab::slotDragContextActivated( int id ) TDEAction * KTechlab::action( const TQString & name ) const { - TDEAction * action = actionCollection()->action(name); + TDEAction * action = actionCollection()->action(name.utf8()); if ( !action ) kdError() << k_funcinfo << "No such action: " << name << endl; return action; diff --git a/src/languages/language.cpp b/src/languages/language.cpp index 67afac4..2395ecb 100644 --- a/src/languages/language.cpp +++ b/src/languages/language.cpp @@ -27,7 +27,7 @@ //BEGIN class Language Language::Language( ProcessChain *processChain, KTechlab *parent, const TQString &name ) - : TQObject(parent,name) + : TQObject(parent, name.utf8()) { p_ktechlab = parent; p_processChain = processChain; diff --git a/src/textdocument.cpp b/src/textdocument.cpp index ae4bfe7..9de69e8 100644 --- a/src/textdocument.cpp +++ b/src/textdocument.cpp @@ -605,7 +605,7 @@ void TextDocument::slotUpdateMarksInfo() { TDEAction * a = new TDEAction( i18n("%1 - %2").arg( TQString::number( mark->line+1 ) ).arg( m_doc->textLine(mark->line) ), 0, this, TQT_SLOT(slotBookmarkRequested()), this, - TQString("bookmark_%1").arg(TQString::number(mark->line).ascii()) ); + TQString("bookmark_%1").arg(TQString::number(mark->line)).latin1() ); m_bookmarkActions.append(a); } } diff --git a/src/view.cpp b/src/view.cpp index 81f88b7..52d2417 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -61,7 +61,7 @@ class KVSSBSep : public TQWidget { //BEGIN class View View::View( Document *document, ViewContainer *viewContainer, uint viewAreaId, const char *name ) - : TQWidget( viewContainer->viewArea(viewAreaId), name ? name : (const char *)("view_" + TQString::number(viewAreaId)) ), + : TQWidget( viewContainer->viewArea(viewAreaId), name ? name : TQString("view_%1").arg(TQString::number(viewAreaId)).latin1() ), KXMLGUIClient() { m_dcopID = 0; @@ -103,7 +103,7 @@ View::~View() TDEAction * View::action( const TQString & name ) const { - TDEAction * action = actionCollection()->action(name); + TDEAction * action = actionCollection()->action(name.utf8()); if ( !action ) kdError() << k_funcinfo << "No such action: " << name << endl; return action; diff --git a/src/viewcontainer.cpp b/src/viewcontainer.cpp index 980eccb..594a473 100644 --- a/src/viewcontainer.cpp +++ b/src/viewcontainer.cpp @@ -412,8 +412,8 @@ ViewArea *ViewArea::createViewArea( Position position, uint id ) setOrientation( ( position == Right ) ? Qt::Horizontal : Qt::Vertical ); - p_viewArea1 = new ViewArea( this, p_viewContainer, m_id, (const char*)("viewarea_"+TQString::number(m_id)) ); - p_viewArea2 = new ViewArea( this, p_viewContainer, id, (const char*)("viewarea_"+TQString::number(id)) ); + p_viewArea1 = new ViewArea(this, p_viewContainer, m_id, TQString("viewarea_%1").arg(TQString::number(m_id)).latin1()); + p_viewArea2 = new ViewArea(this, p_viewContainer, id, TQString("viewarea_%1").arg(TQString::number(id)).latin1()); connect( p_viewArea1, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); connect( p_viewArea2, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); @@ -559,7 +559,7 @@ void ViewArea::restoreState( TDEConfig *config, int id, const TQString &groupNam if ( contains.size() >= 1 ) { int viewArea1Id = contains[0]; - p_viewArea1 = new ViewArea( this, p_viewContainer, viewArea1Id, (const char*)("viewarea_"+TQString::number(viewArea1Id)) ); + p_viewArea1 = new ViewArea(this, p_viewContainer, viewArea1Id, TQString("viewarea_%1").arg(TQString::number(viewArea1Id)).latin1()); connect( p_viewArea1, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); p_viewArea1->restoreState( config, viewArea1Id, groupName ); p_viewArea1->show(); @@ -568,7 +568,7 @@ void ViewArea::restoreState( TDEConfig *config, int id, const TQString &groupNam if ( contains.size() >= 2 ) { int viewArea2Id = contains[1]; - p_viewArea2 = new ViewArea( this, p_viewContainer, viewArea2Id, (const char*)("viewarea_"+TQString::number(viewArea2Id)) ); + p_viewArea2 = new ViewArea(this, p_viewContainer, viewArea2Id, TQString("viewarea_%1").arg(TQString::number(viewArea2Id)).latin1()); connect( p_viewArea2, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); p_viewArea2->restoreState( config, viewArea2Id, groupName ); p_viewArea2->show(); -- cgit v1.2.3