diff options
| author | 2021-12-17 07:06:30 -0500 | |
|---|---|---|
| committer | 2021-12-17 07:06:30 -0500 | |
| commit | 1fdc150116cad39aae5c5da407c3312b47a59e3a (patch) | |
| tree | 123c79a4d7ad2d45781ba03ce939f7539fb428d8 /SQLiteStudio3/coreSQLiteStudio/plugins | |
| parent | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff) | |
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/plugins')
12 files changed, 28 insertions, 20 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h index 2f2e62e..7eef517 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h @@ -30,7 +30,7 @@ class API_EXPORT DbPlugin : virtual public Plugin * @return Type label. * * The label is used for presenting to the user what kind of database this is. It's used on GUI - * to display database type in databases dialog. It's usually either "SQLite3" or "SQLite2", + * to display database type in databases dialog. It's usually "SQLite3", * but it may be something else, like for example encrypted database might provide "Encrypted SQLite3", * or something similar. */ diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp index 7228752..4a19489 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp @@ -45,3 +45,8 @@ bool DbPluginSqlite3::checkIfDbServedByPlugin(Db* db) const { return (db && dynamic_cast<DbSqlite3*>(db)); } + +bool DbPluginSqlite3::usesPath() const +{ + return true; +} diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h index ee522d7..79b762a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h @@ -19,6 +19,7 @@ class DbPluginSqlite3 : public BuiltInPlugin, public DbPlugin QList<DbPluginOption> getOptionsList() const; QString generateDbName(const QVariant& baseValue); bool checkIfDbServedByPlugin(Db* db) const; + bool usesPath() const; }; #endif // DBPLUGINSQLITE3_H diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h index 8c269e2..30cce28 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h @@ -87,7 +87,7 @@ class ExportPlugin : virtual public Plugin * * If exporting with this plugin is not configurable (i.e. getConfig() returns null), * then this method is not even called, so it can return anything, just to satisfy method - * return type. In that case good idea is to always return QString::null. + * return type. In that case good idea is to always return QString(). * * @see FormManager */ @@ -137,7 +137,7 @@ class ExportPlugin : virtual public Plugin * * See details http://qt-project.org/doc/qt-5/qmimedata.html#setData * - * If the plugin exports just a string, then this method can return QString::null and SqliteStudio will assume + * If the plugin exports just a string, then this method can return QString() and SqliteStudio will assume * that the data is of "text/plain" type. */ virtual QString getMimeType() const = 0; diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp index d191ae4..163e0ae 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp @@ -47,12 +47,12 @@ CfgMain* GenericExportPlugin::getConfig() QString GenericExportPlugin::getConfigFormName(ExportManager::ExportMode mode) const { UNUSED(mode); - return QString::null; + return QString(); } QString GenericExportPlugin::getMimeType() const { - return QString::null; + return QString(); } QString GenericExportPlugin::getDefaultEncoding() const diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h index ff520cd..3b7181e 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h @@ -37,7 +37,7 @@ class ImportPlugin : virtual public Plugin * @brief Provides file name filter for file dialog. * @return Filter compliant with QFileDialog documentation. * - * If your plugin does not return ImportManager::FILE_NAME, this method can simply return QString::null. + * If your plugin does not return ImportManager::FILE_NAME, this method can simply return QString(). * If your plugin does use input file name, then this method can (but don't have to) return file name filter * to match expected files when user browses for the input file. * @@ -102,7 +102,7 @@ class ImportPlugin : virtual public Plugin * * If importing with this plugin is not configurable (i.e. getConfig() returns null), * then this method is not even called, so it can return anything, just to satisfy method - * return type. In that case good idea is to always return QString::null. + * return type. In that case good idea is to always return QString(). * * @see FormManager */ diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp index fd654ad..aa1f9b1 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp @@ -5,6 +5,7 @@ #include <QFileInfo> #include <QFile> #include <QTextStream> +#include <QRandomGenerator> PopulateDictionary::PopulateDictionary() { @@ -45,7 +46,7 @@ bool PopulateDictionaryEngine::beforePopulating(Db* db, const QString& table) dictionaryPos = 0; dictionarySize = dictionary.size(); if (cfg.PopulateDictionary.Random.get()) - qsrand(QDateTime::currentDateTime().toTime_t()); + QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t()); return true; } @@ -55,7 +56,7 @@ QVariant PopulateDictionaryEngine::nextValue(bool& nextValueError) UNUSED(nextValueError); if (cfg.PopulateDictionary.Random.get()) { - int r = qrand() % dictionarySize; + int r = QRandomGenerator::system()->generate() % dictionarySize; return dictionary[r]; } else diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h index 1a1db43..962f65a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h @@ -35,7 +35,7 @@ class API_EXPORT PopulateEngine * * If populating with this plugin is not configurable (i.e. getConfig() returns null), * then this method is not even called, so it can return anything, just to satisfy method - * return type. In that case good idea is to always return QString::null. + * return type. In that case good idea is to always return QString(). * * @see FormManager */ diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp index 3258bbc..149e92b 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp @@ -2,6 +2,7 @@ #include "services/populatemanager.h" #include "common/unused.h" #include <QDateTime> +#include <QRandomGenerator> PopulateRandom::PopulateRandom() { @@ -21,7 +22,7 @@ bool PopulateRandomEngine::beforePopulating(Db* db, const QString& table) { UNUSED(db); UNUSED(table); - qsrand(QDateTime::currentDateTime().toTime_t()); + QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t()); range = cfg.PopulateRandom.MaxValue.get() - cfg.PopulateRandom.MinValue.get() + 1; return (range > 0); } @@ -29,7 +30,7 @@ bool PopulateRandomEngine::beforePopulating(Db* db, const QString& table) QVariant PopulateRandomEngine::nextValue(bool& nextValueError) { UNUSED(nextValueError); - QString randValue = QString::number((qrand() % range) + cfg.PopulateRandom.MinValue.get()); + QString randValue = QString::number((QRandomGenerator::system()->generate() % range) + cfg.PopulateRandom.MinValue.get()); return (cfg.PopulateRandom.Prefix.get() + randValue + cfg.PopulateRandom.Suffix.get()); } diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp index d9f148a..e2f8733 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp @@ -3,6 +3,8 @@ #include "common/unused.h" #include "services/populatemanager.h" +#include <QRandomGenerator> + PopulateRandomText::PopulateRandomText() { } @@ -21,7 +23,7 @@ bool PopulateRandomTextEngine::beforePopulating(Db* db, const QString& table) { UNUSED(db); UNUSED(table); - qsrand(QDateTime::currentDateTime().toTime_t()); + QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t()); range = cfg.PopulateRandomText.MaxLength.get() - cfg.PopulateRandomText.MinLength.get() + 1; chars = ""; @@ -53,7 +55,7 @@ bool PopulateRandomTextEngine::beforePopulating(Db* db, const QString& table) QVariant PopulateRandomTextEngine::nextValue(bool& nextValueError) { UNUSED(nextValueError); - int lgt = (qrand() % range) + cfg.PopulateRandomText.MinLength.get(); + int lgt = (QRandomGenerator::system()->generate() % range) + cfg.PopulateRandomText.MinLength.get(); return randStr(lgt, chars); } diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp index 79824dc..f88fa85 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp @@ -202,7 +202,7 @@ QString ScriptingQt::getErrorMessage(ScriptingPlugin::Context* context) const { ContextQt* ctx = getContext(context); if (!ctx) - return QString::null; + return QString(); return ctx->error; } diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp index 350c024..3c560ed 100644 --- a/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp @@ -1,15 +1,13 @@ #include "sqlformatterplugin.h" #include "parser/parser.h" #include "db/db.h" +#include "common/unused.h" #include <QDebug> QString SqlFormatterPlugin::format(const QString& code, Db* contextDb) { - Dialect dialect = Dialect::Sqlite3; - if (contextDb && contextDb->isValid()) - contextDb->getDialect(); - - Parser parser(dialect); + UNUSED(contextDb); + Parser parser; if (!parser.parse(code)) { qWarning() << "Could not parse SQL in order to format it. The SQL was:" << code; |
