Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions UniversalIndentGUI.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TEMPLATE = app
QT += network
QT += script
QT += network \
script \
widgets \
printsupport

unix:TARGET = universalindentgui
win32:TARGET = UniversalIndentGUI
Expand All @@ -23,7 +25,7 @@ macx {
ICON = resources/UniversalIndentGUI.icns
}
else {
LIBS += -lqscintilla2
LIBS += -lqscintilla2_qt5
}

CONFIG(release, debug|release) {
Expand All @@ -37,10 +39,10 @@ macx:pipe2nul = "&> /dev/null"
##########################
message(Updating language files)
lupdate = lupdate
unix:lupdate = lupdate-qt4
unix:lupdate = lupdate-qt5
macx:lupdate = lupdate
lrelease = lrelease
unix:lrelease = lrelease-qt4
unix:lrelease = lrelease-qt5
macx:lrelease = lrelease
# Update translation files
message ( Updating universalindent.ts )
Expand Down
5 changes: 4 additions & 1 deletion UniversalIndentGUI_NPP.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
TEMPLATE = lib
CONFIG += plugin
QT += script
QT += network \
script \
widgets \
printsupport

TARGET = UniversalIndentGUI_NPP

Expand Down
2 changes: 1 addition & 1 deletion src/AboutDialogGraphicsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "AboutDialog.h"

#include <QtGui>
#include <QtWidgets>
#include <QDesktopWidget>
#include <QDate>
#include <QTimeLine>
Expand Down
32 changes: 16 additions & 16 deletions src/IndentHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ QString IndentHandler::callExecutableIndenter(QString sourceCode, QString inputF
delete [] buffer;

// Check whether the short path still contains some kind of non ascii characters.
if ( _tempDirctoryStr.length() != _tempDirctoryStr.toAscii().length() ) {
if ( _tempDirctoryStr.length() != _tempDirctoryStr.toLatin1().length() ) {
qWarning() << __LINE__ << " " << __FUNCTION__ << ": Shortened path still contains non ascii characters. Could cause some indenters not to work properly!";
}
}
Expand Down Expand Up @@ -705,7 +705,7 @@ void IndentHandler::saveConfigFile(QString filePathName, QString paramString) {
QFile cfgFile( filePathName );

cfgFile.open( QFile::ReadWrite | QFile::Text );
cfgFile.write( paramString.toAscii() );
cfgFile.write( paramString.toLatin1() );
cfgFile.close();
}

Expand Down Expand Up @@ -1497,21 +1497,21 @@ void IndentHandler::retranslateUi() {
_indenterSelectionCombobox->setToolTip( tr("<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body style=\" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\"><p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Shows the currently chosen indenters name and lets you choose other available indenters</p></body></html>") );
_indenterParameterHelpButton->setToolTip( tr("Brings you to the online manual of the currently selected indenter, where you can get further help on the possible parameters.") );

_actionLoadIndenterConfigFile->setText(QApplication::translate("IndentHandler", "Load Indenter Config File", 0, QApplication::UnicodeUTF8));
_actionLoadIndenterConfigFile->setStatusTip(QApplication::translate("IndentHandler", "Opens a file dialog to load the original config file of the indenter.", 0, QApplication::UnicodeUTF8));
_actionLoadIndenterConfigFile->setShortcut(QApplication::translate("IndentHandler", "Alt+O", 0, QApplication::UnicodeUTF8));
_actionLoadIndenterConfigFile->setText(QApplication::translate("IndentHandler", "Load Indenter Config File", 0));
_actionLoadIndenterConfigFile->setStatusTip(QApplication::translate("IndentHandler", "Opens a file dialog to load the original config file of the indenter.", 0));
_actionLoadIndenterConfigFile->setShortcut(QApplication::translate("IndentHandler", "Alt+O", 0));

_actionSaveIndenterConfigFile->setText(QApplication::translate("IndentHandler", "Save Indenter Config File", 0, QApplication::UnicodeUTF8));
_actionSaveIndenterConfigFile->setStatusTip(QApplication::translate("IndentHandler", "Opens a dialog to save the current indenter configuration to a file.", 0, QApplication::UnicodeUTF8));
_actionSaveIndenterConfigFile->setShortcut(QApplication::translate("IndentHandler", "Alt+S", 0, QApplication::UnicodeUTF8));
_actionSaveIndenterConfigFile->setText(QApplication::translate("IndentHandler", "Save Indenter Config File", 0));
_actionSaveIndenterConfigFile->setStatusTip(QApplication::translate("IndentHandler", "Opens a dialog to save the current indenter configuration to a file.", 0));
_actionSaveIndenterConfigFile->setShortcut(QApplication::translate("IndentHandler", "Alt+S", 0));

_actionCreateShellScript->setText(QApplication::translate("IndentHandler", "Create Indenter Call Shell Script", 0, QApplication::UnicodeUTF8));
_actionCreateShellScript->setToolTip(QApplication::translate("IndentHandler", "Create a shell script that calls the current selected indenter for formatting an as parameter given file with the current indent settings.", 0, QApplication::UnicodeUTF8));
_actionCreateShellScript->setStatusTip(QApplication::translate("IndentHandler", "Create a shell script that calls the current selected indenter for formatting an as parameter given file with the current indent settings.", 0, QApplication::UnicodeUTF8));
_actionCreateShellScript->setText(QApplication::translate("IndentHandler", "Create Indenter Call Shell Script", 0));
_actionCreateShellScript->setToolTip(QApplication::translate("IndentHandler", "Create a shell script that calls the current selected indenter for formatting an as parameter given file with the current indent settings.", 0));
_actionCreateShellScript->setStatusTip(QApplication::translate("IndentHandler", "Create a shell script that calls the current selected indenter for formatting an as parameter given file with the current indent settings.", 0));

_actionResetIndenterParameters->setText(QApplication::translate("IndentHandler", "Reset indenter parameters", 0, QApplication::UnicodeUTF8));
_actionResetIndenterParameters->setToolTip(QApplication::translate("IndentHandler", "Resets all indenter parameters to the default values.", 0, QApplication::UnicodeUTF8));
_actionResetIndenterParameters->setStatusTip(QApplication::translate("IndentHandler", "Resets all indenter parameters to the default values.", 0, QApplication::UnicodeUTF8));
_actionResetIndenterParameters->setText(QApplication::translate("IndentHandler", "Reset indenter parameters", 0));
_actionResetIndenterParameters->setToolTip(QApplication::translate("IndentHandler", "Resets all indenter parameters to the default values.", 0));
_actionResetIndenterParameters->setStatusTip(QApplication::translate("IndentHandler", "Resets all indenter parameters to the default values.", 0));
}


Expand Down Expand Up @@ -1564,7 +1564,7 @@ void IndentHandler::saveasIndentCfgFileDialog() {
QFile::remove(fileName);
QFile outCfgFile(fileName);
outCfgFile.open( QFile::ReadWrite | QFile::Text );
outCfgFile.write( getParameterString().toAscii() );
outCfgFile.write( getParameterString().toLatin1() );
outCfgFile.close();
}
}
Expand Down Expand Up @@ -1608,7 +1608,7 @@ void IndentHandler::createIndenterCallShellScript() {
// Replace placeholder for script name in script template.
indenterCallShellScript = indenterCallShellScript.replace( "__INDENTERCALLSTRINGSCRIPTNAME__", QFileInfo(shellScriptFileName).fileName() );

outSrcFile.write( indenterCallShellScript.toAscii() );
outSrcFile.write( indenterCallShellScript.toLatin1() );
#if !defined(Q_OS_WIN32)
// For none Windows systems set the files executable flag
outSrcFile.setPermissions( outSrcFile.permissions() | QFile::ExeOwner | QFile::ExeUser| QFile::ExeGroup );
Expand Down
13 changes: 7 additions & 6 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <QUrl>
#include <QMessageBox>
#include <QtDebug>
#include <QMimeData>

#include <Qsci/qsciscintilla.h>
#include <Qsci/qsciprinter.h>
Expand Down Expand Up @@ -410,7 +411,7 @@ QString MainWindow::loadFile(QString filePath) {
else {
QTextStream inSrcStrm(&inSrcFile);
QApplication::setOverrideCursor(Qt::WaitCursor);
inSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toAscii()) );
inSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toLatin1()) );
fileContent = inSrcStrm.readAll();
QApplication::restoreOverrideCursor();
inSrcFile.close();
Expand Down Expand Up @@ -502,7 +503,7 @@ bool MainWindow::saveasSourceFileDialog(QAction *chosenEncodingAction) {
encoding = _encodingActionGroup->checkedAction()->text();
}
QTextStream outSrcStrm(&outSrcFile);
outSrcStrm.setCodec( QTextCodec::codecForName(encoding.toAscii()) );
outSrcStrm.setCodec( QTextCodec::codecForName(encoding.toLatin1()) );
outSrcStrm << _savedSourceContent;
outSrcFile.close();

Expand Down Expand Up @@ -536,7 +537,7 @@ bool MainWindow::saveSourceFile() {
// Get current encoding.
QString _currentEncoding = _encodingActionGroup->checkedAction()->text();
QTextStream outSrcStrm(&outSrcFile);
outSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toAscii()) );
outSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toLatin1()) );
outSrcStrm << _savedSourceContent;
outSrcFile.close();

Expand Down Expand Up @@ -681,7 +682,7 @@ void MainWindow::sourceCodeChangedSlot() {
updateSourceView();

if ( _toolBarWidget->cbLivePreview->isChecked() && !enteredCharacter.isNull() && enteredCharacter != 10 ) {
//const char ch = enteredCharacter.toAscii();
//const char ch = enteredCharacter.toLatin1();

int saveCursorLine = cursorLine;
int saveCursorPos = cursorPos;
Expand Down Expand Up @@ -899,7 +900,7 @@ void MainWindow::exportToHTML() {
QFile::remove(fileName);
QFile outSrcFile(fileName);
outSrcFile.open( QFile::ReadWrite | QFile::Text );
outSrcFile.write( sourceCodeAsHTML.toAscii() );
outSrcFile.write( sourceCodeAsHTML.toLatin1() );
outSrcFile.close();
}
}
Expand Down Expand Up @@ -1139,7 +1140,7 @@ void MainWindow::encodingChanged(QAction* encodingAction) {
QApplication::setOverrideCursor(Qt::WaitCursor);
QString encodingName = encodingAction->text();
_currentEncoding = encodingName;
inSrcStrm.setCodec( QTextCodec::codecForName(encodingName.toAscii()) );
inSrcStrm.setCodec( QTextCodec::codecForName(encodingName.toLatin1()) );
fileContent = inSrcStrm.readAll();
QApplication::restoreOverrideCursor();
inSrcFile.close();
Expand Down
2 changes: 1 addition & 1 deletion src/SettingsPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void SettingsPaths::init() {
// to an important existing file which gets overwritten when UiGUI writes
// into this normally temporary but linked file.
char *pathTemplate = new char[_tempPath.length()+8];
QByteArray pathTemplateQBA = QString(_tempPath + "-XXXXXX").toAscii();
QByteArray pathTemplateQBA = QString(_tempPath + "-XXXXXX").toLatin1();
delete [] pathTemplate;
pathTemplate = pathTemplateQBA.data();
pathTemplate = mkdtemp( pathTemplate );
Expand Down
4 changes: 2 additions & 2 deletions src/UiGuiSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ bool UiGuiSettings::registerObjectProperty( QObject *obj, const QString &propert
QMetaMethod signal = mProp.notifySignal();
//QString teststr = qPrintable(SIGNAL() + QString(signal.signature()));
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = connect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
connectSuccess = connect(obj, qPrintable(SIGNAL() + QString(signal.methodSignature())), this, SLOT(handleObjectPropertyChange()));
}

if ( connectSuccess ) {
Expand Down Expand Up @@ -397,7 +397,7 @@ void UiGuiSettings::unregisterObjectProperty(QObject *obj) {
if ( mProp.hasNotifySignal() ) {
QMetaMethod signal = mProp.notifySignal();
// The command "SIGNAL() + QString(signal.signature())" assembles the signal methods signature to a valid Qt SIGNAL.
connectSuccess = disconnect(obj, qPrintable(SIGNAL() + QString(signal.signature())), this, SLOT(handleObjectPropertyChange()));
connectSuccess = disconnect(obj, qPrintable(SIGNAL() + QString(signal.methodSignature())), this, SLOT(handleObjectPropertyChange()));
}
}
_registeredObjectProperties.remove(obj);
Expand Down
8 changes: 4 additions & 4 deletions src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ BOOL APIENTRY DllMain( HANDLE hModule, DWORD reasonForCall, LPVOID lpReserved )
// Force creation of an UiGuiLogger instance here, to avoid recursion with SettingsPaths init function.
UiGuiLogger::getInstance();
qInstallMsgHandler( UiGuiLogger::messageHandler );
UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii() );
UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii() );
UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toLatin1() );
UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toLatin1() );

#ifdef _DEBUG
UiGuiLogger::getInstance()->setVerboseLevel(0);
Expand Down Expand Up @@ -307,7 +307,7 @@ void indentText() {

QString indentedText = indentHandler->callIndenter(fullEditorText, "cpp");

QByteArray indentedTextByteArray = indentedText.toAscii();
QByteArray indentedTextByteArray = indentedText.toLatin1();

// Set whole text.
::SendMessage(getCurrentHScintilla(currentEdit), SCI_SETTEXT, 0, (LPARAM)indentedTextByteArray.constData());
Expand All @@ -327,7 +327,7 @@ void indentText() {

QString indentedText = indentHandler->callIndenter(fullEditorText, "cpp");

QByteArray indentedTextByteArray = indentedText.toAscii();
QByteArray indentedTextByteArray = indentedText.toLatin1();

// Replace selected text.
::SendMessage(getCurrentHScintilla(currentEdit), SCI_REPLACESEL, 0, (LPARAM)indentedTextByteArray.constData());
Expand Down
9 changes: 2 additions & 7 deletions src/debugging/TSLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TSLogger::TSLogger(int verboseLevel) : QDialog() {

Only messages whos \a type have a higher priority than the set verbose level are logged.
*/
void TSLogger::messageHandler(QtMsgType type, const char *msg) {
void TSLogger::messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
if ( _instance == NULL )
_instance = TSLogger::getInstance();

Expand Down Expand Up @@ -131,15 +131,10 @@ void TSLogger::messageHandler(QtMsgType type, const char *msg) {
break;
case QtFatalMsg :
message += " <span style=\"font-weight:bold; color:#D60000;\">Fatal:</span> ";
// This one is no Qt message type, but can be used to send info messages to the log
// by calling TSLogger::messageHandler() directly.
case TSLoggerInfoMsg :
message += " <span style=\"font-weight:bold; color:darkgray;\">Info:</span> ";
break;
}

// Append the to UTF-8 back converted message parameter.
message += QString::fromUtf8( msg ) + "<br/>\n";
message += msg + "<br/>\n";

// Write the message to the log windows text edit.
_instance->_TSLoggerDialogForm->logTextEdit->append( message );
Expand Down
2 changes: 1 addition & 1 deletion src/debugging/TSLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TSLogger : public QDialog
public:
static TSLogger* getInstance(int verboseLevel);
static TSLogger* getInstance();
static void messageHandler(QtMsgType type, const char *msg);
static void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg);
static void deleteInstance();
void setVerboseLevel(int level);

Expand Down
7 changes: 3 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,16 @@ int main(int argc, char *argv[]) {

// Init and install the logger function.
// Setting UTF-8 as default 8-Bit encoding to ensure that qDebug does no false string conversion.
QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") );
QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") );
// Force creation of an TSLogger instance here, to avoid recursion with SettingsPaths init function.
#ifdef _DEBUG
TSLogger::getInstance(0);
#else
TSLogger::getInstance(verboseLevel);
#endif
qInstallMsgHandler( TSLogger::messageHandler );
TSLogger::messageHandler( TSLoggerInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii() );
TSLogger::messageHandler( TSLoggerInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii() );
qInstallMessageHandler( TSLogger::messageHandler );
qInfo() << QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toLatin1();
qInfo() << QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toLatin1();

// Set default values for all by UniversalIndentGUI used settings objects.
QCoreApplication::setOrganizationName("UniversalIndentGUI");
Expand Down