diff --git a/.gitignore b/.gitignore new file mode 100644 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +CMakeLists.txt.user +*.autosave diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ #Name the project project(kiten) -cmake_minimum_required( VERSION 2.8.12 ) +cmake_minimum_required( VERSION 3.3 ) #ECM setup find_package(ECM 1.7 REQUIRED NO_MODULE) diff --git a/app/configdictionaryselector.h b/app/configdictionaryselector.h --- a/app/configdictionaryselector.h +++ b/app/configdictionaryselector.h @@ -37,8 +37,8 @@ public: explicit ConfigDictionarySelector( const QString &dictionaryName - , QWidget *parent = 0 - , KConfigSkeleton *iconfig = NULL + , QWidget *parent = nullptr + , KConfigSkeleton *iconfig = nullptr , Qt::WindowFlags f = {} ); public slots: diff --git a/app/configdictionaryselector.cpp b/app/configdictionaryselector.cpp --- a/app/configdictionaryselector.cpp +++ b/app/configdictionaryselector.cpp @@ -46,7 +46,7 @@ _config->setCurrentGroup( "dicts_" + _dictName ); KConfigSkeletonItem *item = _config->findItem( _dictName + "__NAMES" ); - if( item != NULL ) + if( item != nullptr ) { names = item->property().toStringList(); } @@ -121,7 +121,7 @@ { QTreeWidgetItem *item = fileList->topLevelItem( 0 ); - QString filename = QFileDialog::getOpenFileName(0, QString(), + QString filename = QFileDialog::getOpenFileName(nullptr, QString(), item ? QFileInfo( item->text( 1 ) ).absolutePath().append( "/" ) : QString() ); QString name = QFileInfo( filename ).fileName(); diff --git a/app/configsortingpage.h b/app/configsortingpage.h --- a/app/configsortingpage.h +++ b/app/configsortingpage.h @@ -33,8 +33,8 @@ Q_OBJECT public: - explicit ConfigSortingPage( QWidget *parent = 0 - , KitenConfigSkeleton *config = NULL + explicit ConfigSortingPage( QWidget *parent = nullptr + , KitenConfigSkeleton *config = nullptr , Qt::WindowFlags f = {} ); public slots: diff --git a/app/configuredialog.h b/app/configuredialog.h --- a/app/configuredialog.h +++ b/app/configuredialog.h @@ -33,8 +33,8 @@ Q_OBJECT public: - explicit ConfigureDialog( QWidget *parent = 0 - , KitenConfigSkeleton *config = NULL ); + explicit ConfigureDialog( QWidget *parent = nullptr + , KitenConfigSkeleton *config = nullptr ); virtual ~ConfigureDialog(); signals: diff --git a/app/configuredialog.cpp b/app/configuredialog.cpp --- a/app/configuredialog.cpp +++ b/app/configuredialog.cpp @@ -50,7 +50,7 @@ : KConfigDialog( parent, "Settings", config ) { //TODO: Figure out why these pages are unmanaged... is this needed? - addPage( makeDictionaryFileSelectionPage( NULL, config ) + addPage( makeDictionaryFileSelectionPage( nullptr, config ) , i18n( "Dictionaries" ) , "help-contents" ); @@ -69,10 +69,10 @@ cf.setupUi( widget ); addPage( widget, i18n( "Font" ), "preferences-desktop-font" ); - addPage( makeDictionaryPreferencesPage( NULL, config ) + addPage( makeDictionaryPreferencesPage( nullptr, config ) , i18nc( "@title:group the settings for the dictionary display", "Display" ) , "format-indent-more" ); - addPage( makeSortingPage( NULL, config ) + addPage( makeSortingPage( nullptr, config ) , i18n( "Results Sorting" ) , "format-indent-more" ); diff --git a/app/dictionaryupdatemanager.cpp b/app/dictionaryupdatemanager.cpp --- a/app/dictionaryupdatemanager.cpp +++ b/app/dictionaryupdatemanager.cpp @@ -85,12 +85,12 @@ void DictionaryUpdateManager::checkInfoFile( KJob *job ) { - KIO::StoredTransferJob *storedJob = static_cast( job ); + KIO::StoredTransferJob *storedJob = qobject_cast( job ); QByteArray data( storedJob->data() ); // Check if we have valid data to work with. if( data.isNull() || data.isEmpty() ) { - KMessageBox::sorry( 0, i18n( "Update canceled.\nCould not read file." ) ); + KMessageBox::sorry( nullptr, i18n( "Update canceled.\nCould not read file." ) ); job->deleteLater(); return; } @@ -100,7 +100,7 @@ QTemporaryFile tempFile; if( ! tempFile.open() ) { - KMessageBox::sorry( 0, i18n( "Update canceled.\nCould not open file." ) ); + KMessageBox::sorry( nullptr, i18n( "Update canceled.\nCould not open file." ) ); qDebug() << "Could not open tempFile." << endl; tempFile.deleteLater(); job->deleteLater(); @@ -117,7 +117,7 @@ // Maybe the format/content of (one or both) the files changed? // or maybe one or both of the files could not be opened in the // getFileDate function that would return an invalid empty date. - KMessageBox::sorry( 0, i18n( "Update canceled.\nThe update information file has an invalid date." ) ); + KMessageBox::sorry( nullptr, i18n( "Update canceled.\nThe update information file has an invalid date." ) ); tempFile.deleteLater(); job->deleteLater(); return; @@ -239,7 +239,7 @@ // This way we can know when we finished with our installed dictionaries. _counter++; - KIO::StoredTransferJob *storedJob = static_cast( job ); + KIO::StoredTransferJob *storedJob = qobject_cast( job ); QByteArray data( storedJob->data() ); QString url( storedJob->url().toDisplayString() ); @@ -317,21 +317,21 @@ if( ! _succeeded.isEmpty() && _failed.isEmpty() ) { - KMessageBox::information( 0, i18n( "You already have the latest updates." ) ); + KMessageBox::information( nullptr, i18n( "You already have the latest updates." ) ); } else if( _succeeded.isEmpty() && _failed.isEmpty() ) { - KMessageBox::information( 0, i18n( "Successfully updated your dictionaries." ) ); + KMessageBox::information( nullptr, i18n( "Successfully updated your dictionaries." ) ); } else if( ! _succeeded.isEmpty() && ! _failed.isEmpty() ) { - KMessageBox::information( 0, i18n( "Successfully updated:\n%1\n\nFailed to update:\n%2" + KMessageBox::information( nullptr, i18n( "Successfully updated:\n%1\n\nFailed to update:\n%2" , _succeeded.join( "\n" ) , _failed.join( "\n" ) ) ); } else if( _succeeded.isEmpty() && ! _failed.isEmpty() ) { - KMessageBox::sorry( 0, i18n( "Failed to update:\n%1" + KMessageBox::sorry( nullptr, i18n( "Failed to update:\n%1" , _failed.join( "\n" ) ) ); } diff --git a/app/entrylistmodel.cpp b/app/entrylistmodel.cpp --- a/app/entrylistmodel.cpp +++ b/app/entrylistmodel.cpp @@ -93,13 +93,10 @@ { case 0: return _list.at( index.row() )->getWord(); - break; case 1: return _list.at( index.row() )->getReadings(); - break; case 2: return _list.at( index.row() )->getMeanings(); - break; } break; diff --git a/app/entrylistview.h b/app/entrylistview.h --- a/app/entrylistview.h +++ b/app/entrylistview.h @@ -30,7 +30,7 @@ Q_OBJECT public: - EntryListView( QWidget *parent = NULL ); + EntryListView( QWidget *parent = nullptr ); public slots: void setEmptyModel(); diff --git a/app/kiten.cpp b/app/kiten.cpp --- a/app/kiten.cpp +++ b/app/kiten.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -112,7 +113,7 @@ createGUI(); _statusBar = statusBar(); - _optionDialog = 0; + _optionDialog = nullptr; /* Start the system tray icon. */ _sysTrayIcon = new QSystemTrayIcon( windowIcon(), this ); @@ -152,7 +153,7 @@ } delete _optionDialog; - _optionDialog = 0; + _optionDialog = nullptr; } KitenConfigSkeleton* Kiten::getConfig() @@ -168,7 +169,7 @@ // (void) KStandardAction::print(this, SLOT(print()), actionCollection()); (void) KStandardAction::preferences( this, SLOT(slotConfigure()), actionCollection() ); //old style cast seems needed here, (const QObject*) - KStandardAction::keyBindings( (const QObject*)guiFactory() + KStandardAction::keyBindings( qobject_cast(guiFactory()) , SLOT(configureShortcuts()) , actionCollection() ); @@ -582,10 +583,10 @@ */ void Kiten::slotConfigureDestroy() { - if ( _optionDialog != 0 && _optionDialog->isVisible() == 0 ) + if ( _optionDialog != nullptr && _optionDialog->isVisible() == 0 ) { delete _optionDialog; - _optionDialog = 0; + _optionDialog = nullptr; } } @@ -786,7 +787,7 @@ void Kiten::displayHistoryItem() { - if ( _historyList.current() == NULL ) + if ( _historyList.current() == nullptr ) return; _inputManager->setSearchQuery( _historyList.current()->getQuery() ); @@ -807,7 +808,7 @@ void Kiten::setCurrentScrollValue( int value ) { - if ( _historyList.current() == NULL ) + if ( _historyList.current() == nullptr ) return; _historyList.current()->setScrollValue( value ); diff --git a/app/main.cpp b/app/main.cpp --- a/app/main.cpp +++ b/app/main.cpp @@ -62,7 +62,6 @@ aboutData.addAuthor( i18n("Joseph Kerian"), i18n("KDE4 rewrite"), "jkerian@gmail.com" ); aboutData.addAuthor( i18n("Eric Kjeldergaard"), i18n("KDE4 rewrite"), "kjelderg@gmail.com" ); aboutData.addAuthor( i18n("Daniel E. Moctezuma"), i18n("Deinflection system improvements, Dictionary updates for EDICT and KANJIDIC, GUI Improvements, Kanji Browser, Bug fixes, Code polishing and simplification"), "democtezuma@gmail.com" ); - aboutData.setOrganizationDomain( "kde.org" ); //Set this for the DBUS ID app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); diff --git a/app/resultsview.h b/app/resultsview.h --- a/app/resultsview.h +++ b/app/resultsview.h @@ -36,7 +36,7 @@ Q_OBJECT public: - explicit ResultsView( QWidget *parent = 0, const char *name = 0 ); + explicit ResultsView( QWidget *parent = nullptr, const char *name = nullptr ); void addResult( Entry *result, bool common = false ); void addKanjiResult( Entry*, bool common = false ); diff --git a/app/searchstringinput.cpp b/app/searchstringinput.cpp --- a/app/searchstringinput.cpp +++ b/app/searchstringinput.cpp @@ -103,9 +103,9 @@ result.setProperty( "common", "1" ); } - result.setFilterType( (DictQuery::FilterType)_actionFilterRare->currentItem() ); - result.setMatchType( (DictQuery::MatchType)_actionSearchSection->currentItem() ); - result.setMatchWordType( (DictQuery::MatchWordType)_actionSelectWordType->currentItem() ); + result.setFilterType( static_cast(_actionFilterRare->currentItem() ) ); + result.setMatchType( static_cast(_actionSearchSection->currentItem() ) ); + result.setMatchWordType( static_cast(_actionSelectWordType->currentItem() ) ); return result; } @@ -130,10 +130,10 @@ DictQuery copy( query ); foreach( KToolBar *bar, _parent->toolBars() ) { - if( bar->widgetForAction( _actionFilterRare ) != NULL ) + if( bar->widgetForAction( _actionFilterRare ) != nullptr ) copy.removeProperty( "common" ); - if( bar->widgetForAction( _actionSelectWordType ) != NULL ) + if( bar->widgetForAction( _actionSelectWordType ) != nullptr ) copy.removeProperty("type"); } diff --git a/kanjibrowser/kanjibrowserview.cpp b/kanjibrowser/kanjibrowserview.cpp --- a/kanjibrowser/kanjibrowserview.cpp +++ b/kanjibrowser/kanjibrowserview.cpp @@ -35,7 +35,7 @@ KanjiBrowserView::KanjiBrowserView( QWidget *parent ) : QWidget( parent ) -, _currentKanji( 0 ) +, _currentKanji( nullptr ) { setupUi( this ); loadSettings(); @@ -178,7 +178,7 @@ _labelFont = KanjiBrowserConfigSkeleton::self()->labelFont(); // Reload the Kanji Information page with the new font changes. - if( ! _currentKanji == 0 ) + if( (! _currentKanji) == 0 ) { showKanjiInformation( _currentKanji ); } @@ -207,7 +207,7 @@ void KanjiBrowserView::searchKanji( QListWidgetItem *item ) { - if( _currentKanji != NULL + if( _currentKanji != nullptr && item->text() == _currentKanji->getWord() ) { return; diff --git a/lib/dictfile.h b/lib/dictfile.h --- a/lib/dictfile.h +++ b/lib/dictfile.h @@ -118,8 +118,8 @@ * @param config the KConfigSkeleton object that is currently in use * @param parent the parent widget for your preferences dialog */ - virtual DictionaryPreferenceDialog *preferencesWidget( KConfigSkeleton *config, QWidget *parent = NULL ) - { Q_UNUSED( parent ); Q_UNUSED( config ); return NULL; } + virtual DictionaryPreferenceDialog *preferencesWidget( KConfigSkeleton *config, QWidget *parent = nullptr ) + { Q_UNUSED( parent ); Q_UNUSED( config ); return nullptr; } /** * Load information from the KConfigSkeleton that you've setup in * the above preferences widget. diff --git a/lib/dictionarymanager.h b/lib/dictionarymanager.h --- a/lib/dictionarymanager.h +++ b/lib/dictionarymanager.h @@ -130,7 +130,7 @@ * @param parent the parent widget, as per the normal Qt widget system */ static QMap - generatePreferenceDialogs( KConfigSkeleton *config, QWidget *parent = NULL ); + generatePreferenceDialogs( KConfigSkeleton *config, QWidget *parent = nullptr ); /** * Compiles a list of all fields beyond the basic three (word/pronunciation/meaning) that all dictionary * types support. This can be used to generate a preference dialog, or provide more direct references. diff --git a/radselect/radicalfile.cpp b/radselect/radicalfile.cpp --- a/radselect/radicalfile.cpp +++ b/radselect/radicalfile.cpp @@ -66,7 +66,7 @@ //Read our radical file through a eucJP codec (helpfully builtin to Qt) QTextStream t( &f ); - Radical *newestRadical = NULL; + Radical *newestRadical = nullptr; QHash< QString, QSet > krad; t.setCodec( QTextCodec::codecForName( "eucJP" ) ); @@ -81,14 +81,14 @@ else if( line.at( 0 ) == '$' ) { //Start of a new radical - if( newestRadical != NULL ) + if( newestRadical != nullptr ) { m_radicals.insert( *newestRadical, *newestRadical ); } newestRadical = new Radical( QString( line.at( 2 ) ) , line.right( 2 ).toUInt() ); } - else if( newestRadical != NULL ) + else if( newestRadical != nullptr ) { // List of m_kanji, potentially QList m_kanjiList = line.trimmed().split( "", QString::SkipEmptyParts ); @@ -99,7 +99,7 @@ } } } - if( newestRadical != NULL ) + if( newestRadical != nullptr ) { m_radicals[ *newestRadical ] = *newestRadical; delete newestRadical; diff --git a/radselect/radselect.cpp b/radselect/radselect.cpp --- a/radselect/radselect.cpp +++ b/radselect/radselect.cpp @@ -37,6 +37,8 @@ #include #include +#include + RadSelect::RadSelect() : KXmlGuiWindow() , m_view( new RadSelectView( this ) ) @@ -48,7 +50,7 @@ KStandardAction::quit( this, SLOT(close()), actionCollection() ); KStandardAction::preferences( this, SLOT(optionsPreferences()), actionCollection() ); - KStandardAction::keyBindings( (const QObject*)guiFactory(), SLOT(configureShortcuts()), actionCollection() ); + KStandardAction::keyBindings( qobject_cast(guiFactory()), SLOT(configureShortcuts()), actionCollection() ); statusBar()->show(); // Apply the create the main window and ask the mainwindow to @@ -64,7 +66,7 @@ if( ! QDBusConnection::sessionBus().isConnected() ) { qDebug() << "Session Bus not found!!" << endl; - m_dbusInterface = 0; + m_dbusInterface = nullptr; } else { diff --git a/radselect/radselectview.cpp b/radselect/radselectview.cpp --- a/radselect/radselectview.cpp +++ b/radselect/radselectview.cpp @@ -46,12 +46,12 @@ { //Setup the ui from the .ui file setupUi( this ); - m_radicalInfo = 0L; + m_radicalInfo = nullptr; //Load the radical information QString radkfilename = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kiten/radkfile"); if ( radkfilename.isNull() ) { - KMessageBox::error( 0, i18n( "Kanji radical information does not seem to " + KMessageBox::error( nullptr, i18n( "Kanji radical information does not seem to " "be installed (file kiten/radkfile), this " "file is required for this app to function." ) ); }