Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.
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
2 changes: 1 addition & 1 deletion QodeEdit.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include( config.pri )
initializeProject( lib, $${BUILD_TARGET}, $${BUILD_MODE}, $${BUILD_PATH}/$${TARGET_NAME}, $${BUILD_TARGET_PATH}, $${BUILD_TYPE}, $${BUILD_VERSION} )
autoGenerateFile( "QodeEditConfig.h.in", "src/QodeEditConfig.h" )

QT *= xml
QT *= core gui widgets xml

INCLUDEPATH *= src
DEPENDPATH *= $$getFolders( . )
Expand Down
4 changes: 3 additions & 1 deletion example.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
###########################################################################################
QT *= core gui widgets xml

win32|macx {
OXYGEN_THEME_PATH = $$PWD/../oxygen-icons-png.git

Expand All @@ -36,5 +38,5 @@ FORMS *= \
HEADERS *= \
example/UIMain.h

SOURCES *= main.cpp \
SOURCES *= example/main.cpp \
example/UIMain.cpp
6 changes: 4 additions & 2 deletions example/UIMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QStatusBar>
#include <QShortcut>
#include "UIMain.h"
#include "ui_UIMain.h"
#include "editor/CodeEditor.h"
Expand Down Expand Up @@ -103,7 +105,7 @@ UIMain::UIMain( QWidget* parent )
ui->toolBar->addWidget( new SpacerWidget( this ) );
ui->toolBar->addWidget( ui->cbSyntax );

qInstallMsgHandler( UIMain::messageHandler );
qInstallMessageHandler( UIMain::messageHandler );
connect( mManager, SIGNAL( updated() ), this, SLOT( manager_updated() ) );

mManager->initialize();
Expand All @@ -126,7 +128,7 @@ UIMain::~UIMain()
delete ui;
}

void UIMain::messageHandler( QtMsgType type, const char* msg )
void UIMain::messageHandler( QtMsgType type,const QMessageLogContext &context,const QString &msg )
{
QMutexLocker locker( &qMutex );
QString string;
Expand Down
7 changes: 4 additions & 3 deletions example/UIMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#define UIMAIN_H

#include <QtGui>

#include "CodeEditor.h"
#include <QMainWindow>
#include <QApplication>
#include "editor/CodeEditor.h"

class Ui_UIMain;

Expand Down Expand Up @@ -50,7 +51,7 @@ class UIMain : public QMainWindow
UIMain( QWidget* parent = 0 );
virtual ~UIMain();

static void messageHandler( QtMsgType type, const char* msg );
static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg );

public slots:
void appendDebugMessage( const QString& message );
Expand Down
2 changes: 1 addition & 1 deletion example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
**
****************************************************************************/
#include <QtGui>

#include <QDesktopWidget>
#include "QodeEditExampleConfig.h"
#include "UIMain.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ QString QodeEdit::Manager::userSharedDataFilePath( const QString& extended ) con
{
return d->userSharedDataFilePath.isEmpty()
? QDir::cleanPath( QString( "%1/%2/%3" )
.arg( QDesktopServices::storageLocation( QDesktopServices::DataLocation ) )
.arg( QStandardPaths::StandardLocation( QStandardPaths::DataLocation) )
.arg( QString::fromUtf8( PACKAGE_NAME ) )
.arg( extended ) )
: d->userSharedDataFilePath
Expand Down
2 changes: 1 addition & 1 deletion src/QodeEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ QodeEdit {
IncludeRulesRule
};

enum DefaultStyle {
enum Style {
InvalidStyle = -1,
NormalStyle,
KeywordStyle,
Expand Down
2 changes: 1 addition & 1 deletion src/Threading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "Tools.h"
#include "syntax/Document.h"

#include <QtConcurrentRun>
#include <QtConcurrent/QtConcurrentRun>

QFuture<QStringList> QodeEdit::Threading::listFilesInPaths( const QStringList& paths, const QStringList& filters, bool recursive, bool sort )
{
Expand Down
10 changes: 5 additions & 5 deletions src/Tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace Tools {
class CaseInsensitiveEnumerator {
public:
CaseInsensitiveEnumerator( const QMetaEnum& enumerator = QMetaEnum() ) {
name = QString::fromAscii( enumerator.name() ).toLower();
name = QString( enumerator.name() ).toLower();

for ( int i = 0; i < enumerator.keyCount(); i++ ) {
const int value( enumerator.value( i ) );
Expand Down Expand Up @@ -73,7 +73,7 @@ namespace Tools {
static CaseInsensitiveEnumerator ruler( mo().enumerator( mo().indexOfEnumerator( "Ruler" ) ) );
static CaseInsensitiveEnumerator margin( mo().enumerator( mo().indexOfEnumerator( "Margin" ) ) );
static CaseInsensitiveEnumerator rule( mo().enumerator( mo().indexOfEnumerator( "Rule" ) ) );
static CaseInsensitiveEnumerator defaultStyle( mo().enumerator( mo().indexOfEnumerator( "DefaultStyle" ) ) );
static CaseInsensitiveEnumerator defaultStyle( mo().enumerator( mo().indexOfEnumerator( "Style" ) ) );
static QHash<QString, QSet<QChar> > sets;
}; // Tools

Expand Down Expand Up @@ -109,14 +109,14 @@ QodeEdit::Rule QodeEdit::Tools::stringToRule( const QString& string )
return QodeEdit::Rule( QodeEdit::Tools::rule.keyToValue( string ) );
}

QString QodeEdit::Tools::defaultStyleToString( QodeEdit::DefaultStyle style )
QString QodeEdit::Tools::defaultStyleToString( QodeEdit::Style style )
{
return QodeEdit::Tools::defaultStyle.valueToKey( style );
}

QodeEdit::DefaultStyle QodeEdit::Tools::stringToDefaultStyle( const QString& string )
QodeEdit::Style QodeEdit::Tools::stringToDefaultStyle( const QString& string )
{
return QodeEdit::DefaultStyle( QodeEdit::Tools::defaultStyle.keyToValue( string ) );
return QodeEdit::Style( QodeEdit::Tools::defaultStyle.keyToValue( string ) );
}

bool QodeEdit::Tools::stringEquals( const QString& left, const QString& right, Qt::CaseSensitivity sensitivity )
Expand Down
6 changes: 4 additions & 2 deletions src/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <Qt>
#include <QHash>
#include <QStringList>
#include <QTextCodec>
#include <QPair>

namespace Syntax {
Expand All @@ -38,8 +40,8 @@ namespace Tools {
QString ruleToString( QodeEdit::Rule rule );
QodeEdit::Rule stringToRule( const QString& string );

QString defaultStyleToString( QodeEdit::DefaultStyle style );
QodeEdit::DefaultStyle stringToDefaultStyle( const QString& string );
QString defaultStyleToString( QodeEdit::Style style );
QodeEdit::Style stringToDefaultStyle( const QString& string );

bool stringEquals( const QString& left, const QString& right, Qt::CaseSensitivity sensitivity = Qt::CaseInsensitive );
bool stringLessThan( const QString& left, const QString& right, Qt::CaseSensitivity sensitivity = Qt::CaseInsensitive );
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/Rule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ Syntax::Rule Syntax::Rule::create( QodeEdit::Rule type, const QHash<QString, QVa
{
static QHash<QodeEdit::Rule, QSet<QString> > requiredAttributes;

if ( requiredAttributes.isEmpty() ) {
if ( requiredAttributes[type].isEmpty() ) {
switch ( type ) {
case QodeEdit::KeywordRule:
requiredAttributes[ type ] << "string";
Expand Down
8 changes: 4 additions & 4 deletions src/theme/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class Theme::SchemaData : public QSharedData
return QString( "%1:%2" ).arg( syntaxName.trimmed() ).arg( styleName.trimmed() ).toLower();
}

QString defaultStyleKey( QodeEdit::DefaultStyle defaultStyle ) const {
QString defaultStyleKey( QodeEdit::Style defaultStyle ) const {
return QString( "ds%1" ).arg( QodeEdit::Tools::defaultStyleToString( defaultStyle ) ).toLower().trimmed();
}

Theme::Style* defaultStyle( QodeEdit::DefaultStyle defaultStyle ) {
Theme::Style* defaultStyle( QodeEdit::Style defaultStyle ) {
return &styles[ defaultStyleKey( defaultStyle ) ];
}

Expand Down Expand Up @@ -115,12 +115,12 @@ void Theme::Schema::setSyntaxStyle( const QString& syntaxName, const QString& st
d->styles[ d->syntaxStyleKey( syntaxName, styleName ) ] = style;
}

Theme::Style Theme::Schema::defaultStyle( QodeEdit::DefaultStyle defaultStyle ) const
Theme::Style Theme::Schema::defaultStyle( QodeEdit::Style defaultStyle ) const
{
return d->styles.value( d->defaultStyleKey( defaultStyle ) );
}

void Theme::Schema::setDefaultStyle( QodeEdit::DefaultStyle defaultStyle, const Theme::Style& style )
void Theme::Schema::setDefaultStyle( QodeEdit::Style defaultStyle, const Theme::Style& style )
{
d->styles[ d->defaultStyleKey( defaultStyle ) ] = style;
}
4 changes: 2 additions & 2 deletions src/theme/Theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class Schema
Theme::Style syntaxStyle( const QString& syntaxName, const QString& styleName ) const;
void setSyntaxStyle( const QString& syntaxName, const QString& styleName, const Theme::Style& style );

Theme::Style defaultStyle( QodeEdit::DefaultStyle defaultStyle ) const;
void setDefaultStyle( QodeEdit::DefaultStyle defaultStyle, const Theme::Style& style );
Theme::Style defaultStyle( QodeEdit::Style defaultStyle ) const;
void setDefaultStyle( QodeEdit::Style defaultStyle, const Theme::Style& style );
};

}; // Theme
Expand Down