Skip to content

Commit

Permalink
Qt Creator 12.0 rc 1 changes
Browse files Browse the repository at this point in the history
- It compiles
- It has bugs
    - The output pane does not have a name
    - the minus (ignore word) button is wrong
  • Loading branch information
CJCombrink committed Nov 22, 2023
1 parent ca6209f commit c49338c
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 126 deletions.
9 changes: 9 additions & 0 deletions CMakeUserPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 4,
"vendor": {
"conan": {}
},
"include": [
"D:\\Development\\SpellChecker-Plugin\\SpellChecker-Plugin-conan\\build\\generators\\CMakePresets.json"
]
}
52 changes: 26 additions & 26 deletions SpellChecker.json.in
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
\"Name\" : \"SpellChecker\",
\"Version\" : \"3.4.0\",
\"CompatVersion\" : \"3.4.0\",
\"Vendor\" : \"Carel Combrink\",
\"Copyright\" : \"(C) 2015 - 2022 Carel Combrink\",
\"License\" : [ \"GNU Lesser General Public License Usage\",
\"\",
\"This plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\"
"Name" : "SpellChecker",
"Version" : "3.5.0",
"CompatVersion" : "3.5.0",
"Vendor" : "Carel Combrink",
"Copyright" : "(C) 2015 - 2022 Carel Combrink",
"License" : [ "GNU Lesser General Public License Usage",
"",
"This plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html."
],
\"Description\" : [ \"Spellcheck comments in source files.\",
\"An Output Pane, Right Click context menu and a Navigation Widget is added to QtCreator to interact with the results from this plugin.\"
"Description" : [ "Spellcheck comments in source files.",
"An Output Pane, Right Click context menu and a Navigation Widget is added to QtCreator to interact with the results from this plugin."
],
\"Url\" : \"https://github.com/CJCombrink/SpellChecker-Plugin\",
$$dependencyList,
"Url" : "https://github.com/CJCombrink/SpellChecker-Plugin",
${IDE_PLUGIN_DEPENDENCIES},

\"Mimetypes\" : [
\"<?xml version=\'1.0\' encoding=\'UTF-8\'?>\",
\"<mime-info xmlns=\'http://www.freedesktop.org/standards/shared-mime-info\'>\",
\" <mime-type type=\'text/x-c++dox\'>\",
\" <sub-class-of type=\'text/x-c++hdr\'/>\",
\" <comment>Doxygen Files</comment>\",
\" <glob pattern=\'*.dox\'/>\",
\" <glob pattern=\'*.doxy\'/>\",
\" <magic priority=\'50\'>\",
\" <match type=\'string\' offset=\'0\' value=\'/*!\'/>\",
\" <match type=\'string\' offset=\'0\' value=\'/**\'/>\",
\" </magic>\",
\" </mime-type>\",
\"</mime-info>\"
"Mimetypes" : [
"<?xml version=\'1.0\' encoding=\'UTF-8\'?>",
"<mime-info xmlns=\'http://www.freedesktop.org/standards/shared-mime-info\'>",
" <mime-type type=\'text/x-c++dox\'>",
" <sub-class-of type=\'text/x-c++hdr\'/>",
" <comment>Doxygen Files</comment>",
" <glob pattern=\'*.dox\'/>",
" <glob pattern=\'*.doxy\'/>",
" <magic priority=\'50\'>",
" <match type=\'string\' offset=\'0\' value=\'/*!\'/>",
" <match type=\'string\' offset=\'0\' value=\'/**\'/>",
" </magic>",
" </mime-type>",
"</mime-info>"
]
}
6 changes: 3 additions & 3 deletions src/ISpellChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SpellCheckProcessor::~SpellCheckProcessor()
{}
// --------------------------------------------------

void SpellCheckProcessor::process( QFutureInterface<WordList>& future )
void SpellCheckProcessor::process( QPromise<WordList>& future )
{
#ifdef BENCH_TIME
QElapsedTimer timer;
Expand All @@ -63,7 +63,7 @@ void SpellCheckProcessor::process( QFutureInterface<WordList>& future )
* correct for the next iteration. */
misspelledWord = ( *wordIter );
++wordIter;
future.setProgressValue( future.progressValue() + 1 );
future.setProgressValue( future.future().progressValue() + 1 );
/* Check if the future was cancelled */
if( future.isCanceled() == true ) {
return;
Expand Down Expand Up @@ -125,6 +125,6 @@ void SpellCheckProcessor::process( QFutureInterface<WordList>& future )
if( future.isCanceled() == true ) {
return;
}
future.reportResult( misspelledWords );
future.addResult( misspelledWords );
}
// --------------------------------------------------
4 changes: 2 additions & 2 deletions src/ISpellChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "Word.h"

#include <QFutureInterface>
#include <QFuture>
#include <QObject>
#include <QSettings>

Expand Down Expand Up @@ -121,7 +121,7 @@ class SpellCheckProcessor
SpellCheckProcessor( ISpellChecker* spellChecker, const QString& fileName, const WordList& wordList, const WordList& previousMistakes );
~SpellCheckProcessor();
/*! Function that will run in the background/thread. */
void process( QFutureInterface<WordList>& future );
void process(QPromise<WordList>& future );
protected:
ISpellChecker* d_spellChecker;
QString d_fileName;
Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/CppParser/cppdocumentparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#include <texteditor/texteditor.h>
#include <utils/algorithm.h>
#include <utils/mimeutils.h>
#include <utils/runextensions.h>
#include <utils/qtcassert.h>
#include <utils/async.h>

#include <QApplication>
#include <QFutureWatcher>
Expand Down Expand Up @@ -678,10 +678,10 @@ void CppDocumentParser::parseCppDocument( CPlusPlus::Document::Ptr docPtr )
* soon as possible and it does not need to get queued along with all other
* futures added to the global thread pool. */
if( fileName == d->currentEditorFileName ) {
QFuture<ResultType> future = Utils::runAsync( QThread::HighPriority, &CppDocumentProcessor::process, parser );
QFuture<ResultType> future = Utils::asyncRun( QThread::HighPriority, &CppDocumentProcessor::process, parser );
watcher->setFuture( future );
} else {
QFuture<ResultType> future = Utils::runAsync( QThreadPool::globalInstance(), QThread::NormalPriority, &CppDocumentProcessor::process, parser );
QFuture<ResultType> future = Utils::asyncRun( QThreadPool::globalInstance(), QThread::NormalPriority, &CppDocumentProcessor::process, parser );
watcher->setFuture( future );
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/Parsers/CppParser/cppdocumentprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CppDocumentProcessor::~CppDocumentProcessor()
}
// --------------------------------------------------

void CppDocumentProcessor::process( CppDocumentProcessor::FutureIF& future )
void CppDocumentProcessor::process( CppDocumentProcessor::Promise& future )
{
SP_CHECK( docPtr.isNull() == false );
SP_CHECK( trUnit != nullptr );
Expand All @@ -91,7 +91,7 @@ void CppDocumentProcessor::process( CppDocumentProcessor::FutureIF& future )
}

if( future.isCanceled() == true ) {
future.reportCanceled();
future.future().cancel();
return;
}

Expand Down Expand Up @@ -119,7 +119,7 @@ void CppDocumentProcessor::process( CppDocumentProcessor::FutureIF& future )
}

if( future.isCanceled() == true ) {
future.reportCanceled();
future.future().cancel();
return;
}

Expand Down Expand Up @@ -151,7 +151,7 @@ void CppDocumentProcessor::process( CppDocumentProcessor::FutureIF& future )
}

if( future.isCanceled() == true ) {
future.reportCanceled();
future.future().cancel();
return;
}

Expand Down Expand Up @@ -191,12 +191,12 @@ void CppDocumentProcessor::process( CppDocumentProcessor::FutureIF& future )
}

if( future.isCanceled() == true ) {
future.reportCanceled();
future.future().cancel();
return;
}

/* Done, report the words that should be spellchecked */
future.reportResult( ResultType{ std::move( newHashesOut ), std::move( newSettingsApplied ) } );
future.addResult( ResultType{ std::move( newHashesOut ), std::move( newSettingsApplied ) } );
}
// --------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/CppParser/cppdocumentprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class CppDocumentProcessor
using Watcher = QFutureWatcher<ResultType>;
/*! \brief Alias for the Watcher Pointer type. */
using WatcherPtr = Watcher *;
/*! \brief Future Interface alias to simplify some typing and management. */
using FutureIF = QFutureInterface<ResultType>;
/*! \brief Promise alias to simplify some typing and management. */
using Promise = QPromise<ResultType>;

/*! \brief Constructor
*
Expand All @@ -114,7 +114,7 @@ class CppDocumentProcessor
~CppDocumentProcessor();
/*! \brief Process function that the thread will run with the future that will
* report the result. */
void process( FutureIF& future );
void process( Promise& future );

private:
QStringSet getWordsThatAppearInSource() const;
Expand Down
68 changes: 34 additions & 34 deletions src/Parsers/CppParser/cppparsersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,26 @@ CppParserSettings::~CppParserSettings()
{}
// --------------------------------------------------

void CppParserSettings::loadFromSettings( QSettings* settings )
void CppParserSettings::loadFromSettings( Utils::QtcSettings* settings )
{
setDefaults();

settings->beginGroup( QLatin1String( Constants::CORE_SETTINGS_GROUP ) );
settings->beginGroup( QLatin1String( Constants::CORE_PARSERS_GROUP ) );
settings->beginGroup( QLatin1String( Parsers::CppParser::Constants::CPP_PARSER_GROUP ) );

whatToCheck = static_cast<WhatToCheckOptions>( settings->value( QLatin1String( Parsers::CppParser::Constants::WHAT_TO_CHECK ), int(whatToCheck) ).toInt() );
commentsToCheck = static_cast<CommentsToCheckOptions>( settings->value( QLatin1String( Parsers::CppParser::Constants::COMMENTS_TO_CHECK ), int(commentsToCheck) ).toInt() );
checkQtKeywords = settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_QT_KEYWORDS ), checkQtKeywords ).toBool();
checkAllCapsWords = settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_CAPS ), checkAllCapsWords ).toBool();
wordsWithNumberOption = static_cast<WordsWithNumbersOption>( settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_NUMBERS ), wordsWithNumberOption ).toInt() );
wordsWithUnderscoresOption = static_cast<WordsWithUnderscoresOption>( settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_UNDERSCORES ), wordsWithUnderscoresOption ).toInt() );
camelCaseWordOption = static_cast<CamelCaseWordOption>( settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_CAMELCASE ), camelCaseWordOption ).toInt() );
removeWordsThatAppearInSource = settings->value( QLatin1String( Parsers::CppParser::Constants::REMOVE_WORDS_SOURCE ), removeWordsThatAppearInSource ).toBool();
removeEmailAddresses = settings->value( QLatin1String( Parsers::CppParser::Constants::REMOVE_EMAIL_ADDRESSES ), removeEmailAddresses ).toBool();
wordsWithDotsOption = static_cast<WordsWithDotsOption>( settings->value( QLatin1String( Parsers::CppParser::Constants::CHECK_DOTS ), wordsWithDotsOption ).toInt() );
removeWebsites = settings->value( QLatin1String( Parsers::CppParser::Constants::REMOVE_WEBSITES ), removeWebsites ).toBool();
removeFirstComment = settings->value( QLatin1String( Parsers::CppParser::Constants::REMOVE_FIRST_COMMENT ), removeFirstComment ).toBool();
settings->beginGroup( Constants::CORE_SETTINGS_GROUP );
settings->beginGroup( Constants::CORE_PARSERS_GROUP );
settings->beginGroup( Parsers::CppParser::Constants::CPP_PARSER_GROUP );

whatToCheck = static_cast<WhatToCheckOptions>( settings->value( Parsers::CppParser::Constants::WHAT_TO_CHECK, int(whatToCheck) ).toInt() );
commentsToCheck = static_cast<CommentsToCheckOptions>( settings->value( Parsers::CppParser::Constants::COMMENTS_TO_CHECK, int(commentsToCheck) ).toInt() );
checkQtKeywords = settings->value( Parsers::CppParser::Constants::CHECK_QT_KEYWORDS, checkQtKeywords ).toBool();
checkAllCapsWords = settings->value( Parsers::CppParser::Constants::CHECK_CAPS, checkAllCapsWords ).toBool();
wordsWithNumberOption = static_cast<WordsWithNumbersOption>( settings->value( Parsers::CppParser::Constants::CHECK_NUMBERS, wordsWithNumberOption ).toInt() );
wordsWithUnderscoresOption = static_cast<WordsWithUnderscoresOption>( settings->value( Parsers::CppParser::Constants::CHECK_UNDERSCORES, wordsWithUnderscoresOption ).toInt() );
camelCaseWordOption = static_cast<CamelCaseWordOption>( settings->value( Parsers::CppParser::Constants::CHECK_CAMELCASE, camelCaseWordOption ).toInt() );
removeWordsThatAppearInSource = settings->value( Parsers::CppParser::Constants::REMOVE_WORDS_SOURCE, removeWordsThatAppearInSource ).toBool();
removeEmailAddresses = settings->value( Parsers::CppParser::Constants::REMOVE_EMAIL_ADDRESSES, removeEmailAddresses ).toBool();
wordsWithDotsOption = static_cast<WordsWithDotsOption>( settings->value( Parsers::CppParser::Constants::CHECK_DOTS, wordsWithDotsOption ).toInt() );
removeWebsites = settings->value( Parsers::CppParser::Constants::REMOVE_WEBSITES, removeWebsites ).toBool();
removeFirstComment = settings->value( Parsers::CppParser::Constants::REMOVE_FIRST_COMMENT, removeFirstComment ).toBool();

settings->endGroup(); /* CPP_PARSER_GROUP */
settings->endGroup(); /* CORE_PARSERS_GROUP */
Expand All @@ -85,24 +85,24 @@ void CppParserSettings::loadFromSettings( QSettings* settings )
// --------------------------------------------------


void CppParserSettings::saveToSetting( QSettings* settings ) const
void CppParserSettings::saveToSetting(Utils::QtcSettings *settings ) const
{
settings->beginGroup( QLatin1String( Constants::CORE_SETTINGS_GROUP ) );
settings->beginGroup( QLatin1String( Constants::CORE_PARSERS_GROUP ) );
settings->beginGroup( QLatin1String( Parsers::CppParser::Constants::CPP_PARSER_GROUP ) );

settings->setValue( QLatin1String( Parsers::CppParser::Constants::WHAT_TO_CHECK ), int(whatToCheck) );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::COMMENTS_TO_CHECK ), int(commentsToCheck) );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_QT_KEYWORDS ), checkQtKeywords );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_CAPS ), checkAllCapsWords );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_NUMBERS ), wordsWithNumberOption );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_UNDERSCORES ), wordsWithUnderscoresOption );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_CAMELCASE ), camelCaseWordOption );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::REMOVE_WORDS_SOURCE ), removeWordsThatAppearInSource );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::REMOVE_EMAIL_ADDRESSES ), removeEmailAddresses );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::CHECK_DOTS ), wordsWithDotsOption );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::REMOVE_WEBSITES ), removeWebsites );
settings->setValue( QLatin1String( Parsers::CppParser::Constants::REMOVE_FIRST_COMMENT ), removeFirstComment );
settings->beginGroup( Constants::CORE_SETTINGS_GROUP );
settings->beginGroup( Constants::CORE_PARSERS_GROUP );
settings->beginGroup( Parsers::CppParser::Constants::CPP_PARSER_GROUP );

settings->setValue( Parsers::CppParser::Constants::WHAT_TO_CHECK, int(whatToCheck) );
settings->setValue( Parsers::CppParser::Constants::COMMENTS_TO_CHECK, int(commentsToCheck) );
settings->setValue( Parsers::CppParser::Constants::CHECK_QT_KEYWORDS, checkQtKeywords );
settings->setValue( Parsers::CppParser::Constants::CHECK_CAPS, checkAllCapsWords );
settings->setValue( Parsers::CppParser::Constants::CHECK_NUMBERS, wordsWithNumberOption );
settings->setValue( Parsers::CppParser::Constants::CHECK_UNDERSCORES, wordsWithUnderscoresOption );
settings->setValue( Parsers::CppParser::Constants::CHECK_CAMELCASE, camelCaseWordOption );
settings->setValue( Parsers::CppParser::Constants::REMOVE_WORDS_SOURCE, removeWordsThatAppearInSource );
settings->setValue( Parsers::CppParser::Constants::REMOVE_EMAIL_ADDRESSES, removeEmailAddresses );
settings->setValue( Parsers::CppParser::Constants::CHECK_DOTS, wordsWithDotsOption );
settings->setValue( Parsers::CppParser::Constants::REMOVE_WEBSITES, removeWebsites );
settings->setValue( Parsers::CppParser::Constants::REMOVE_FIRST_COMMENT, removeFirstComment );

settings->endGroup(); /* CPP_PARSER_GROUP */
settings->endGroup(); /* CORE_PARSERS_GROUP */
Expand Down
7 changes: 4 additions & 3 deletions src/Parsers/CppParser/cppparsersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

#pragma once

#include <utils/qtcsettings.h>

#include <QObject>
#include <QSettings>

namespace SpellChecker {
namespace CppSpellChecker {
Expand Down Expand Up @@ -147,8 +148,8 @@ class CppParserSettings
* will not be ignored. This is to handle pure doxygen
* docs files that might start without a file header. */

void loadFromSettings( QSettings* settings );
void saveToSetting( QSettings* settings ) const;
void loadFromSettings(Utils::QtcSettings* settings);
void saveToSetting(Utils::QtcSettings* settings) const;

CppParserSettings& operator=( const CppParserSettings& other );
bool operator==( const CppParserSettings& other ) const;
Expand Down
Loading

0 comments on commit c49338c

Please sign in to comment.