Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #38 from macgitver/sacu/repoman-extracts
Browse files Browse the repository at this point in the history
Extracts from the RepoMan branch
  • Loading branch information
antis81 committed May 15, 2015
2 parents 45ccaef + 84ec9a6 commit 50a82f4
Show file tree
Hide file tree
Showing 135 changed files with 578 additions and 580 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENDIF()

IF(UNIX)
GCC_ADD_FLAG("-Wall")
GCC_ADD_FLAG("-W")
GCC_ADD_FLAG("-fvisibility=hidden")
GCC_ADD_FLAG("-fvisibility-inlines-hidden")
ENDIF()
Expand Down
6 changes: 3 additions & 3 deletions CfgComp/CfgComp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ int main( int argc, char** argv )

ConfigSection sect( doc.documentElement() );

WriteClassSource wcs( outputFileDir % sect.className() % QLatin1String( ".cpp" ),
sect.className() % QLatin1String( ".hpp" ), sect );
WriteClassSource wcs( outputFileDir % sect.className() % QStringLiteral( ".cpp" ),
sect.className() % QStringLiteral( ".hpp" ), sect );
wcs.generate();

WriteClassHeader wch( outputFileDir % sect.className() % QLatin1String( ".hpp" ), sect );
WriteClassHeader wch( outputFileDir % sect.className() % QStringLiteral( ".hpp" ), sect );
wch.generate();

return 0;
Expand Down
34 changes: 17 additions & 17 deletions CfgComp/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ ConfigSetting::ConfigSetting( QDomElement el, ConfigSubSection* parent )
{
mSubSection = parent;

mName = el.attribute( QLatin1String( "Name" ) );
mDefaultValue = el.attribute( QLatin1String( "Default" ), QString() );
mType = el.attribute( QLatin1String( "Type" ) );
mSubType = el.attribute( QLatin1String( "Subtype" ), QString() );
mValidatorRule = el.attribute( QLatin1String( "Validate" ), QString() );
mName = el.attribute( QStringLiteral( "Name" ) );
mDefaultValue = el.attribute( QStringLiteral( "Default" ), QString() );
mType = el.attribute( QStringLiteral( "Type" ) );
mSubType = el.attribute( QStringLiteral( "Subtype" ), QString() );
mValidatorRule = el.attribute( QStringLiteral( "Validate" ), QString() );

mEmitSignal = el.attribute( QLatin1String( "Notify" ), QLatin1String( "no" ) ).toLower() !=
QLatin1String( "no" );
mEmitSignal = el.attribute( QStringLiteral( "Notify" ), QStringLiteral( "no" ) ).toLower() !=
QStringLiteral( "no" );
}

bool ConfigSetting::isSubSectioned() const
Expand Down Expand Up @@ -102,11 +102,11 @@ QString ConfigSetting::defaultValue() const

QString ConfigSetting::defaultInitializer() const
{
if( mType == QLatin1String( "String" ) )
if( mType == QStringLiteral( "String" ) )
{
return QLatin1String( "QString::fromUtf8( \"" )
return QStringLiteral( "QString::fromUtf8( \"" )
% utf8Encoded( mDefaultValue )
% QLatin1String( "\" )" );
% QStringLiteral( "\" )" );
}
else if( mDefaultValue.isEmpty() )
{
Expand All @@ -121,18 +121,18 @@ QString ConfigSetting::defaultInitializer() const
ConfigSubSection::ConfigSubSection( QDomElement el, ConfigSubSection* parent )
{
mParent = parent;
mName = el.attribute( QLatin1String( "Name" ), QString() );
mName = el.attribute( QStringLiteral( "Name" ), QString() );

//qDebug() << "Subsection:" << mName;

QDomElement elChild = el.firstChildElement();
while( elChild.isElement() )
{
if( elChild.tagName() == QLatin1String( "Setting" ) )
if( elChild.tagName() == QStringLiteral( "Setting" ) )
{
mSettings.append( new ConfigSetting( elChild, this ) );
}
else if( elChild.tagName() == QLatin1String( "SubSection" ) )
else if( elChild.tagName() == QStringLiteral( "SubSection" ) )
{
mSections.append( new ConfigSubSection( elChild, this ) );
}
Expand Down Expand Up @@ -195,17 +195,17 @@ void ConfigSubSection::addAllSettings( QList< ConfigSetting* >& settings) const

ConfigSection::ConfigSection( QDomElement el )
{
mClassName = el.attribute( QLatin1String( "Class" ) );
mConfigPath = el.attribute( QLatin1String( "ConfigPath" ) );
mClassName = el.attribute( QStringLiteral( "Class" ) );
mConfigPath = el.attribute( QStringLiteral( "ConfigPath" ) );

QDomElement elChild = el.firstChildElement();
while( elChild.isElement() )
{
if( elChild.tagName() == QLatin1String( "Setting" ) )
if( elChild.tagName() == QStringLiteral( "Setting" ) )
{
mSettings.append( new ConfigSetting( elChild ) );
}
else if( elChild.tagName() == QLatin1String( "SubSection" ) )
else if( elChild.tagName() == QStringLiteral( "SubSection" ) )
{
mSections.append( new ConfigSubSection( elChild ) );
}
Expand Down
34 changes: 17 additions & 17 deletions CfgComp/VariantTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ VariantType::VariantType( const QString& typeName,

bool VariantType::isUserType() const
{
return mType == QLatin1String( "User" );
return mType == QStringLiteral( "User" );
}

bool VariantType::requiresTemplateMagic() const
Expand Down Expand Up @@ -77,20 +77,20 @@ QVariant::Type VariantType::typeId() const

QString VariantType::typeIdName() const
{
return QLatin1String( QVariant::typeToName( mTypeId ) );
return QString::fromUtf8(QVariant::typeToName(mTypeId));
}

QString VariantType::defaultCTored() const
{
switch( mTypeId )
{
case QVariant::Bool: return QLatin1String( "false" );
case QVariant::Bool: return QStringLiteral( "false" );
case QVariant::Int:
case QVariant::UInt: return QLatin1String( "0" );
case QVariant::UInt: return QStringLiteral( "0" );
case QVariant::LongLong:
case QVariant::ULongLong: return QLatin1String( "0LL" );
case QVariant::Double: return QLatin1String( "0.0" );
case QVariant::Char: return QLatin1String( "'\\0'" );
case QVariant::ULongLong: return QStringLiteral( "0LL" );
case QVariant::Double: return QStringLiteral( "0.0" );
case QVariant::Char: return QStringLiteral( "'\\0'" );

case QVariant::Map:
case QVariant::List:
Expand All @@ -112,28 +112,28 @@ QString VariantType::defaultCTored() const
case QVariant::Point:
case QVariant::PointF:
case QVariant::RegExp:
case QVariant::Hash: return mCppType + QLatin1String( "()" );
default: return QLatin1String( "/* UNSUPPORTED */" );
case QVariant::Hash: return mCppType + QStringLiteral( "()" );
default: return QStringLiteral( "/* UNSUPPORTED */" );
}
}

VariantTypes::VariantTypes()
{
mTypes.append(VariantType(QLatin1String("String"),
mTypes.append(VariantType(QStringLiteral("String"),
QVariant::String,
QLatin1String("QString")));
QStringLiteral("QString")));

mTypes.append(VariantType(QLatin1String("Int"),
mTypes.append(VariantType(QStringLiteral("Int"),
QVariant::Int,
QLatin1String("qint32")));
QStringLiteral("qint32")));

mTypes.append(VariantType(QLatin1String("UInt"),
mTypes.append(VariantType(QStringLiteral("UInt"),
QVariant::UInt,
QLatin1String("quint32")));
QStringLiteral("quint32")));

mTypes.append(VariantType(QLatin1String("Bool"),
mTypes.append(VariantType(QStringLiteral("Bool"),
QVariant::Bool,
QLatin1String("bool")));
QStringLiteral("bool")));
}

VariantTypes* VariantTypes::sSelf = NULL;
Expand Down
4 changes: 2 additions & 2 deletions CfgComp/WriteClassHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ WriteClassHeader::WriteClassHeader( const QString& outFile, const ConfigSection&

void WriteClassHeader::generate()
{
QString protector = QLatin1String( "CFGCOMP_" ) + mSection.className().toUpper() +
QLatin1String( "_HPP" );
QString protector = QStringLiteral( "CFGCOMP_" ) + mSection.className().toUpper() +
QStringLiteral( "_HPP" );

mOutStream << "\n"
"#ifndef " << protector << "\n"
Expand Down
2 changes: 1 addition & 1 deletion CfgComp/WriteClassSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void WriteClassSource::generate()

foreach( ConfigSetting* setting, mSection.allSettings() )
{
mOutStream << "\n\tif( subPath == QLatin1String( \"" << setting->fullPath() << "\" ) )\n"
mOutStream << "\n\tif( subPath == QStringLiteral( \"" << setting->fullPath() << "\" ) )\n"
"\t{\n"
"\t\tmValue" << setting->fullName() << " = value.";

Expand Down
6 changes: 3 additions & 3 deletions Libs/libDiffViews/Model/FilePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ namespace DiffViews
{
Q_ASSERT( mPathNames.count() == 2 );

stream << "diff " << mOptions.join( QLatin1String( " " ) );
stream << "diff " << mOptions.join( QStringLiteral( " " ) );
if( mOptions.count() > 0 )
stream << ' ';
stream << mPathNames.join( QLatin1String( " " ) ) << '\n';
stream << mPathNames.join( QStringLiteral( " " ) ) << '\n';

stream << mOptionLines.join( QLatin1String( "\n" ) );
stream << mOptionLines.join( QStringLiteral( "\n" ) );
if( mOptionLines.count() > 0 )
stream << '\n';

Expand Down
2 changes: 1 addition & 1 deletion Libs/libDiffViews/Model/Hunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace DiffViews

QString Hunk::area() const
{
return QString( QLatin1String( "@@ %1,%2 %3,%4 @@" ) )
return QString( QStringLiteral( "@@ %1,%2 %3,%4 @@" ) )
.arg( firstLine( 0 ) )
.arg( numLines( 0 ) )
.arg( firstLine( 1 ) )
Expand Down
10 changes: 5 additions & 5 deletions Libs/libDiffViews/Views/Raw/RawHighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace DiffViews
{
QColor c = Qt::black;

if( text.startsWith( QLatin1String( "diff" ) ) ||
text.startsWith( QLatin1String( "---" ) ) ||
text.startsWith( QLatin1String( "+++" ) ) )
if( text.startsWith( QStringLiteral( "diff" ) ) ||
text.startsWith( QStringLiteral( "---" ) ) ||
text.startsWith( QStringLiteral( "+++" ) ) )
{
c = Qt::darkGreen;
}
Expand All @@ -48,9 +48,9 @@ namespace DiffViews
{
c = Qt::gray;
}
else if( text.startsWith( QLatin1String( "@@" ) ) )
else if( text.startsWith( QStringLiteral( "@@" ) ) )
{
int i = text.indexOf( QLatin1String( "@@" ), 2 );
int i = text.indexOf( QStringLiteral( "@@" ), 2 );
i += 2;
setFormat( 0, i, Qt::darkYellow );
setFormat( i, text.length() - i, Qt::blue );
Expand Down
4 changes: 2 additions & 2 deletions Libs/libDiffViews/Views/Seq/SeqViewDiffStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ namespace DiffViews
{
if( mBinary )
{
return QLatin1String( "Bin" );
return QStringLiteral( "Bin" );
}
return QString( QLatin1String( "+%1 -%2" ) ).arg( mAdded ).arg( mRemoved );
return QString( QStringLiteral( "+%1 -%2" ) ).arg( mAdded ).arg( mRemoved );
}

void SeqViewDiffStat::postRendering()
Expand Down
4 changes: 2 additions & 2 deletions Libs/libDiffViews/Views/Seq/SeqViewHunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace DiffViews
qreal SeqViewHunkContent::setWidth( qreal width )
{
QFontMetricsF fm( info()->mFixed );
QRectF r = fm.boundingRect( QLatin1String( "X" ) );
QRectF r = fm.boundingRect( QStringLiteral( "X" ) );
qreal height = 1 + ( r.height() + 1 ) * mLines.count();

mSpaceLeft = mSpaceRight = 20;
Expand Down Expand Up @@ -155,7 +155,7 @@ namespace DiffViews

QFontMetricsF fm( ifo->mFixed );
QRectF outline(10, 0, width() - 20, height());
QRectF r = fm.boundingRect( QLatin1String( "X" ) );
QRectF r = fm.boundingRect( QStringLiteral( "X" ) );
qreal lh = r.height() + 1;
qreal top = 0;

Expand Down
5 changes: 0 additions & 5 deletions Libs/libLogger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ PROJECT(LOGGER)

QT_PREPARE(Core)

INCLUDE_DIRECTORIES( BEFORE
${MGV_CORE_SOURCE_DIR}
${MGV_CORE_BINARY_DIR}
)

SET( SRC_FILES

Event.cpp
Expand Down
3 changes: 3 additions & 0 deletions Libs/libLogger/Internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <QCoreApplication>
#include <QThread>

Q_DECLARE_METATYPE(Log::Event)

namespace Log
{

Expand All @@ -38,6 +40,7 @@ namespace Log
: mNextId(1)
, mConsumer(nullptr)
{
qRegisterMetaType<Log::Event>();
createDefaultChannels();
}

Expand Down
6 changes: 3 additions & 3 deletions Libs/libLogger/Template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ namespace Log
s = event.param(QString());
}
else {
s.replace(QLatin1String("$$"), event.param(QString()));
s.replace(QStringLiteral("$$"), event.param(QString()));
}

foreach (QString pname, event.paramNames()) {
if (!pname.isEmpty()) {
QString key = QChar(L'$') % pname % QChar(L'$');
QString value = event.param(pname);

value.replace(QChar(L'&'), QLatin1String("&amp;"));
value.replace(QChar(L'<'), QLatin1String("&lt;"));
value.replace(QChar(L'&'), QStringLiteral("&amp;"));
value.replace(QChar(L'<'), QStringLiteral("&lt;"));

s.replace(key, value);
}
Expand Down
25 changes: 14 additions & 11 deletions Libs/libMacGitverCore/App/MacGitver.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* MacGitver
* Copyright (C) 2012-2013 Sascha Cunz <sascha@babbelbox.org>
* Copyright (C) 2012-2015 The MacGitver-Developers <dev@macgitver.org>
*
* (C) Sascha Cunz <sascha@cunz-rad.com>
* (C) Cunz RaD Ltd.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License (Version 2) as published by the Free Software Foundation.
Expand Down Expand Up @@ -61,21 +64,21 @@ void MacGitverPrivate::init()
// These are used to accquire global settings and stuff...
// Set them differently, so we can run unit tests without fiddeling about the global settings.
if (isGui) {
QApplication::setOrganizationName( QLatin1String( "MacGitver" ) );
QApplication::setApplicationName( QLatin1String( "MacGitver" ) );
QApplication::setOrganizationName(QStringLiteral("MacGitver"));
QApplication::setApplicationName(QStringLiteral("MacGitver"));

Heaven::IconManager::self().defaultProvider()->addSearchPath(QLatin1String(":/Images"));
Heaven::IconManager::self().defaultProvider()->addSearchPath(QStringLiteral(":/Images"));
} else {
QApplication::setOrganizationName( QLatin1String( "MacGitver" ) );
QApplication::setApplicationName( QLatin1String( "MacGitver_NonGui" ) );
QApplication::setOrganizationName(QStringLiteral("MacGitver"));
QApplication::setApplicationName(QStringLiteral("MacGitver_NonGui"));
}

sRepoMan = new RM::RepoMan;
sModules = new Modules;

if (isGui) {
// Continue with the rest of the init-process after QApplication::exec() has started to run.
QMetaObject::invokeMethod( this, "bootGui", Qt::QueuedConnection );
QMetaObject::invokeMethod(this, "bootGui", Qt::QueuedConnection);
}
}

Expand Down Expand Up @@ -152,7 +155,7 @@ BlueSky::ViewDescriptor* MacGitver::registerView(const BlueSky::ViewIdentifier&
const QString &displayName,
MgvViewCreator creator)
{
return new BlueSky::ViewDescriptor( identifier, displayName, creator );
return new BlueSky::ViewDescriptor(identifier, displayName, creator);
}

void MacGitver::unregisterView(const BlueSky::ViewIdentifier& identifier)
Expand All @@ -163,17 +166,17 @@ void MacGitver::unregisterView(const BlueSky::ViewIdentifier& identifier)
}
}

void MacGitver::log( Log::Type type, const QString& logMessage )
void MacGitver::log(Log::Type type, const QString& logMessage)
{
Log::Manager().addMessage(logMessage, type);
}

void MacGitver::log( Log::Type type, const char* logMessage )
void MacGitver::log(Log::Type type, const char* logMessage)
{
Log::Manager().addMessage(QString::fromUtf8(logMessage), type);
}

void MacGitver::log( Log::Type type, const Git::Result& r, const char* logMessage )
void MacGitver::log(Log::Type type, const Git::Result& r, const char* logMessage)
{
if (logMessage) {
Log::Manager().addMessage(tr("GitWrap-Error: %1\n(%2)")
Expand Down
Loading

0 comments on commit 50a82f4

Please sign in to comment.