Merge pull request #6275 from 3nids/messagelevel

unite QgsMessageLog::Level and QgsMessageBar::MessageLevel in Qgis::MessageLevel
This commit is contained in:
Denis Rouzaud 2018-02-06 05:28:17 -09:00 committed by GitHub
commit 3205c96af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
142 changed files with 610 additions and 603 deletions

View File

@ -1605,9 +1605,16 @@ QgsMarkerSymbolLayer {#qgis_api_break_3_0_QgsMarkerSymbolLayer}
- bounds() is now pure virtual and must be implemented in all subclasses.
QgsMessageBar {#qgis_api_break_3_0_QgsMessageBar}
---------------------------
- MessageLevel has been removed. Use Qgis::MessageLevel instead
QgsMessageLog {#qgis_api_break_3_0_QgsMessageLog}
---------------------------
- MessageLevel has been removed. Use Qgis::MessageLevel instead
- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::messageLog() to access an application-wide log.
QgsMessageLogViewer {#qgis_api_break_3_0_QgsMessageLogViewer}

View File

@ -1,6 +1,10 @@
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core
${CMAKE_BINARY_DIR}/src/core
${CMAKE_SOURCE_DIR}/src/core
${CMAKE_SOURCE_DIR}/src/core/geometry
${CMAKE_BINARY_DIR}/src/core
${CMAKE_BINARY_DIR}/src/core/geometry
${Qt5Core_INCLUDE_DIRS}
)

View File

@ -22,7 +22,7 @@ from qgis.PyQt.QtCore import Qt, QObject, QEvent, QCoreApplication, QFileInfo, Q
from qgis.PyQt.QtGui import QFont, QFontMetrics, QColor, QKeySequence, QCursor, QFontDatabase
from qgis.PyQt.QtWidgets import QShortcut, QMenu, QApplication, QWidget, QGridLayout, QSpacerItem, QSizePolicy, QFileDialog, QTabWidget, QTreeWidgetItem, QFrame, QLabel, QToolButton, QMessageBox
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs, QsciStyle
from qgis.core import QgsApplication, QgsSettings
from qgis.core import Qgis, QgsApplication, QgsSettings
from qgis.gui import QgsMessageBar
from qgis.utils import OverrideCursor
import sys
@ -1265,7 +1265,7 @@ class EditorTabWidget(QTabWidget):
self.settings.setValue("pythonConsole/lastDirPath", tabWidget.path)
def widgetMessageBar(self, iface, text, level, timed=True):
messageLevel = [QgsMessageBar.INFO, QgsMessageBar.WARNING, QgsMessageBar.CRITICAL]
messageLevel = [Qgis.Info, Qgis.Warning, Qgis.Critical]
if timed:
timeout = iface.messageTimeout()
else:

View File

@ -25,7 +25,7 @@ from qgis.PyQt.QtCore import Qt, QCoreApplication
from qgis.PyQt.QtGui import QColor, QFont, QKeySequence, QFontDatabase
from qgis.PyQt.QtWidgets import QGridLayout, QSpacerItem, QSizePolicy, QShortcut, QMenu, QApplication
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython
from qgis.core import QgsApplication, QgsSettings
from qgis.core import Qgis, QgsApplication, QgsSettings
from qgis.gui import QgsMessageBar
import sys
@ -293,4 +293,4 @@ class ShellOutputScintilla(QsciScintilla):
def widgetMessageBar(self, iface, text):
timeout = iface.messageTimeout()
self.infoBar.pushMessage(text, QgsMessageBar.INFO, timeout)
self.infoBar.pushMessage(text, Qgis.Info, timeout)

View File

@ -139,7 +139,7 @@ def register_function(function, arg_count, group, usesgeometry=False,
msg = QCoreApplication.translate("UserExpressions",
"The user expression {0} already exists and could not be unregistered.").format(
name)
QgsMessageLog.logMessage(msg + "\n", msgtitle, QgsMessageLog.WARNING)
QgsMessageLog.logMessage(msg + "\n", msgtitle, Qgis.Warning)
return None
function.__name__ = name

View File

@ -35,6 +35,15 @@ The Qgis class provides global constants for use throughout the application.
static const char *QGIS_DEV_VERSION;
enum MessageLevel
{
Info,
Warning,
Critical,
Success,
None
};
enum DataType
{
UnknownDataType,

View File

@ -29,27 +29,18 @@ QgsMessageLog is not usually directly created, but rather accessed through
%End
public:
enum MessageLevel
{
ALL,
INFO,
WARNING,
CRITICAL,
NONE
};
QgsMessageLog();
%Docstring
Constructor for QgsMessageLog.
%End
static void logMessage( const QString &message, const QString &tag = QString(), MessageLevel level = QgsMessageLog::WARNING );
static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::Warning );
%Docstring
add a message to the instance (and create it if necessary)
%End
signals:
void messageReceived( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void messageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level );
void messageReceived( bool received );
@ -71,7 +62,7 @@ be the right choice for apps without GUI.
QgsMessageLogConsole();
public slots:
void logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
};
/************************************************************************

View File

@ -930,7 +930,7 @@ Emitted when the canvas has been assigned a different map theme.
.. versionadded:: 3.0
%End
void messageEmitted( const QString &title, const QString &message, QgsMessageBar::MessageLevel = QgsMessageBar::INFO );
void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::Info );
%Docstring
emit a message (usually to be displayed in a message bar)
%End

View File

@ -187,7 +187,7 @@ The values is calculated from searchRadiusMM().
%End
signals:
void messageEmitted( const QString &message, QgsMessageBar::MessageLevel = QgsMessageBar::INFO );
void messageEmitted( const QString &message, Qgis::MessageLevel = Qgis::Info );
%Docstring
emit a message
%End

View File

@ -21,13 +21,6 @@ A bar for displaying non-blocking messages to the user.
#include "qgsmessagebar.h"
%End
public:
enum MessageLevel
{
INFO,
WARNING,
CRITICAL,
SUCCESS
};
QgsMessageBar( QWidget *parent /TransferThis/ = 0 );
%Docstring
@ -43,13 +36,13 @@ The message bar will take ownership of the item.
:param item: Item to display
%End
QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, MessageLevel level = INFO, int duration = 0 );
QgsMessageBarItem *pushWidget( QWidget *widget /Transfer/, Qgis::MessageLevel level = Qgis::Info, int duration = 0 );
%Docstring
Display a widget as a message on the bar after hiding the currently visible one
and putting it in a stack.
:param widget: message widget to display
:param level: is QgsMessageBar.INFO, WARNING, CRITICAL or SUCCESS
:param level: is Qgis.Info, Warning, Critical or Success
:param duration: timeout duration of message in seconds, 0 value indicates no timeout
%End
@ -76,11 +69,11 @@ make out a widget containing title and message to be displayed on the bar
make out a widget containing title and message to be displayed on the bar
%End
void pushMessage( const QString &text, MessageLevel level = INFO, int duration = 5 );
void pushMessage( const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = 5 );
%Docstring
convenience method for pushing a message to the bar
%End
void pushMessage( const QString &title, const QString &text, MessageLevel level = INFO, int duration = 5 );
void pushMessage( const QString &title, const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = 5 );
%Docstring
convenience method for pushing a message with title to the bar
%End

View File

@ -17,22 +17,22 @@ class QgsMessageBarItem : QWidget
#include "qgsmessagebaritem.h"
%End
public:
QgsMessageBarItem( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent /TransferThis/ = 0 );
QgsMessageBarItem( const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
make out a widget containing a message to be displayed on the bar
%End
QgsMessageBarItem( const QString &title, const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent /TransferThis/ = 0 );
QgsMessageBarItem( const QString &title, const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
make out a widget containing title and message to be displayed on the bar
%End
QgsMessageBarItem( const QString &title, const QString &text, QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent /TransferThis/ = 0 );
QgsMessageBarItem( const QString &title, const QString &text, QWidget *widget, Qgis::MessageLevel level = Qgis::Info, int duration = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
make out a widget containing title, message and widget to be displayed on the bar
%End
QgsMessageBarItem( QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent /TransferThis/ = 0 );
QgsMessageBarItem( QWidget *widget, Qgis::MessageLevel level = Qgis::Info, int duration = 0, QWidget *parent /TransferThis/ = 0 );
%Docstring
make out a widget containing a widget to be displayed on the bar
%End
@ -51,9 +51,9 @@ Returns the text for the message.
Returns the title for the message.
%End
QgsMessageBarItem *setLevel( QgsMessageBar::MessageLevel level );
QgsMessageBarItem *setLevel( Qgis::MessageLevel level );
QgsMessageBar::MessageLevel level() const;
Qgis::MessageLevel level() const;
%Docstring
Returns the message level for the message.
%End

View File

@ -29,7 +29,7 @@ QgsApplication.messageLog() instance.
public slots:
void logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
%Docstring
Logs a ``message`` to the viewer.
%End

View File

@ -56,7 +56,7 @@ add repository to the repository listWidget
show the Plugin Manager window and optionally open tab tabIndex
%End
virtual void pushMessage( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = -1 ) = 0;
virtual void pushMessage( const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = -1 ) = 0;
%Docstring
show the given message in the Plugin Manager internal message bar
%End

View File

@ -29,7 +29,7 @@ from qgis.PyQt.QtWidgets import QMainWindow, QApplication, QMenu, QTabWidget, QG
from qgis.PyQt.QtGui import QIcon, QKeySequence
from qgis.gui import QgsMessageBar
from qgis.core import QgsSettings, QgsMapLayer
from qgis.core import Qgis, QgsSettings, QgsMapLayer
from qgis.utils import OverrideCursor
from .info_viewer import InfoViewer
@ -146,7 +146,7 @@ class DBManager(QMainWindow):
db = self.tree.currentDatabase()
if db is None:
self.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."),
QgsMessageBar.INFO, self.iface.messageTimeout())
Qgis.Info, self.iface.messageTimeout())
return
outUri = db.uri()
@ -162,7 +162,7 @@ class DBManager(QMainWindow):
def exportActionSlot(self):
table = self.tree.currentTable()
if table is None:
self.infoBar.pushMessage(self.tr("Select the table you want export to file."), QgsMessageBar.INFO,
self.infoBar.pushMessage(self.tr("Select the table you want export to file."), Qgis.Info,
self.iface.messageTimeout())
return
@ -170,7 +170,7 @@ class DBManager(QMainWindow):
if inLayer.type() != QgsMapLayer.VectorLayer:
self.infoBar.pushMessage(
self.tr("Select a vector or a tabular layer you want export."),
QgsMessageBar.WARNING, self.iface.messageTimeout())
Qgis.Warning, self.iface.messageTimeout())
return
from .dlg_export_vector import DlgExportVector
@ -184,7 +184,7 @@ class DBManager(QMainWindow):
db = self.tree.currentDatabase()
if db is None:
self.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."),
QgsMessageBar.INFO, self.iface.messageTimeout())
Qgis.Info, self.iface.messageTimeout())
# force displaying of the message, it appears on the first tab (i.e. Info)
self.tabs.setCurrentIndex(0)
return

View File

@ -27,7 +27,7 @@ from .connector import GPKGDBConnector
from qgis.PyQt.QtCore import Qt, QFileInfo
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QApplication, QAction, QFileDialog
from qgis.core import QgsDataSourceUri, QgsSettings
from qgis.core import Qgis, QgsDataSourceUri, QgsSettings
from qgis.gui import QgsMessageBar
from ..plugin import DBPlugin, Database, Table, VectorTable, RasterTable, TableField, TableIndex, TableTrigger, \
@ -143,7 +143,7 @@ class GPKGDatabase(Database):
try:
if not isinstance(item, (DBPlugin, Table)) or item.database() is None:
parent.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
finally:
QApplication.setOverrideCursor(Qt.WaitCursor)

View File

@ -27,7 +27,7 @@ from qgis.PyQt.QtWidgets import QApplication, QAction, QMenu, QInputDialog, QMes
from qgis.PyQt.QtGui import QKeySequence, QIcon
from qgis.gui import QgsMessageBar
from qgis.core import QgsSettings
from qgis.core import Qgis, QgsSettings
from ..db_plugins import createDbPlugin
@ -357,7 +357,7 @@ class Database(DbItemObject):
else:
QApplication.restoreOverrideCursor()
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Cannot delete the selected item."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
QApplication.setOverrideCursor(Qt.WaitCursor)
def createSchemaActionSlot(self, item, action, parent):
@ -366,7 +366,7 @@ class Database(DbItemObject):
if not isinstance(item, (DBPlugin, Schema, Table)) or item.database() is None:
parent.infoBar.pushMessage(
QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
(schema, ok) = QInputDialog.getText(parent, QApplication.translate("DBManagerPlugin", "New schema"),
QApplication.translate("DBManagerPlugin", "Enter new schema name"))
@ -383,7 +383,7 @@ class Database(DbItemObject):
if not isinstance(item, Schema):
parent.infoBar.pushMessage(
QApplication.translate("DBManagerPlugin", "Select an empty schema for deletion."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
@ -414,7 +414,7 @@ class Database(DbItemObject):
if not hasattr(item, 'database') or item.database() is None:
parent.infoBar.pushMessage(
QApplication.translate("DBManagerPlugin", "No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
from ..dlg_create_table import DlgCreateTable
@ -426,7 +426,7 @@ class Database(DbItemObject):
try:
if not isinstance(item, Table) or item.isView:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table to edit."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
from ..dlg_table_properties import DlgTableProperties
@ -440,7 +440,7 @@ class Database(DbItemObject):
if not isinstance(item, Table):
parent.infoBar.pushMessage(
QApplication.translate("DBManagerPlugin", "Select a table/view for deletion."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
@ -458,7 +458,7 @@ class Database(DbItemObject):
try:
if not isinstance(item, Table) or item.isView:
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table to empty it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
@ -485,7 +485,7 @@ class Database(DbItemObject):
try:
if not isinstance(item, Table):
parent.infoBar.pushMessage(QApplication.translate("DBManagerPlugin", "Select a table/view."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
finally:
QApplication.setOverrideCursor(Qt.WaitCursor)

View File

@ -29,7 +29,7 @@ from .connector import PostGisDBConnector
from qgis.PyQt.QtCore import Qt, QRegExp
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction, QApplication, QMessageBox
from qgis.core import QgsSettings
from qgis.core import Qgis, QgsSettings
from qgis.gui import QgsMessageBar
from ..plugin import ConnectionError, InvalidDataException, DBPlugin, Database, Schema, Table, VectorTable, RasterTable, \
@ -152,7 +152,7 @@ class PGDatabase(Database):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, Table) or item.isView:
parent.infoBar.pushMessage(self.tr("Select a table for vacuum analyze."), QgsMessageBar.INFO,
parent.infoBar.pushMessage(self.tr("Select a table for vacuum analyze."), Qgis.Info,
parent.iface.messageTimeout())
return
finally:
@ -164,7 +164,7 @@ class PGDatabase(Database):
QApplication.restoreOverrideCursor()
try:
if not isinstance(item, PGTable) or item._relationType != 'm':
parent.infoBar.pushMessage(self.tr("Select a materialized view for refresh."), QgsMessageBar.INFO,
parent.infoBar.pushMessage(self.tr("Select a materialized view for refresh."), Qgis.Info,
parent.iface.messageTimeout())
return
finally:

View File

@ -25,7 +25,7 @@ from builtins import str
from qgis.PyQt.QtWidgets import QAction
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsProject, QgsVectorLayer, QgsWkbTypes, QgsLayerTreeGroup
from qgis.core import Qgis, QgsProject, QgsVectorLayer, QgsWkbTypes, QgsLayerTreeGroup
from qgis.gui import QgsMessageBar
import os
@ -71,7 +71,7 @@ def run(item, action, mainwindow):
isTopoSchema = False
if not hasattr(item, 'schema'):
mainwindow.infoBar.pushMessage("Invalid topology", u'Select a topology schema to continue.', QgsMessageBar.INFO,
mainwindow.infoBar.pushMessage("Invalid topology", u'Select a topology schema to continue.', Qgis.Info,
mainwindow.iface.messageTimeout())
return False
@ -85,12 +85,12 @@ def run(item, action, mainwindow):
if not isTopoSchema:
mainwindow.infoBar.pushMessage("Invalid topology",
u'Schema "{0}" is not registered in topology.topology.'.format(
item.schema().name), QgsMessageBar.WARNING,
item.schema().name), Qgis.Warning,
mainwindow.iface.messageTimeout())
return False
if (res[0] < 0):
mainwindow.infoBar.pushMessage("WARNING", u'Topology "{0}" is registered as having a srid of {1} in topology.topology, we will assume 0 (for unknown)'.format(item.schema().name, res[0]), QgsMessageBar.WARNING, mainwindow.iface.messageTimeout())
mainwindow.infoBar.pushMessage("WARNING", u'Topology "{0}" is registered as having a srid of {1} in topology.topology, we will assume 0 (for unknown)'.format(item.schema().name, res[0]), Qgis.Warning, mainwindow.iface.messageTimeout())
toposrid = '0'
else:
toposrid = str(res[0])

View File

@ -27,7 +27,7 @@ from .connector import SpatiaLiteDBConnector
from qgis.PyQt.QtCore import Qt, QFileInfo
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QApplication, QAction, QFileDialog
from qgis.core import QgsDataSourceUri, QgsSettings
from qgis.core import Qgis, QgsDataSourceUri, QgsSettings
from qgis.gui import QgsMessageBar
from ..plugin import DBPlugin, Database, Table, VectorTable, RasterTable, TableField, TableIndex, TableTrigger, \
@ -141,7 +141,7 @@ class SLDatabase(Database):
try:
if not isinstance(item, (DBPlugin, Table)) or item.database() is None:
parent.infoBar.pushMessage(self.tr("No database selected or you are not connected to it."),
QgsMessageBar.INFO, parent.iface.messageTimeout())
Qgis.Info, parent.iface.messageTimeout())
return
finally:
QApplication.setOverrideCursor(Qt.WaitCursor)

View File

@ -23,7 +23,7 @@ email : brush.tyler@gmail.com
from qgis.PyQt.QtCore import pyqtSignal
from qgis.PyQt.QtWidgets import QWidget, QTreeView, QMenu, QLabel
from qgis.core import QgsProject, QgsMessageLog
from qgis.core import Qgis, QgsProject, QgsMessageLog
from qgis.gui import QgsMessageBar, QgsMessageBarItem
from .db_model import DBModel, PluginItem
@ -171,7 +171,7 @@ class DBTree(QTreeView):
msgLabel.setWordWrap(True)
msgLabel.linkActivated.connect(self.mainWindow.iface.mainWindow().findChild(QWidget, "MessageLog").show)
msgLabel.linkActivated.connect(self.mainWindow.iface.mainWindow().raise_)
self.mainWindow.infoBar.pushItem(QgsMessageBarItem(msgLabel, QgsMessageBar.WARNING))
self.mainWindow.infoBar.pushItem(QgsMessageBarItem(msgLabel, Qgis.Warning))
def reconnect(self):
db = self.currentDatabase()

View File

@ -25,7 +25,7 @@ from qgis.PyQt.QtGui import QColor, QCursor
from qgis.PyQt.QtWidgets import QApplication
from qgis.gui import QgsMapCanvas, QgsMessageBar
from qgis.core import QgsVectorLayer, QgsProject, QgsSettings
from qgis.core import Qgis, QgsVectorLayer, QgsProject, QgsSettings
from qgis.utils import OverrideCursor
from .db_plugins.plugin import Table
@ -102,7 +102,7 @@ class LayerPreview(QgsMapCanvas):
self.parent.tabs.setCurrentWidget(self.parent.info)
self.parent.infoBar.pushMessage(
QApplication.translate("DBManagerPlugin", "Unable to find a valid unique field"),
QgsMessageBar.WARNING, self.parent.iface.messageTimeout())
Qgis.Warning, self.parent.iface.messageTimeout())
return
uri = table.database().uri()

View File

@ -35,7 +35,8 @@ import psycopg2
from osgeo import gdal
from osgeo import ogr
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsVectorFileWriter,
QgsProcessingFeedback,
QgsProcessingUtils,
@ -84,7 +85,7 @@ class GdalUtils:
os.putenv('PATH', envval)
fused_command = ' '.join([str(c) for c in commands])
QgsMessageLog.logMessage(fused_command, 'Processing', QgsMessageLog.INFO)
QgsMessageLog.logMessage(fused_command, 'Processing', Qgis.Info)
feedback.pushInfo('GDAL command:')
feedback.pushCommandInfo(fused_command)
feedback.pushInfo('GDAL command output:')
@ -114,7 +115,7 @@ class GdalUtils:
str(e) + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(
len(loglines), u'\n'.join(loglines[-10:])))
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', QgsMessageLog.INFO)
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', Qgis.Info)
GdalUtils.consoleOutput = loglines
@staticmethod

View File

@ -33,7 +33,8 @@ import importlib
from qgis.PyQt.QtCore import QCoreApplication, QUrl
from qgis.core import (QgsRasterLayer,
from qgis.core import (Qgis,
QgsRasterLayer,
QgsApplication,
QgsMapLayer,
QgsProcessingUtils,
@ -232,7 +233,7 @@ class Grass7Algorithm(QgsProcessingAlgorithm):
hasRasterOutput = True
line = lines.readline().strip('\n').strip()
except Exception as e:
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(self.descriptionFile, line), self.tr('Processing'), QgsMessageLog.CRITICAL)
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(self.descriptionFile, line), self.tr('Processing'), Qgis.Critical)
raise e
param = QgsProcessingParameterExtent(
@ -382,7 +383,7 @@ class Grass7Algorithm(QgsProcessingAlgorithm):
feedback.pushCommandInfo(line)
loglines.append(line)
if ProcessingConfig.getSetting(Grass7Utils.GRASS_LOG_COMMANDS):
QgsMessageLog.logMessage("\n".join(loglines), self.tr('Processing'), QgsMessageLog.INFO)
QgsMessageLog.logMessage("\n".join(loglines), self.tr('Processing'), Qgis.Info)
Grass7Utils.executeGrass(self.commands, feedback, self.outputCommands)
@ -478,7 +479,7 @@ class Grass7Algorithm(QgsProcessingAlgorithm):
# Add the default parameters commands
self.commands.append(command)
QgsMessageLog.logMessage('processInputs end. Commands: {}'.format(self.commands), 'Grass7', QgsMessageLog.INFO)
QgsMessageLog.logMessage('processInputs end. Commands: {}'.format(self.commands), 'Grass7', Qgis.Info)
def processCommand(self, parameters, context, delOutputs=False):
"""
@ -610,7 +611,7 @@ class Grass7Algorithm(QgsProcessingAlgorithm):
command += ' --overwrite'
self.commands.append(command)
QgsMessageLog.logMessage('processCommands end. Commands: {}'.format(self.commands), 'Grass7', QgsMessageLog.INFO)
QgsMessageLog.logMessage('processCommands end. Commands: {}'.format(self.commands), 'Grass7', Qgis.Info)
def vectorOutputType(self, parameters, context):
"""Determine vector output types for outputs"""

View File

@ -27,7 +27,8 @@ __revision__ = '$Format:%H$'
import os
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingProvider,
QgsVectorFileWriter,
QgsMessageLog,
@ -106,10 +107,10 @@ class Grass7AlgorithmProvider(QgsProcessingProvider):
if alg.name().strip() != '':
algs.append(alg)
else:
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}').format(descriptionFile), self.tr('Processing'), QgsMessageLog.CRITICAL)
QgsMessageLog.logMessage(self.tr('Could not open GRASS GIS 7 algorithm: {0}').format(descriptionFile), self.tr('Processing'), Qgis.Critical)
except Exception as e:
QgsMessageLog.logMessage(
self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(descriptionFile, str(e)), self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Could not open GRASS GIS 7 algorithm: {0}\n{1}').format(descriptionFile, str(e)), self.tr('Processing'), Qgis.Critical)
return algs
def loadAlgorithms(self):

View File

@ -31,7 +31,8 @@ import shlex
import subprocess
import os
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingUtils,
QgsMessageLog)
from qgis.PyQt.QtCore import QCoreApplication
@ -349,7 +350,7 @@ class Grass7Utils:
loglines.append(Grass7Utils.tr('GRASS GIS 7 execution console output'))
grassOutDone = False
command, grassenv = Grass7Utils.prepareGrassExecution(commands)
#QgsMessageLog.logMessage('exec: {}'.format(command), 'DEBUG', QgsMessageLog.INFO)
#QgsMessageLog.logMessage('exec: {}'.format(command), 'DEBUG', Qgis.Info)
# For MS-Windows, we need to hide the console window.
if isWindows():
@ -408,7 +409,7 @@ class Grass7Utils:
feedback.pushConsoleInfo(line)
if ProcessingConfig.getSetting(Grass7Utils.GRASS_LOG_CONSOLE):
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', QgsMessageLog.INFO)
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', Qgis.Info)
# GRASS session is used to hold the layers already exported or
# produced in GRASS between multiple calls to GRASS algorithms.

View File

@ -29,7 +29,8 @@ import os
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsFeature,
from qgis.core import (Qgis,
QgsFeature,
QgsFeatureSink,
QgsGeometry,
QgsFeatureRequest,
@ -120,7 +121,7 @@ class SymmetricalDifference(QgisAlgorithm):
sink.addFeature(outFeat, QgsFeatureSink.FastInsert)
except:
QgsMessageLog.logMessage(self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'),
self.tr('Processing'), QgsMessageLog.WARNING)
self.tr('Processing'), Qgis.Warning)
continue
count += 1
@ -152,7 +153,7 @@ class SymmetricalDifference(QgisAlgorithm):
sink.addFeature(outFeat, QgsFeatureSink.FastInsert)
except:
QgsMessageLog.logMessage(self.tr('Feature geometry error: One or more output features ignored due to invalid geometry.'),
self.tr('Processing'), QgsMessageLog.WARNING)
self.tr('Processing'), Qgis.Warning)
continue
count += 1

View File

@ -32,7 +32,8 @@ from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QApplication, QMessageBox
from qgis.PyQt.QtGui import QCursor
from qgis.core import (QgsExpressionContextUtils,
from qgis.core import (Qgis,
QgsExpressionContextUtils,
QgsProcessingFeedback,
QgsSettings,
QgsMapLayerProxyModel,
@ -258,7 +259,7 @@ class FieldsCalculatorDialog(BASE, WIDGET):
def error(self, text):
QMessageBox.critical(self, "Error", text)
QgsMessageLog.logMessage(text, self.tr('Processing'), QgsMessageLog.CRITICAL)
QgsMessageLog.logMessage(text, self.tr('Processing'), Qgis.Critical)
def wasExecuted(self):
return self._wasExecuted

View File

@ -29,7 +29,8 @@ __revision__ = '$Format:%H$'
import os
import importlib
from copy import deepcopy
from qgis.core import (QgsProcessingUtils,
from qgis.core import (Qgis,
QgsProcessingUtils,
QgsProcessingException,
QgsMessageLog,
QgsProcessing,
@ -323,7 +324,7 @@ class SagaAlgorithm(SagaAlgorithmBase):
feedback.pushCommandInfo(line)
loglines.append(line)
if ProcessingConfig.getSetting(SagaUtils.SAGA_LOG_COMMANDS):
QgsMessageLog.logMessage('\n'.join(loglines), self.tr('Processing'), QgsMessageLog.INFO)
QgsMessageLog.logMessage('\n'.join(loglines), self.tr('Processing'), Qgis.Info)
SagaUtils.executeSaga(feedback)
if crs is not None:

View File

@ -28,7 +28,8 @@ __revision__ = '$Format:%H$'
import os
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProcessingProvider,
from qgis.core import (Qgis,
QgsProcessingProvider,
QgsProcessingUtils,
QgsApplication,
QgsMessageLog)
@ -81,13 +82,13 @@ class SagaAlgorithmProvider(QgsProcessingProvider):
version = SagaUtils.getInstalledVersion(True)
if version is None:
QgsMessageLog.logMessage(self.tr('Problem with SAGA installation: SAGA was not found or is not correctly installed'),
self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Processing'), Qgis.Critical)
return
if not version.startswith('2.3.'):
QgsMessageLog.logMessage(self.tr('Problem with SAGA installation: unsupported SAGA version found.'),
self.tr('Processing'),
QgsMessageLog.CRITICAL)
Qgis.Critical)
return
self.algs = []
@ -100,10 +101,10 @@ class SagaAlgorithmProvider(QgsProcessingProvider):
self.algs.append(alg)
else:
QgsMessageLog.logMessage(self.tr('Could not open SAGA algorithm: {}'.format(descriptionFile)),
self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Processing'), Qgis.Critical)
except Exception as e:
QgsMessageLog.logMessage(self.tr('Could not open SAGA algorithm: {}\n{}'.format(descriptionFile, str(e))),
self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Processing'), Qgis.Critical)
self.algs.append(SplitRGBBands())
for a in self.algs:

View File

@ -31,7 +31,8 @@ import subprocess
import time
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingUtils,
QgsMessageLog)
from processing.core.ProcessingConfig import ProcessingConfig
@ -196,4 +197,4 @@ def executeSaga(feedback):
pass
if ProcessingConfig.getSetting(SAGA_LOG_CONSOLE):
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', QgsMessageLog.INFO)
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', Qgis.Info)

View File

@ -32,7 +32,8 @@ from qgis.PyQt.QtCore import QCoreApplication, Qt
from qgis.PyQt.QtWidgets import QMessageBox, QPushButton, QSizePolicy, QDialogButtonBox
from qgis.PyQt.QtGui import QColor, QPalette
from qgis.core import (QgsProject,
from qgis.core import (Qgis,
QgsProject,
QgsApplication,
QgsProcessingUtils,
QgsProcessingParameterDefinition,
@ -275,7 +276,7 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase):
pass
self.messageBar().clearWidgets()
self.messageBar().pushMessage("", self.tr("Wrong or missing parameter value: {0}").format(e.parameter.description()),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
def finish(self, successful, result, context, feedback):
keepOpen = not successful or ProcessingConfig.getSetting(ProcessingConfig.KEEP_DIALOG_OPEN)

View File

@ -28,7 +28,8 @@ __revision__ = '$Format:%H$'
import sys
from copy import deepcopy
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsFeature,
from qgis.core import (Qgis,
QgsFeature,
QgsVectorFileWriter,
QgsProcessingFeedback,
QgsSettings,
@ -60,7 +61,7 @@ def execute(alg, parameters, context=None, feedback=None):
results, ok = alg.run(parameters, context, feedback)
return ok, results
except QgsProcessingException as e:
QgsMessageLog.logMessage(str(sys.exc_info()[0]), 'Processing', QgsMessageLog.CRITICAL)
QgsMessageLog.logMessage(str(sys.exc_info()[0]), 'Processing', Qgis.Critical)
if feedback is not None:
feedback.reportError(e.msg)
return False, {}

View File

@ -39,7 +39,8 @@ from qgis.core import (QgsProcessingParameterDefinition,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber,
QgsProcessingOutputString,
QgsProject)
QgsProject,
Qgis)
from qgis.gui import (QgsMessageBar,
QgsProcessingAlgorithmDialogBase)
@ -89,7 +90,7 @@ class BatchAlgorithmDialog(QgsProcessingAlgorithmDialogBase):
if not param.checkValueIsAcceptable(wrapper.value()):
self.messageBar().pushMessage("", self.tr('Wrong or missing parameter value: {0} (row {1})').format(
param.description(), row + 1),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
return
col += 1
count_visible_outputs = 0
@ -111,7 +112,7 @@ class BatchAlgorithmDialog(QgsProcessingAlgorithmDialogBase):
else:
self.messageBar().pushMessage("", self.tr('Wrong or missing output value: {0} (row {1})').format(
out.description(), row + 1),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
return
alg_parameters.append(parameters)

View File

@ -31,7 +31,8 @@ import json
from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QTableWidgetItem, QComboBox, QHeaderView, QFileDialog, QMessageBox
from qgis.PyQt.QtCore import QDir, QFileInfo
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsSettings,
QgsProcessingParameterDefinition)
from qgis.gui import QgsMessageBar
@ -194,7 +195,7 @@ class BatchPanel(BASE, WIDGET):
if not param.checkValueIsAcceptable(wrapper.value(), context):
self.parent.bar.pushMessage("", self.tr('Wrong or missing parameter value: {0} (row {1})').format(
param.description(), row + 1),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
return
algParams[param.name()] = param.valueAsPythonString(wrapper.value(), context)
col += 1
@ -209,7 +210,7 @@ class BatchPanel(BASE, WIDGET):
else:
self.parent.bar.pushMessage("", self.tr('Wrong or missing output value: {0} (row {1})').format(
out.description(), row + 1),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
return
toSave.append({self.PARAMETERS: algParams, self.OUTPUTS: algOutputs})

View File

@ -31,7 +31,8 @@ import json
from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QDialog, QTreeWidgetItem
from qgis.core import (QgsMessageLog,
from qgis.core import (Qgis,
QgsMessageLog,
QgsProcessingUtils,
QgsProcessingParameterDefinition,
QgsProcessingModelAlgorithm)
@ -64,7 +65,7 @@ class HelpEditionDialog(BASE, WIDGET):
with open(helpfile) as f:
self.descriptions = json.load(f)
except Exception:
QgsMessageLog.logMessage(self.tr('Cannot open help file: {0}').format(helpfile), self.tr('Processing'), QgsMessageLog.WARNING)
QgsMessageLog.logMessage(self.tr('Cannot open help file: {0}').format(helpfile), self.tr('Processing'), Qgis.Warning)
self.currentName = self.ALG_DESC
if self.ALG_DESC in self.descriptions:

View File

@ -30,7 +30,8 @@ import os
import traceback
from qgis.PyQt.QtWidgets import QApplication
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProject,
from qgis.core import (Qgis,
QgsProject,
QgsProcessingFeedback,
QgsProcessingUtils,
QgsMapLayer,
@ -80,7 +81,7 @@ def handleAlgorithmResults(alg, context, feedback=None, showResults=True):
else:
wrongLayers.append(str(l))
except Exception:
QgsMessageLog.logMessage(QCoreApplication.translate('Postprocessing', "Error loading result layer:") + "\n" + traceback.format_exc(), 'Processing', QgsMessageLog.CRITICAL)
QgsMessageLog.logMessage(QCoreApplication.translate('Postprocessing', "Error loading result layer:") + "\n" + traceback.format_exc(), 'Processing', Qgis.Critical)
wrongLayers.append(str(l))
i += 1

View File

@ -29,7 +29,8 @@ import os
from qgis.PyQt.QtXml import QDomDocument
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingProvider,
QgsMessageLog,
QgsProcessingModelAlgorithm,
@ -120,7 +121,7 @@ class ModelerAlgorithmProvider(QgsProcessingProvider):
self.algs.append(alg)
else:
QgsMessageLog.logMessage(self.tr('Could not load model {0}', 'ModelerAlgorithmProvider').format(descriptionFile),
self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Processing'), Qgis.Critical)
except WrongModelException as e:
QgsMessageLog.logMessage(self.tr('Could not load model {0}\n{1}', 'ModelerAlgorithmProvider').format(descriptionFile, e.msg),
self.tr('Processing'), QgsMessageLog.CRITICAL)
self.tr('Processing'), Qgis.Critical)

View File

@ -44,7 +44,8 @@ from qgis.PyQt.QtWidgets import (QGraphicsView,
from qgis.PyQt.QtGui import QIcon, QImage, QPainter, QKeySequence
from qgis.PyQt.QtSvg import QSvgGenerator
from qgis.PyQt.QtPrintSupport import QPrinter
from qgis.core import (QgsApplication,
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingAlgorithm,
QgsSettings,
QgsMessageLog,
@ -324,7 +325,7 @@ class ModelerDialog(BASE, WIDGET):
def runModel(self):
if len(self.model.childAlgorithms()) == 0:
self.bar.pushMessage("", "Model doesn't contain any algorithm and/or parameter and can't be executed", level=QgsMessageBar.WARNING, duration=5)
self.bar.pushMessage("", "Model doesn't contain any algorithm and/or parameter and can't be executed", level=Qgis.Warning, duration=5)
return
dlg = AlgorithmDialog(self.model)
@ -395,7 +396,7 @@ class ModelerDialog(BASE, WIDGET):
img.save(filename)
self.bar.pushMessage("", "Model was correctly exported as image", level=QgsMessageBar.SUCCESS, duration=5)
self.bar.pushMessage("", "Model was correctly exported as image", level=Qgis.Success, duration=5)
self.repaintModel(controls=True)
def exportAsPdf(self):
@ -423,7 +424,7 @@ class ModelerDialog(BASE, WIDGET):
self.scene.render(painter, printerRect, totalRect)
painter.end()
self.bar.pushMessage("", "Model was correctly exported as PDF", level=QgsMessageBar.SUCCESS, duration=5)
self.bar.pushMessage("", "Model was correctly exported as PDF", level=Qgis.Success, duration=5)
self.repaintModel(controls=True)
def exportAsSvg(self):
@ -451,7 +452,7 @@ class ModelerDialog(BASE, WIDGET):
self.scene.render(painter, svgRect, totalRect)
painter.end()
self.bar.pushMessage("", "Model was correctly exported as SVG", level=QgsMessageBar.SUCCESS, duration=5)
self.bar.pushMessage("", "Model was correctly exported as SVG", level=Qgis.Success, duration=5)
self.repaintModel(controls=True)
def exportAsPython(self):
@ -468,7 +469,7 @@ class ModelerDialog(BASE, WIDGET):
with codecs.open(filename, 'w', encoding='utf-8') as fout:
fout.write(text)
self.bar.pushMessage("", "Model was correctly exported as python script", level=QgsMessageBar.SUCCESS, duration=5)
self.bar.pushMessage("", "Model was correctly exported as python script", level=Qgis.Success, duration=5)
def saveModel(self, saveAs):
if str(self.textGroup.text()).strip() == '' \
@ -503,7 +504,7 @@ class ModelerDialog(BASE, WIDGET):
"the 'Save as...' option."))
return
self.update_model.emit()
self.bar.pushMessage("", "Model was correctly saved", level=QgsMessageBar.SUCCESS, duration=5)
self.bar.pushMessage("", "Model was correctly saved", level=Qgis.Success, duration=5)
self.hasChanged = False
@ -529,7 +530,7 @@ class ModelerDialog(BASE, WIDGET):
else:
QgsMessageLog.logMessage(self.tr('Could not load model {0}').format(filename),
self.tr('Processing'),
QgsMessageLog.CRITICAL)
Qgis.Critical)
QMessageBox.critical(self, self.tr('Could not open model'),
self.tr('The selected model could not be loaded.\n'
'See the log for more information.'))

View File

@ -35,7 +35,8 @@ from qgis.PyQt.QtWidgets import (QDialog, QDialogButtonBox, QLabel, QLineEdit,
QFrame, QPushButton, QSizePolicy, QVBoxLayout,
QHBoxLayout, QWidget)
from qgis.core import (QgsProcessingParameterDefinition,
from qgis.core import (Qgis,
QgsProcessingParameterDefinition,
QgsProcessingParameterPoint,
QgsProcessingParameterExtent,
QgsProcessingModelAlgorithm,
@ -310,7 +311,7 @@ class ModelerParametersDialog(QDialog):
except InvalidParameterValue:
self.bar.pushMessage(self.tr("Error"),
self.tr("Wrong or missing value for parameter '{}'").format(param.description()),
level=QgsMessageBar.WARNING)
level=Qgis.Warning)
return None
if isinstance(val, QgsProcessingModelChildParameterSource):
@ -325,7 +326,7 @@ class ModelerParametersDialog(QDialog):
or (subval is None and not param.flags() & QgsProcessingParameterDefinition.FlagOptional):
self.bar.pushMessage(self.tr("Error"), self.tr("Wrong or missing value for parameter '{}'").format(
param.description()),
level=QgsMessageBar.WARNING)
level=Qgis.Warning)
return None
alg.addParameterSources(param.name(), val)

View File

@ -81,7 +81,7 @@ class PreconfiguredAlgorithmDialog(AlgorithmDialog):
e.widget.setPalette(palette)
self.messageBar().pushMessage("", self.tr('Missing parameter value: {0}').format(
e.parameter.description()),
level=QgsMessageBar.WARNING, duration=5)
level=Qgis.Warning, duration=5)
return
except:
QMessageBox.critical(self,

View File

@ -30,7 +30,7 @@ import shutil
from qgis.PyQt.QtWidgets import QFileDialog
from qgis.core import QgsApplication, QgsMessageLog, QgsSettings
from qgis.core import Qgis, QgsApplication, QgsMessageLog, QgsSettings
from processing.gui.ToolboxAction import ToolboxAction
@ -61,7 +61,7 @@ class AddScriptFromFileAction(ToolboxAction):
except OSError as e:
QgsMessageLog.logMessage("Could not copy script '{}'\n{}".format(s, str(e)),
"Processing",
QgsMessageLog.WARNING)
Qgis.Warning)
if valid > 0:
QgsApplication.processingRegistry().providerById("script").refreshAlgorithms()

View File

@ -31,7 +31,8 @@ import importlib
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProcessingAlgorithm,
from qgis.core import (Qgis,
QgsProcessingAlgorithm,
QgsProcessingFeatureBasedAlgorithm,
QgsMessageLog
)
@ -73,7 +74,7 @@ def loadAlgorithm(moduleName, filePath):
except ImportError as e:
QgsMessageLog.logMessage("Could not import script algorithm '{}' from '{}'\n{}".format(moduleName, filePath, str(e)),
"Processing",
QgsMessageLog.CRITICAL)
Qgis.Critical)
def findAlgorithmSource(className):

View File

@ -32,7 +32,7 @@ from qgis.PyQt.QtWidgets import QMessageBox, QLabel, QFrame, QApplication, QFile
from qgis.PyQt.QtNetwork import QNetworkRequest
import qgis
from qgis.core import QgsApplication, QgsNetworkAccessManager, QgsSettings
from qgis.core import Qgis, QgsApplication, QgsNetworkAccessManager, QgsSettings
from qgis.gui import QgsMessageBar
from qgis.utils import (iface, startPlugin, unloadPlugin, loadPlugin,
reloadPlugin, updateAvailablePlugins)
@ -369,7 +369,7 @@ class QgsPluginInstaller(QObject):
self.exportPluginsToManager()
if infoString[0]:
level = error and QgsMessageBar.CRITICAL or QgsMessageBar.INFO
level = error and Qgis.Critical or Qgis.Info
msg = "<b>%s</b>" % infoString[0]
if infoString[1]:
msg += "<b>:</b> %s" % infoString[1]
@ -401,7 +401,7 @@ class QgsPluginInstaller(QObject):
if result:
QApplication.restoreOverrideCursor()
msg = "<b>%s:</b>%s" % (self.tr("Plugin uninstall failed"), result)
iface.pluginManagerInterface().pushMessage(msg, QgsMessageBar.CRITICAL)
iface.pluginManagerInterface().pushMessage(msg, Qgis.Critical)
else:
# safe remove
try:
@ -421,7 +421,7 @@ class QgsPluginInstaller(QObject):
plugins.rebuild()
self.exportPluginsToManager()
QApplication.restoreOverrideCursor()
iface.pluginManagerInterface().pushMessage(self.tr("Plugin uninstalled successfully"), QgsMessageBar.INFO)
iface.pluginManagerInterface().pushMessage(self.tr("Plugin uninstalled successfully"), Qgis.Info)
# ----------------------------------------- #
def addRepository(self):
@ -433,7 +433,7 @@ class QgsPluginInstaller(QObject):
return
for i in list(repositories.all().values()):
if dlg.editURL.text().strip() == i["url"]:
iface.pluginManagerInterface().pushMessage(self.tr("Unable to add another repository with the same URL!"), QgsMessageBar.WARNING)
iface.pluginManagerInterface().pushMessage(self.tr("Unable to add another repository with the same URL!"), Qgis.Warning)
return
settings = QgsSettings()
settings.beginGroup(reposGroup)
@ -472,7 +472,7 @@ class QgsPluginInstaller(QObject):
return # nothing to do if canceled
for i in list(repositories.all().values()):
if dlg.editURL.text().strip() == i["url"] and dlg.editURL.text().strip() != repositories.all()[reposName]["url"]:
iface.pluginManagerInterface().pushMessage(self.tr("Unable to add another repository with the same URL!"), QgsMessageBar.WARNING)
iface.pluginManagerInterface().pushMessage(self.tr("Unable to add another repository with the same URL!"), Qgis.Warning)
return
# delete old repo from QgsSettings and create new one
settings = QgsSettings()
@ -501,7 +501,7 @@ class QgsPluginInstaller(QObject):
settings = QgsSettings()
settings.beginGroup(reposGroup)
if settings.value(reposName + "/url", "", type=str) == officialRepo[1]:
iface.pluginManagerInterface().pushMessage(self.tr("You can't remove the official QGIS Plugin Repository. You can disable it if needed."), QgsMessageBar.WARNING)
iface.pluginManagerInterface().pushMessage(self.tr("You can't remove the official QGIS Plugin Repository. You can disable it if needed."), Qgis.Warning)
return
warning = self.tr("Are you sure you want to remove the following repository?") + "\n" + reposName
if QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), warning, QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
@ -588,7 +588,7 @@ class QgsPluginInstaller(QObject):
infoString = (self.tr("Plugin installed successfully"), "")
if infoString[0]:
level = error and QgsMessageBar.CRITICAL or QgsMessageBar.INFO
level = error and Qgis.Critical or Qgis.Info
msg = "<b>%s</b>" % infoString[0]
if infoString[1]:
msg += "<b>:</b> %s" % infoString[1]

View File

@ -338,7 +338,7 @@ class Repositories(QObject):
"QgsPluginInstaller",
"Update of network request with authentication "
"credentials FAILED for configuration '{0}'").format(authcfg)
iface.pluginManagerInterface().pushMessage(msg, QgsMessageBar.WARNING)
iface.pluginManagerInterface().pushMessage(msg, Qgis.Warning)
self.mRepositories[key]["QRequest"] = None
return
self.mRepositories[key]["QRequest"].setAttribute(QNetworkRequest.User, key)

View File

@ -76,7 +76,7 @@ Returns the maximum number of cached layers.
:return: the number of cached layers.
%End
QgsMessageLog::MessageLevel logLevel() const;
Qgis::MessageLevel logLevel() const;
%Docstring
Returns the log level.

View File

@ -29,7 +29,7 @@ import glob
import traceback
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication, QgsMessageLog
from qgis.core import Qgis, QgsApplication, QgsMessageLog
def load_user_expressions(path):
@ -50,7 +50,7 @@ def load_user_expressions(path):
error = traceback.format_exc()
msgtitle = QCoreApplication.translate("UserExpressions", "User expressions")
msg = QCoreApplication.translate("UserExpressions", "The user expression {0} is not valid").format(name)
QgsMessageLog.logMessage(msg + "\n" + error, msgtitle, QgsMessageLog.WARNING)
QgsMessageLog.logMessage(msg + "\n" + error, msgtitle, Qgis.Warning)
userpythonhome = os.path.join(QgsApplication.qgisSettingsDirPath(), "python")

View File

@ -124,7 +124,7 @@ def showException(type, value, tb, msg, messagebar=False):
button = QPushButton(QCoreApplication.translate("Python", "View message log"), pressed=show_message_log)
widget.layout().addWidget(stackbutton)
widget.layout().addWidget(button)
bar.pushWidget(widget, QgsMessageBar.WARNING)
bar.pushWidget(widget, Qgis.Warning)
def show_message_log(pop_error=True):

View File

@ -136,7 +136,7 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
QgsGeometry outputGeometry = f.geometry().buffer( distance, segments, endCapStyle, joinStyle, miterLimit );
if ( !outputGeometry )
{
QgsMessageLog::logMessage( QObject::tr( "Error calculating buffer for feature %1" ).arg( f.id() ), QObject::tr( "Processing" ), QgsMessageLog::WARNING );
QgsMessageLog::logMessage( QObject::tr( "Error calculating buffer for feature %1" ).arg( f.id() ), QObject::tr( "Processing" ), Qgis::Warning );
}
if ( dissolve )
bufferedGeometriesForDissolve << outputGeometry;

View File

@ -243,7 +243,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked()
}
else
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Could not open layer list" ), QgsMessageBar::CRITICAL, 4 );
QgisApp::instance()->messageBar()->pushMessage( tr( "Could not open layer list" ), Qgis::Critical, 4 );
}
}
@ -268,11 +268,11 @@ void QgsDwgImportDialog::pbImportDrawing_clicked()
QString error;
if ( importer.import( leDrawing->text(), error, cbExpandInserts->isChecked(), cbUseCurves->isChecked() ) )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Drawing import completed." ), QgsMessageBar::INFO, 4 );
QgisApp::instance()->messageBar()->pushMessage( tr( "Drawing import completed." ), Qgis::Info, 4 );
}
else
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Drawing import failed (%1)" ).arg( error ), QgsMessageBar::CRITICAL, 4 );
QgisApp::instance()->messageBar()->pushMessage( tr( "Drawing import failed (%1)" ).arg( error ), Qgis::Critical, 4 );
}
pbLoadDatabase_clicked();

View File

@ -1682,7 +1682,7 @@ void QgsLayoutDesignerDialog::print()
}
mMessageBar->pushMessage( tr( "Print layout" ),
message,
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -1772,7 +1772,7 @@ void QgsLayoutDesignerDialog::exportToRaster()
case QgsLayoutExporter::Success:
mMessageBar->pushMessage( tr( "Export layout" ),
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), QDir::toNativeSeparators( fileNExt.first ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
case QgsLayoutExporter::PrintError:
@ -1876,7 +1876,7 @@ void QgsLayoutDesignerDialog::exportToPdf()
{
mMessageBar->pushMessage( tr( "Export layout" ),
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), QDir::toNativeSeparators( outputFileName ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -1983,7 +1983,7 @@ void QgsLayoutDesignerDialog::exportToSvg()
{
mMessageBar->pushMessage( tr( "Export layout" ),
tr( "Successfully exported layout to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), QDir::toNativeSeparators( outputFileName ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -2259,7 +2259,7 @@ void QgsLayoutDesignerDialog::printAtlas()
}
mMessageBar->pushMessage( tr( "Print atlas" ),
message,
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -2421,7 +2421,7 @@ void QgsLayoutDesignerDialog::exportAtlasToRaster()
case QgsLayoutExporter::Success:
mMessageBar->pushMessage( tr( "Export atlas" ),
tr( "Successfully exported atlas to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( dir ).toString(), QDir::toNativeSeparators( dir ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
case QgsLayoutExporter::IteratorError:
@ -2573,7 +2573,7 @@ void QgsLayoutDesignerDialog::exportAtlasToSvg()
{
mMessageBar->pushMessage( tr( "Export atlas" ),
tr( "Successfully exported atlas to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( dir ).toString(), QDir::toNativeSeparators( dir ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -2787,13 +2787,13 @@ void QgsLayoutDesignerDialog::exportAtlasToPdf()
{
mMessageBar->pushMessage( tr( "Export atlas" ),
tr( "Successfully exported atlas to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), QDir::toNativeSeparators( outputFileName ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
}
else
{
mMessageBar->pushMessage( tr( "Export atlas" ),
tr( "Successfully exported atlas to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( outputFileName ).toString(), QDir::toNativeSeparators( outputFileName ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
}
break;
}
@ -2904,7 +2904,7 @@ void QgsLayoutDesignerDialog::exportReportToRaster()
case QgsLayoutExporter::Success:
mMessageBar->pushMessage( tr( "Export report" ),
tr( "Successfully exported report to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( dir ).toString(), QDir::toNativeSeparators( dir ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
case QgsLayoutExporter::IteratorError:
@ -3020,7 +3020,7 @@ void QgsLayoutDesignerDialog::exportReportToSvg()
{
mMessageBar->pushMessage( tr( "Export report" ),
tr( "Successfully exported report to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( dir ).toString(), QDir::toNativeSeparators( dir ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -3150,7 +3150,7 @@ void QgsLayoutDesignerDialog::exportReportToPdf()
{
mMessageBar->pushMessage( tr( "Export report" ),
tr( "Successfully exported report to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( fi.path() ).toString(), QDir::toNativeSeparators( outputFileName ) ),
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}
@ -3254,7 +3254,7 @@ void QgsLayoutDesignerDialog::printReport()
}
mMessageBar->pushMessage( tr( "Print report" ),
message,
QgsMessageBar::SUCCESS, 0 );
Qgis::Success, 0 );
break;
}

View File

@ -73,7 +73,7 @@ void QgsAppPluginManagerInterface::addToRepositoryList( const QMap<QString, QStr
mPluginManager->addToRepositoryList( repository );
}
void QgsAppPluginManagerInterface::pushMessage( const QString &text, QgsMessageBar::MessageLevel level, int duration )
void QgsAppPluginManagerInterface::pushMessage( const QString &text, Qgis::MessageLevel level, int duration )
{
mPluginManager->pushMessage( text, level, duration );
}

View File

@ -57,7 +57,7 @@ class QgsAppPluginManagerInterface : public QgsPluginManagerInterface
void showPluginManager( int tabIndex = -1 ) override;
//! show the given message in the Plugin Manager internal message bar
void pushMessage( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = -1 ) override;
void pushMessage( const QString &text, Qgis::MessageLevel level = Qgis::Info, int duration = -1 ) override;
private:

View File

@ -1258,11 +1258,11 @@ void QgsPluginManager::sendVote( int pluginId, int vote )
QgsPythonRunner::eval( QStringLiteral( "pyplugin_installer.instance().sendVote('%1', '%2')" ).arg( pluginId ).arg( vote ), response );
if ( response == QLatin1String( "True" ) )
{
pushMessage( tr( "Vote sent successfully" ), QgsMessageBar::INFO );
pushMessage( tr( "Vote sent successfully" ), Qgis::Info );
}
else
{
pushMessage( tr( "Sending vote to the plugin repository failed." ), QgsMessageBar::WARNING );
pushMessage( tr( "Sending vote to the plugin repository failed." ), Qgis::Warning );
}
}
@ -1610,7 +1610,7 @@ void QgsPluginManager::showEvent( QShowEvent *e )
void QgsPluginManager::pushMessage( const QString &text, QgsMessageBar::MessageLevel level, int duration )
void QgsPluginManager::pushMessage( const QString &text, Qgis::MessageLevel level, int duration )
{
if ( duration == -1 )
{

View File

@ -181,7 +181,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
void clearRepositoryFilter();
//! show the given message in the Plugin Manager internal message bar
void pushMessage( const QString &text, QgsMessageBar::MessageLevel level, int duration = -1 );
void pushMessage( const QString &text, Qgis::MessageLevel level, int duration = -1 );
#ifndef WITH_QTWEBKIT
//! vote button was clicked

View File

@ -616,14 +616,14 @@ void QgisApp::validateCrs( QgsCoordinateReferenceSystem &srs )
sAuthId = QgsProject::instance()->crs().authid();
srs.createFromOgcWmsCrs( sAuthId );
QgsDebugMsg( "Layer srs set from project: " + sAuthId );
messageBar()->pushMessage( tr( "CRS was undefined" ), tr( "defaulting to project CRS %1 - %2" ).arg( sAuthId, srs.description() ), QgsMessageBar::WARNING, messageTimeout() );
messageBar()->pushMessage( tr( "CRS was undefined" ), tr( "defaulting to project CRS %1 - %2" ).arg( sAuthId, srs.description() ), Qgis::Warning, messageTimeout() );
}
else ///Projections/defaultBehavior==useGlobal
{
sAuthId = mySettings.value( QStringLiteral( "Projections/layerDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString();
srs.createFromOgcWmsCrs( sAuthId );
QgsDebugMsg( "Layer srs set from default: " + sAuthId );
messageBar()->pushMessage( tr( "CRS was undefined" ), tr( "defaulting to CRS %1 - %2" ).arg( sAuthId, srs.description() ), QgsMessageBar::WARNING, messageTimeout() );
messageBar()->pushMessage( tr( "CRS was undefined" ), tr( "defaulting to CRS %1 - %2" ).arg( sAuthId, srs.description() ), Qgis::Warning, messageTimeout() );
}
}
@ -1018,7 +1018,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
QString caption = tr( "QGIS - %1 ('%2')" ).arg( Qgis::QGIS_VERSION, Qgis::QGIS_RELEASE_NAME );
setWindowTitle( caption );
QgsMessageLog::logMessage( tr( "QGIS starting..." ), QString(), QgsMessageLog::INFO );
QgsMessageLog::logMessage( tr( "QGIS starting..." ), QString(), Qgis::Info );
// set QGIS specific srs validation
connect( this, &QgisApp::customCrsValidation,
@ -1158,9 +1158,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mSplash->showMessage( tr( "QGIS Ready!" ), Qt::AlignHCenter | Qt::AlignBottom );
QgsMessageLog::logMessage( QgsApplication::showSettings(), QString(), QgsMessageLog::INFO );
QgsMessageLog::logMessage( QgsApplication::showSettings(), QString(), Qgis::Info );
QgsMessageLog::logMessage( tr( "QGIS Ready!" ), QString(), QgsMessageLog::INFO );
QgsMessageLog::logMessage( tr( "QGIS Ready!" ), QString(), Qgis::Info );
mMapTipsVisible = false;
// This turns on the map tip if they where active in the last session
@ -2125,7 +2125,7 @@ void QgisApp::showPythonDialog()
{
QString className, text;
mPythonUtils->getError( className, text );
messageBar()->pushMessage( tr( "Error" ), tr( "Failed to open Python console:" ) + '\n' + className + ": " + text, QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Error" ), tr( "Failed to open Python console:" ) + '\n' + className + ": " + text, Qgis::Warning );
}
#ifdef Q_OS_MAC
else
@ -4269,14 +4269,14 @@ bool QgisApp::addVectorLayers( const QStringList &layerQStringList, const QStrin
else
{
QString msg = tr( "%1 doesn't have any layers." ).arg( src );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, Qgis::Critical, messageTimeout() );
delete layer;
}
}
else
{
QString msg = tr( "%1 is not a valid or recognized data source." ).arg( src );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, Qgis::Critical, messageTimeout() );
// since the layer is bad, stomp on it
delete layer;
@ -4705,7 +4705,7 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
else
{
QString msg = tr( "%1 is not a valid or recognized data source" ).arg( composedURI );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, Qgis::Critical, messageTimeout() );
delete layer;
}
}
@ -4802,7 +4802,7 @@ void QgisApp::addDatabaseLayers( QStringList const &layerPathList, QString const
QLabel *msgLabel = new QLabel( tr( "%1 is an invalid layer and cannot be loaded. Please check the <a href=\"#messageLog\">message log</a> for further info." ).arg( layerPath ), messageBar() );
msgLabel->setWordWrap( true );
connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show );
QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING );
QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, Qgis::Warning );
messageBar()->pushItem( item );
delete layer;
}
@ -5125,7 +5125,7 @@ void QgisApp::fileNewFromDefaultTemplate()
}
messageBar()->pushMessage( tr( "Open Template Project" ),
msgTxt.arg( projectTemplate ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
void QgisApp::fileOpenAfterLaunch()
@ -5188,7 +5188,7 @@ void QgisApp::fileOpenAfterLaunch()
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "Failed to open: %1" ).arg( projPath ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
@ -5211,7 +5211,7 @@ void QgisApp::fileOpenAfterLaunch()
{
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "Not valid project file: %1" ).arg( projPath ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -5224,21 +5224,21 @@ void QgisApp::fileOpenAfterLaunch()
{
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "Project failed to open: %1" ).arg( projPath ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
if ( projPath.endsWith( QLatin1String( "project_default.qgs" ) ) )
{
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "Default template has been reopened: %1" ).arg( projPath ),
QgsMessageBar::INFO );
Qgis::Info );
}
}
else
{
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "File not found: %1" ).arg( projPath ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
}
@ -5285,7 +5285,7 @@ void QgisApp::newVectorLayer()
QLabel *msgLabel = new QLabel( tr( "Layer creation failed. Please check the <a href=\"#messageLog\">message log</a> for further information." ), messageBar() );
msgLabel->setWordWrap( true );
connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show );
QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING );
QgsMessageBarItem *item = new QgsMessageBarItem( msgLabel, Qgis::Warning );
messageBar()->pushItem( item );
}
}
@ -5342,19 +5342,19 @@ void QgisApp::showRasterCalculator()
}
messageBar()->pushMessage( tr( "Raster calculator" ),
tr( "Calculation complete." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
break;
case QgsRasterCalculator::CreateOutputError:
messageBar()->pushMessage( tr( "Raster calculator" ),
tr( "Could not create destination file." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
break;
case QgsRasterCalculator::InputLayerError:
messageBar()->pushMessage( tr( "Raster calculator" ),
tr( "Could not read input layer." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
break;
case QgsRasterCalculator::Canceled:
@ -5363,13 +5363,13 @@ void QgisApp::showRasterCalculator()
case QgsRasterCalculator::ParserError:
messageBar()->pushMessage( tr( "Raster calculator" ),
tr( "Could not parse raster formula." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
break;
case QgsRasterCalculator::MemoryError:
messageBar()->pushMessage( tr( "Raster calculator" ),
tr( "Insufficient memory available for operation." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
break;
}
@ -5533,7 +5533,7 @@ bool QgisApp::addProject( const QString &projectFile )
tr( "Security warning" ),
tr( "project macros have been disabled." ),
btnEnableMacros,
QgsMessageBar::WARNING,
Qgis::Warning,
0,
mInfoBar );
@ -5631,7 +5631,7 @@ bool QgisApp::fileSave()
{
messageBar()->pushMessage( tr( "Insufficient permissions" ),
tr( "The project file is not writable." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return false;
}
}
@ -5753,11 +5753,11 @@ void QgisApp::dxfExport()
QApplication::setOverrideCursor( Qt::BusyCursor );
if ( dxfExport.writeToFile( &dxfFile, d.encoding() ) == 0 )
{
messageBar()->pushMessage( tr( "DXF export completed" ), QgsMessageBar::INFO, 4 );
messageBar()->pushMessage( tr( "DXF export completed" ), Qgis::Info, 4 );
}
else
{
messageBar()->pushMessage( tr( "DXF export failed" ), QgsMessageBar::CRITICAL, 4 );
messageBar()->pushMessage( tr( "DXF export failed" ), Qgis::Critical, 4 );
}
QApplication::restoreOverrideCursor();
}
@ -5776,7 +5776,7 @@ void QgisApp::openLayerDefinition( const QString &path )
if ( !loaded )
{
QgsDebugMsg( errorMessage );
messageBar()->pushMessage( tr( "Error loading layer definition" ), errorMessage, QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Error loading layer definition" ), errorMessage, Qgis::Warning );
}
}
@ -5787,7 +5787,7 @@ void QgisApp::openTemplate( const QString &fileName )
if ( !templateFile.open( QIODevice::ReadOnly ) )
{
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not read template file" ), QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not read template file" ), Qgis::Warning );
return;
}
@ -5800,7 +5800,7 @@ void QgisApp::openTemplate( const QString &fileName )
QgsLayoutDesignerDialog *designer = createNewPrintLayout( title );
if ( !designer )
{
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not create print layout" ), QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not create print layout" ), Qgis::Warning );
return;
}
@ -5815,7 +5815,7 @@ void QgisApp::openTemplate( const QString &fileName )
if ( !loadedOk )
{
designer->close();
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not load template file" ), QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Load template" ), tr( "Could not load template file" ), Qgis::Warning );
}
}
@ -6549,7 +6549,7 @@ void QgisApp::labelingFontNotFound( QgsVectorLayer *vlayer, const QString &fontf
tr( "Labeling" ),
tr( "Font for layer <b><u>%1</u></b> was not found (<i>%2</i>). %3" ).arg( vlayer->name(), fontfamily, substitute ),
btnOpenPrefs,
QgsMessageBar::WARNING,
Qgis::Warning,
0,
messageBar() );
messageBar()->pushItem( fontMsg );
@ -6582,7 +6582,7 @@ void QgisApp::commitError( QgsVectorLayer *vlayer )
tr( "Commit errors" ),
tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ),
showMore,
QgsMessageBar::WARNING,
Qgis::Warning,
0,
messageBar() );
messageBar()->pushItem( errorMsg );
@ -6654,7 +6654,7 @@ void QgisApp::diagramProperties()
{
messageBar()->pushMessage( tr( "Diagram Properties" ),
tr( "Please select a vector layer first" ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
return;
}
@ -6843,7 +6843,7 @@ void QgisApp::saveAsRasterFile( QgsRasterLayer *rasterLayer )
messageBar()->pushMessage( tr( "Saving Done" ),
tr( "Successfully saved raster layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
QgsMessageBar::SUCCESS, messageTimeout() );
Qgis::Success, messageTimeout() );
} );
// when an error occurs:
@ -6891,7 +6891,7 @@ void QgisApp::saveAsLayerDefinition()
bool saved = QgsLayerDefinition::exportLayerDefinition( path, mLayerTreeView->selectedNodes(), errorMessage );
if ( !saved )
{
messageBar()->pushMessage( tr( "Error saving layer definition file" ), errorMessage, QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Error saving layer definition file" ), errorMessage, Qgis::Warning );
}
}
@ -7046,7 +7046,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOpt
this->emit layerSavedAs( vlayer, vectorFilename );
this->messageBar()->pushMessage( tr( "Saving Done" ),
tr( "Successfully saved vector layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
QgsMessageBar::SUCCESS, messageTimeout() );
Qgis::Success, messageTimeout() );
}
);
@ -7090,7 +7090,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "No Layer Selected" ),
tr( "To delete features, you must select a vector layer in the legend" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -7099,7 +7099,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "No Vector Layer Selected" ),
tr( "Deleting features only works on vector layers" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -7107,7 +7107,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "Provider does not support deletion" ),
tr( "Data provider does not support deleting features" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -7115,7 +7115,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "Layer not editable" ),
tr( "The current layer is not editable. Choose 'Start editing' in the digitizing toolbar." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -7125,7 +7125,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "No Features Selected" ),
tr( "The current layer has no selected features" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
//display a warning
@ -7140,7 +7140,7 @@ void QgisApp::deleteSelected( QgsMapLayer *layer, QWidget *parent, bool promptCo
{
messageBar()->pushMessage( tr( "Problem deleting features" ),
tr( "A problem occurred during deletion of %1 feature(s)" ).arg( numberOfSelectedFeatures - deletedCount ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
else
{
@ -7629,7 +7629,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
{
messageBar()->pushMessage( tr( "No active layer" ),
tr( "No active layer found. Please select a layer in the layer list" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -7639,7 +7639,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Layer not editable" ),
tr( "The merge features tool only works on vector layers." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7648,7 +7648,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Layer not editable" ),
tr( "Merging features can only be done for layers in editing mode." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7660,7 +7660,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Not enough features selected" ),
tr( "The merge tool requires at least two selected features." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7704,7 +7704,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Invalid result" ),
tr( "Could not store value '%1' in field of type %2" ).arg( merged.at( i ).toString(), fld.typeName() ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
}
else
@ -7728,7 +7728,7 @@ void QgisApp::modifyAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "No active layer" ),
tr( "Please select a layer in the layer list" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7738,7 +7738,7 @@ void QgisApp::modifyAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Invalid layer" ),
tr( "The merge features tool only works on vector layers." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
if ( !vl->isEditable() )
@ -7746,7 +7746,7 @@ void QgisApp::modifyAttributesOfSelectedFeatures()
messageBar()->pushMessage(
tr( "Layer not editable" ),
tr( "Modifying features can only be done for layers in editing mode." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7770,7 +7770,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "No active layer" ),
tr( "Please select a layer in the layer list" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( activeMapLayer );
@ -7779,7 +7779,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Invalid layer" ),
tr( "The merge features tool only works on vector layers." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
if ( !vl->isEditable() )
@ -7787,7 +7787,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Layer not editable" ),
tr( "Merging features can only be done for layers in editing mode." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7799,7 +7799,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Not enough features selected" ),
tr( "The merge tool requires at least two selected features" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7815,7 +7815,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Merge failed" ),
tr( "An error occurred during the merge operation." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
}
return;
}
@ -7834,7 +7834,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Not enough features selected" ),
tr( "The merge tool requires at least two selected features" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -7851,7 +7851,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Merge failed" ),
tr( "An error occurred during the merge operation." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
}
return;
}
@ -7877,7 +7877,7 @@ void QgisApp::mergeSelectedFeatures()
messageBar()->pushMessage(
tr( "Invalid result" ),
tr( "Could not store value '%1' in field of type %2." ).arg( attrs.at( i ).toString(), vl->fields().at( i ).typeName() ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
attrs[i] = val;
}
@ -7991,7 +7991,7 @@ void QgisApp::invertSelection()
messageBar()->pushMessage(
tr( "No active vector layer" ),
tr( "To invert selection, choose a vector layer in the legend" ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
return;
}
@ -8007,7 +8007,7 @@ void QgisApp::selectAll()
messageBar()->pushMessage(
tr( "No active vector layer" ),
tr( "To select all, choose a vector layer in the legend." ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
return;
}
@ -8023,7 +8023,7 @@ void QgisApp::selectByExpression()
messageBar()->pushMessage(
tr( "No active vector layer" ),
tr( "To select features, choose a vector layer in the legend." ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
return;
}
@ -8043,7 +8043,7 @@ void QgisApp::selectByForm()
messageBar()->pushMessage(
tr( "No active vector layer" ),
tr( "To select features, choose a vector layer in the legend." ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
return;
}
@ -8198,20 +8198,20 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
{
messageBar()->pushMessage( tr( "Paste features" ),
tr( "no features could be successfully pasted." ),
QgsMessageBar::WARNING, messageTimeout() );
Qgis::Warning, messageTimeout() );
}
else if ( nCopiedFeatures == nTotalFeatures )
{
messageBar()->pushMessage( tr( "Paste features" ),
tr( "%1 features were successfully pasted." ).arg( nCopiedFeatures ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
}
else
{
messageBar()->pushMessage( tr( "Paste features" ),
tr( "%1 of %2 features could be successfully pasted." ).arg( nCopiedFeatures ).arg( nTotalFeatures ),
QgsMessageBar::WARNING, messageTimeout() );
Qgis::Warning, messageTimeout() );
}
pasteVectorLayer->triggerRepaint();
@ -8311,7 +8311,7 @@ std::unique_ptr<QgsVectorLayer> QgisApp::pasteToNewMemoryVector()
// should not happen
messageBar()->pushMessage( tr( "Paste features" ),
tr( "No features in clipboard." ),
QgsMessageBar::WARNING, messageTimeout() );
Qgis::Warning, messageTimeout() );
return nullptr;
}
else if ( typeCounts.size() > 1 )
@ -8319,7 +8319,7 @@ std::unique_ptr<QgsVectorLayer> QgisApp::pasteToNewMemoryVector()
QString typeName = wkbType != QgsWkbTypes::NoGeometry ? QgsWkbTypes::displayString( wkbType ) : QStringLiteral( "none" );
messageBar()->pushMessage( tr( "Paste features" ),
tr( "Multiple geometry types found, features with geometry different from %1 will be created without geometry." ).arg( typeName ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
}
std::unique_ptr< QgsVectorLayer > layer( QgsMemoryProviderUtils::createMemoryLayer( QStringLiteral( "pasted_features" ), QgsFields(), wkbType, clipboard()->crs() ) );
@ -8328,7 +8328,7 @@ std::unique_ptr<QgsVectorLayer> QgisApp::pasteToNewMemoryVector()
{
messageBar()->pushMessage( tr( "Paste features" ),
tr( "Cannot create new layer." ),
QgsMessageBar::WARNING, messageTimeout() );
Qgis::Warning, messageTimeout() );
return nullptr;
}
@ -8340,7 +8340,7 @@ std::unique_ptr<QgsVectorLayer> QgisApp::pasteToNewMemoryVector()
{
messageBar()->pushMessage( tr( "Paste features" ),
tr( "Cannot create field %1 (%2,%3)" ).arg( f.name(), f.typeName(), QVariant::typeToName( f.type() ) ),
QgsMessageBar::WARNING, messageTimeout() );
Qgis::Warning, messageTimeout() );
return nullptr;
}
}
@ -8395,7 +8395,7 @@ void QgisApp::copyStyle( QgsMapLayer *sourceLayer )
{
messageBar()->pushMessage( tr( "Cannot copy style" ),
errorMsg,
QgsMessageBar::CRITICAL, messageTimeout() );
Qgis::Critical, messageTimeout() );
return;
}
// Copies data in text form as well, so the XML can be pasted into a text editor
@ -8426,7 +8426,7 @@ void QgisApp::pasteStyle( QgsMapLayer *destinationLayer )
messageBar()->pushMessage( tr( "Cannot parse style" ),
errorMsg,
QgsMessageBar::CRITICAL, messageTimeout() );
Qgis::Critical, messageTimeout() );
return;
}
@ -8441,7 +8441,7 @@ void QgisApp::pasteStyle( QgsMapLayer *destinationLayer )
{
messageBar()->pushMessage( tr( "Cannot paste style" ),
errorMsg,
QgsMessageBar::CRITICAL, messageTimeout() );
Qgis::Critical, messageTimeout() );
return;
}
@ -8558,7 +8558,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
mActionToggleEditing->setEnabled( false );
messageBar()->pushMessage( tr( "Start editing failed" ),
tr( "Provider cannot be opened for editing" ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return false;
}
@ -8615,7 +8615,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
{
messageBar()->pushMessage( tr( "Error" ),
tr( "Problems during roll back" ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
res = false;
}
freezeCanvases( false );
@ -9007,7 +9007,7 @@ void QgisApp::projectCrsChanged()
{
messageBar()->pushMessage( tr( "Datum transforms" ),
tr( "Project CRS changed and datum transforms might need to be adapted." ),
QgsMessageBar::WARNING,
Qgis::Warning,
5 );
}
}
@ -9075,7 +9075,7 @@ void QgisApp::removeLayer()
{
messageBar()->pushMessage( tr( "No legend entries selected" ),
tr( "Select the layers and groups you want to remove in the legend." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -9171,7 +9171,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )
msgBars.append( new QgsMessageBarItem(
tr( "Duplicate layer: " ),
tr( "%1 (duplication resulted in invalid layer)" ).arg( selectedLyr->name() ),
QgsMessageBar::WARNING,
Qgis::Warning,
0,
mInfoBar ) );
continue;
@ -9184,7 +9184,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )
tr( "%1 (%2 type unsupported)" )
.arg( selectedLyr->name(),
!unSppType.isEmpty() ? QStringLiteral( "'" ) + unSppType + "' " : QLatin1String( "" ) ),
QgsMessageBar::WARNING,
Qgis::Warning,
0,
mInfoBar ) );
continue;
@ -9216,7 +9216,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )
if ( !errMsg.isEmpty() )
messageBar()->pushMessage( errMsg,
tr( "Cannot copy style to duplicated layer." ),
QgsMessageBar::CRITICAL, messageTimeout() );
Qgis::Critical, messageTimeout() );
}
dupLayer = nullptr;
@ -9591,7 +9591,7 @@ void QgisApp::loadPythonSupport()
// init python runner
QgsPythonRunner::setInstance( new QgsPythonRunnerImpl( mPythonUtils ) );
QgsMessageLog::logMessage( tr( "Python support ENABLED :-) " ), QString(), QgsMessageLog::INFO );
QgsMessageLog::logMessage( tr( "Python support ENABLED :-) " ), QString(), Qgis::Info );
}
#endif
}
@ -9750,7 +9750,7 @@ void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRasterMinMaxOrigin::Lim
{
messageBar()->pushMessage( tr( "No Layer Selected" ),
tr( "To perform a full histogram stretch, you need to have a raster layer selected." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -9759,7 +9759,7 @@ void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRasterMinMaxOrigin::Lim
{
messageBar()->pushMessage( tr( "No Layer Selected" ),
tr( "To perform a full histogram stretch, you need to have a raster layer selected." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -9820,7 +9820,7 @@ void QgisApp::adjustBrightnessContrast( int delta, bool updateBrightness )
{
messageBar()->pushMessage( tr( "No Layer Selected" ),
tr( "To change brightness or contrast, you need to have a raster layer selected." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -9829,7 +9829,7 @@ void QgisApp::adjustBrightnessContrast( int delta, bool updateBrightness )
{
messageBar()->pushMessage( tr( "No Layer Selected" ),
tr( "To change brightness or contrast, you need to have a raster layer selected." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
return;
}
@ -10078,7 +10078,7 @@ QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const Q
{
QString message = layer->dataProvider()->error().message( QgsErrorMessage::Text );
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath, message );
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, Qgis::Critical, messageTimeout() );
delete layer;
freezeCanvases( false );
@ -10121,7 +10121,7 @@ void QgisApp::addMapLayer( QgsMapLayer *mapLayer )
else
{
QString msg = tr( "The layer is not a valid layer and can not be added to the map" );
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, Qgis::Critical, messageTimeout() );
}
// draw the map
@ -11186,7 +11186,7 @@ void QgisApp::showStatusMessage( const QString &message )
mStatusBar->showMessage( message );
}
void QgisApp::displayMapToolMessage( const QString &message, QgsMessageBar::MessageLevel level )
void QgisApp::displayMapToolMessage( const QString &message, Qgis::MessageLevel level )
{
// remove previous message
messageBar()->popWidget( mLastMapToolMessage );
@ -11200,7 +11200,7 @@ void QgisApp::displayMapToolMessage( const QString &message, QgsMessageBar::Mess
}
}
void QgisApp::displayMessage( const QString &title, const QString &message, QgsMessageBar::MessageLevel level )
void QgisApp::displayMessage( const QString &title, const QString &message, Qgis::MessageLevel level )
{
messageBar()->pushMessage( title, message, level, messageTimeout() );
}
@ -11984,7 +11984,7 @@ QgsRasterLayer *QgisApp::addRasterLayerPrivate(
if ( guiWarning )
{
messageBar()->pushMessage( title, error.message( QgsErrorMessage::Text ),
QgsMessageBar::CRITICAL, messageTimeout() );
Qgis::Critical, messageTimeout() );
}
if ( layer )
@ -12094,7 +12094,7 @@ bool QgisApp::addRasterLayers( QStringList const &fileNameQStringList, bool guiW
if ( !errMsg.isEmpty() )
msg += '\n' + errMsg;
messageBar()->pushMessage( tr( "Unsupported Data Source" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
messageBar()->pushMessage( tr( "Unsupported Data Source" ), msg, Qgis::Critical, messageTimeout() );
}
}
if ( ! ok )
@ -12666,7 +12666,7 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
{
messageBar()->pushMessage( tr( "Warning" ),
tr( "This layer doesn't have a properties dialog." ),
QgsMessageBar::INFO, messageTimeout() );
Qgis::Info, messageTimeout() );
}
}
}
@ -12896,7 +12896,7 @@ void QgisApp::namRequestTimedOut( QNetworkReply *reply )
tr( " Please check the <a href=\"#messageLog\">message log</a> for further info." ), messageBar() );
msgLabel->setWordWrap( true );
connect( msgLabel, &QLabel::linkActivated, mLogDock, &QWidget::show );
messageBar()->pushItem( new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING, messageTimeout() ) );
messageBar()->pushItem( new QgsMessageBarItem( msgLabel, Qgis::Warning, messageTimeout() ) );
}
void QgisApp::namUpdate()
@ -12954,7 +12954,7 @@ void QgisApp::authMessageOut( const QString &message, const QString &authtag, Qg
else
{
int levelint = static_cast< int >( level );
messageBar()->pushMessage( authtag, message, static_cast< QgsMessageBar::MessageLevel >( levelint ), 7 );
messageBar()->pushMessage( authtag, message, static_cast< Qgis::MessageLevel >( levelint ), 7 );
}
}
@ -13147,7 +13147,7 @@ void QgisApp::tapAndHoldTriggered( QTapAndHoldGesture *gesture )
void QgisApp::transactionGroupCommitError( const QString &error )
{
displayMessage( tr( "Transaction" ), error, QgsMessageBar::CRITICAL );
displayMessage( tr( "Transaction" ), error, Qgis::Critical );
}
QgsFeature QgisApp::duplicateFeatures( QgsMapLayer *mlayer, const QgsFeature &feature )
@ -13192,7 +13192,7 @@ QgsFeature QgisApp::duplicateFeatures( QgsMapLayer *mlayer, const QgsFeature &fe
}
}
messageBar()->pushMessage( tr( "%1 features on layer %2 duplicated\n%3" ).arg( QString::number( featureCount ), layer->name(), childrenInfo ), QgsMessageBar::SUCCESS, 5 );
messageBar()->pushMessage( tr( "%1 features on layer %2 duplicated\n%3" ).arg( QString::number( featureCount ), layer->name(), childrenInfo ), Qgis::Success, 5 );
return QgsFeature();
}
@ -13215,12 +13215,12 @@ QgsFeature QgisApp::duplicateFeatureDigitized( QgsMapLayer *mlayer, const QgsFea
mMapCanvas->setFocus();
QString msg = tr( "Digitize the duplicate on layer %1" ).arg( layer->name() );
messageBar()->pushMessage( msg, QgsMessageBar::INFO, 3 );
messageBar()->pushMessage( msg, Qgis::Info, 3 );
connect( digitizeFeature, static_cast<void ( QgsMapToolDigitizeFeature::* )( const QgsFeature & )>( &QgsMapToolDigitizeFeature::digitizingCompleted ), this, [this, layer, feature, digitizeFeature]( const QgsFeature & digitizedFeature )
{
QString msg = tr( "Duplicate digitized" );
messageBar()->pushMessage( msg, QgsMessageBar::INFO, 1 );
messageBar()->pushMessage( msg, Qgis::Info, 1 );
QgsVectorLayerUtils::QgsDuplicateFeatureContext duplicateFeatureContext;
@ -13235,7 +13235,7 @@ QgsFeature QgisApp::duplicateFeatureDigitized( QgsMapLayer *mlayer, const QgsFea
childrenInfo += ( tr( "%1 children on layer %2 duplicated" ).arg( duplicateFeatureContext.duplicatedFeatures( chl ).size() ).arg( chl->name() ) );
}
messageBar()->pushMessage( tr( "Feature on layer %2 duplicated\n%3" ).arg( layer->name(), childrenInfo ), QgsMessageBar::SUCCESS, 5 );
messageBar()->pushMessage( tr( "Feature on layer %2 duplicated\n%3" ).arg( layer->name(), childrenInfo ), Qgis::Success, 5 );
mMapCanvas->unsetMapTool( digitizeFeature );
}

View File

@ -1427,8 +1427,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void extentChanged();
void showRotation();
void displayMapToolMessage( const QString &message, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO );
void displayMessage( const QString &title, const QString &message, QgsMessageBar::MessageLevel level );
void displayMapToolMessage( const QString &message, Qgis::MessageLevel level = Qgis::Info );
void displayMessage( const QString &title, const QString &message, Qgis::MessageLevel level );
void removeMapToolMessage();
void updateMouseCoordinatePrecision();
// void debugHook();

View File

@ -906,7 +906,7 @@ void QgsAttributeTableDialog::mActionRemoveAttribute_triggered()
}
else
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Attribute error" ), tr( "The attribute(s) could not be deleted" ), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Attribute error" ), tr( "The attribute(s) could not be deleted" ), Qgis::Warning, QgisApp::instance()->messageTimeout() );
mLayer->destroyEditCommand();
}
// update model - a field has been added or updated
@ -1004,7 +1004,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString &filterString,
QgsExpression filterExpression( filter );
if ( filterExpression.hasParserError() )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Parsing error" ), filterExpression.parserErrorString(), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Parsing error" ), filterExpression.parserErrorString(), Qgis::Warning, QgisApp::instance()->messageTimeout() );
return;
}
@ -1012,7 +1012,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString &filterString,
if ( !filterExpression.prepare( &context ) )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Evaluation error" ), filterExpression.evalErrorString(), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Evaluation error" ), filterExpression.evalErrorString(), Qgis::Warning, QgisApp::instance()->messageTimeout() );
}
bool fetchGeom = filterExpression.needsGeometry();
@ -1051,7 +1051,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString &filterString,
if ( filterExpression.hasEvalError() )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Error filtering" ), filterExpression.evalErrorString(), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Error filtering" ), filterExpression.evalErrorString(), Qgis::Warning, QgisApp::instance()->messageTimeout() );
return;
}
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowFilteredList );

View File

@ -720,7 +720,7 @@ void QgsDiagramProperties::apply()
QgisApp::instance()->messageBar()->pushMessage(
tr( "Diagrams: No attributes added." ),
tr( "You did not add any attributes to this diagram layer. Please specify the attributes to visualize on the diagrams or disable diagrams." ),
QgsMessageBar::WARNING );
Qgis::Warning );
}
#if 0
@ -764,7 +764,7 @@ void QgsDiagramProperties::apply()
QgisApp::instance()->messageBar()->pushMessage(
tr( "Interpolation value" ),
tr( "You did not specify an interpolation value. A default value of %1 has been set." ).arg( QString::number( maxVal ) ),
QgsMessageBar::INFO,
Qgis::Info,
5 );
mMaxValueSpinBox->setValue( maxVal );

View File

@ -59,7 +59,7 @@ bool QgsGuiVectorLayerTools::startEditing( QgsVectorLayer *layer ) const
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Start editing failed" ),
tr( "Provider cannot be opened for editing" ),
QgsMessageBar::INFO, QgisApp::instance()->messageTimeout() );
Qgis::Info, QgisApp::instance()->messageTimeout() );
return false;
}
@ -130,7 +130,7 @@ bool QgsGuiVectorLayerTools::stopEditing( QgsVectorLayer *layer, bool allowCance
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Error" ),
tr( "Problems during roll back" ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
res = false;
}
QgisApp::instance()->freezeCanvases( false );
@ -181,7 +181,7 @@ void QgsGuiVectorLayerTools::commitError( QgsVectorLayer *vlayer ) const
tr( "Commit errors" ),
tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ),
showMore,
QgsMessageBar::WARNING,
Qgis::Warning,
0,
QgisApp::instance()->messageBar() );
QgisApp::instance()->messageBar()->pushItem( errorMsg );

View File

@ -46,7 +46,7 @@ void QgsHandleBadLayersHandler::handleBadLayers( const QList<QDomNode> &layers )
tr( "%1 of %2 bad layers were not fixable." )
.arg( layers.size() - dialog->layerCount() )
.arg( layers.size() ),
QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
Qgis::Warning, QgisApp::instance()->messageTimeout() );
if ( dialog->layerCount() > 0 )
dialog->exec();

View File

@ -175,11 +175,11 @@ void QgsLoadStyleFromDBDialog::deleteStyleFromDB()
if ( !msgError.isNull() )
{
QgsDebugMsg( opInfo + " failed." );
QgisApp::instance()->messageBar()->pushMessage( opInfo, tr( "%1: fail. %2" ).arg( opInfo, msgError ), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( opInfo, tr( "%1: fail. %2" ).arg( opInfo, msgError ), Qgis::Warning, QgisApp::instance()->messageTimeout() );
}
else
{
QgisApp::instance()->messageBar()->pushMessage( opInfo, tr( "%1: success" ).arg( opInfo ), QgsMessageBar::INFO, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( opInfo, tr( "%1: success" ).arg( opInfo ), Qgis::Info, QgisApp::instance()->messageTimeout() );
//Delete all rows from the UI table widgets
mRelatedTable->setRowCount( 0 );
@ -192,7 +192,7 @@ void QgsLoadStyleFromDBDialog::deleteStyleFromDB()
int sectionLimit = mLayer->listStylesInDatabase( ids, names, descriptions, errorMsg );
if ( !errorMsg.isNull() )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Error occurred while retrieving styles from database" ), errorMsg, QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Error occurred while retrieving styles from database" ), errorMsg, Qgis::Warning, QgisApp::instance()->messageTimeout() );
}
else
{

View File

@ -108,7 +108,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
else if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Coordinate transform error. Cannot transform the point to the layers coordinate system" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Coordinate transform error. Cannot transform the point to the layers coordinate system" ), Qgis::Warning );
return;
}
@ -200,7 +200,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( ( !isGeometryEmpty ) && QgsWkbTypes::isSingleType( vlayer->wkbType() ) )
{
emit messageEmitted( tr( "Add part: Feature geom is single part and you've added more than one" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Add part: Feature geom is single part and you've added more than one" ), Qgis::Warning );
}
return;
@ -231,7 +231,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
break;
}
emit messageEmitted( errorMessage, QgsMessageBar::WARNING );
emit messageEmitted( errorMessage, Qgis::Warning );
vlayer->destroyEditCommand();
}
@ -265,7 +265,7 @@ bool QgsMapToolAddPart::checkSelection()
if ( !selectionErrorMsg.isEmpty() )
{
emit messageEmitted( tr( "Could not add part. %1" ).arg( selectionErrorMsg ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Could not add part. %1" ).arg( selectionErrorMsg ), Qgis::Warning );
}
return selectionErrorMsg.isEmpty();

View File

@ -65,7 +65,7 @@ void QgsMapToolAddRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
else if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system." ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system." ), Qgis::Warning );
return;
}
@ -126,7 +126,7 @@ void QgsMapToolAddRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
errorMessage = tr( "an unknown error occurred" );
}
emit messageEmitted( tr( "Could not add ring since %1." ).arg( errorMessage ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "Could not add ring since %1." ).arg( errorMessage ), Qgis::Critical );
vlayer->destroyEditCommand();
}
else

View File

@ -69,7 +69,7 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e
if ( !isIntersect )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Error" ), tr( "Segments are parallels" ),
QgsMessageBar::CRITICAL, QgisApp::instance()->messageTimeout() );
Qgis::Critical, QgisApp::instance()->messageTimeout() );
deactivate();
}
else

View File

@ -57,7 +57,7 @@ void QgsMapToolCircle3Tangents::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
mCircle = QgsCircle().from3Tangents( mPoints.at( 0 ), mPoints.at( 1 ), mPoints.at( 2 ), mPoints.at( 3 ), mPoints.at( 4 ), mPoints.at( 5 ) );
if ( mCircle.isEmpty() )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Error" ), tr( "At least two segments are parallels" ), QgsMessageBar::CRITICAL, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( tr( "Error" ), tr( "At least two segments are parallels" ), Qgis::Critical, QgisApp::instance()->messageTimeout() );
mPoints.clear();
delete mTempRubberBand;
mTempRubberBand = nullptr;

View File

@ -116,7 +116,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( !( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
{
emit messageEmitted( tr( "The data provider for this layer does not support the addition of features." ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "The data provider for this layer does not support the addition of features." ), Qgis::Warning );
return;
}
@ -135,7 +135,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
//check we only use this tool for point/multipoint layers
if ( vlayer->geometryType() != QgsWkbTypes::PointGeometry && mCheckGeometryType )
{
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture point' tool on this vector layer" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture point' tool on this vector layer" ), Qgis::Warning );
return;
}
@ -158,7 +158,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::Warning );
return;
}
@ -215,14 +215,14 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
//check we only use the line tool for line/multiline layers
if ( mode() == CaptureLine && vlayer->geometryType() != QgsWkbTypes::LineGeometry && mCheckGeometryType )
{
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture line' tool on this vector layer" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture line' tool on this vector layer" ), Qgis::Warning );
return;
}
//check we only use the polygon tool for polygon/multipolygon layers
if ( mode() == CapturePolygon && vlayer->geometryType() != QgsWkbTypes::PolygonGeometry && mCheckGeometryType )
{
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture polygon' tool on this vector layer" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Wrong editing tool, cannot apply the 'capture polygon' tool on this vector layer" ), Qgis::Warning );
return;
}
@ -238,7 +238,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
else if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::Warning );
return;
}
@ -317,7 +317,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
if ( f->geometry().isEmpty() ) //avoid intersection might have removed the whole geometry
{
emit messageEmitted( tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" ), Qgis::Critical );
stopCapturing();
return;
}

View File

@ -59,7 +59,7 @@ void QgsMapToolFeatureAction::canvasReleaseEvent( QgsMapMouseEvent *e )
if ( !layer || layer->type() != QgsMapLayer::VectorLayer )
{
emit messageEmitted( tr( "To run an action, you must choose an active vector layer." ), QgsMessageBar::INFO );
emit messageEmitted( tr( "To run an action, you must choose an active vector layer." ), Qgis::Info );
return;
}
@ -72,7 +72,7 @@ void QgsMapToolFeatureAction::canvasReleaseEvent( QgsMapMouseEvent *e )
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
if ( vlayer->actions()->actions( QStringLiteral( "Canvas" ) ).isEmpty() && QgsGui::mapLayerActionRegistry()->mapLayerActions( vlayer ).isEmpty() )
{
emit messageEmitted( tr( "The active vector layer has no defined actions" ), QgsMessageBar::INFO );
emit messageEmitted( tr( "The active vector layer has no defined actions" ), Qgis::Info );
return;
}

View File

@ -65,7 +65,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
else if ( error == 2 )
{
// problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::Warning );
return;
}
@ -121,7 +121,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
errorMessage = tr( "an unknown error occurred" );
}
emit messageEmitted( tr( "could not add ring since %1." ).arg( errorMessage ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "could not add ring since %1." ).arg( errorMessage ), Qgis::Critical );
vlayer->destroyEditCommand();
return;
@ -137,7 +137,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( fid == -1 )
{
emit messageEmitted( tr( "No ring found to fill." ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "No ring found to fill." ), Qgis::Critical );
vlayer->destroyEditCommand();
return;
}

View File

@ -177,7 +177,7 @@ void QgsMapToolMoveFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QString *errorMsg = new QString();
if ( !QgisApp::instance()->vectorLayerTools()->copyMoveFeatures( vlayer, request, dx, dy, errorMsg ) )
{
emit messageEmitted( *errorMsg, QgsMessageBar::CRITICAL );
emit messageEmitted( *errorMsg, Qgis::Critical );
delete mRubberBand;
mRubberBand = nullptr;
}

View File

@ -453,7 +453,7 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset )
mCtrlWasHeldOnFeatureSelection = false;
mGeometryModified = false;
deleteDistanceWidget();
emit messageEmitted( tr( "Creating offset geometry failed: %1" ).arg( offsetGeom.lastError() ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "Creating offset geometry failed: %1" ).arg( offsetGeom.lastError() ), Qgis::Critical );
}
else
{

View File

@ -113,7 +113,7 @@ bool QgsMapToolOffsetPointSymbol::checkSymbolCompatibility( QgsMarkerSymbol *mar
void QgsMapToolOffsetPointSymbol::noCompatibleSymbols()
{
emit messageEmitted( tr( "The selected point does not have an offset attribute set." ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The selected point does not have an offset attribute set." ), Qgis::Critical );
}
void QgsMapToolOffsetPointSymbol::canvasMoveEvent( QgsMapMouseEvent *e )

View File

@ -56,7 +56,7 @@ void QgsMapToolPointSymbol::canvasPressEvent( QgsMapMouseEvent *e )
QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToCurrentLayer( e->pos(), QgsPointLocator::Vertex );
if ( !m.isValid() )
{
emit messageEmitted( tr( "No point feature was detected at the clicked position. Please click closer to the feature or enhance the search tolerance under Settings->Options->Digitizing->Search radius for vertex edits" ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "No point feature was detected at the clicked position. Please click closer to the feature or enhance the search tolerance under Settings->Options->Digitizing->Search radius for vertex edits" ), Qgis::Critical );
return; //error during snapping
}

View File

@ -58,7 +58,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
else if ( error == 2 )
{
//problem with coordinate transformation
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "Cannot transform the point to the layers coordinate system" ), Qgis::Warning );
return;
}
@ -158,7 +158,7 @@ void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
if ( geom.avoidIntersections( QgsProject::instance()->avoidIntersectionsLayers(), ignoreFeatures ) != 0 )
{
emit messageEmitted( tr( "An error was reported during intersection removal" ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "An error was reported during intersection removal" ), Qgis::Critical );
vlayer->destroyEditCommand();
stopCapturing();
return;
@ -166,7 +166,7 @@ void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
if ( geom.isEmpty() ) //intersection removal might have removed the whole geometry
{
emit messageEmitted( tr( "The feature cannot be reshaped because the resulting geometry is empty" ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The feature cannot be reshaped because the resulting geometry is empty" ), Qgis::Critical );
vlayer->destroyEditCommand();
return;
}

View File

@ -106,7 +106,7 @@ bool QgsMapToolRotatePointSymbols::checkSymbolCompatibility( QgsMarkerSymbol *ma
void QgsMapToolRotatePointSymbols::noCompatibleSymbols()
{
emit messageEmitted( tr( "The selected point does not have a rotation attribute set." ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The selected point does not have a rotation attribute set." ), Qgis::Critical );
}
void QgsMapToolRotatePointSymbols::canvasMoveEvent( QgsMapMouseEvent *e )

View File

@ -41,7 +41,7 @@ QgsVectorLayer *QgsMapToolSelectUtils::getCurrentVectorLayer( QgsMapCanvas *canv
QgisApp::instance()->messageBar()->pushMessage(
QObject::tr( "No active vector layer" ),
QObject::tr( "To select features, choose a vector layer in the legend" ),
QgsMessageBar::INFO,
Qgis::Info,
QgisApp::instance()->messageTimeout() );
}
return vlayer;
@ -219,7 +219,7 @@ QgsFeatureIds QgsMapToolSelectUtils::getMatchingFeatures( QgsMapCanvas *canvas,
QgisApp::instance()->messageBar()->pushMessage(
QObject::tr( "CRS Exception" ),
QObject::tr( "Selection extends beyond layer's coordinate system" ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
return newSelectedFeatures;
}

View File

@ -207,7 +207,7 @@ bool QgsMapToolShowHideLabels::selectedFeatures( QgsVectorLayer *vlayer,
Q_UNUSED( cse );
// catch exception for 'invalid' point and leave existing selection unchanged
QgsLogger::warning( "Caught CRS exception " + QStringLiteral( __FILE__ ) + ": " + QString::number( __LINE__ ) );
emit messageEmitted( tr( "CRS Exception: selection extends beyond layer's coordinate system." ), QgsMessageBar::WARNING );
emit messageEmitted( tr( "CRS Exception: selection extends beyond layer's coordinate system." ), Qgis::Warning );
return false;
}

View File

@ -74,7 +74,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "Coordinate transform error" ),
tr( "Cannot transform the point to the layers coordinate system" ),
QgsMessageBar::INFO,
Qgis::Info,
QgisApp::instance()->messageTimeout() );
return;
}
@ -100,7 +100,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No features were split" ),
tr( "If there are selected features, the split tool only applies to those. If you would like to split all features under the split line, clear the selection." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode == QgsGeometry::OperationResult::GeometryEngineError )
@ -108,7 +108,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No feature split done" ),
tr( "Cut edges detected. Make sure the line splits features into multiple parts." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode == QgsGeometry::OperationResult::InvalidBaseGeometry )
@ -116,7 +116,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No feature split done" ),
tr( "The geometry is invalid. Please repair before trying to split it." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode != QgsGeometry::OperationResult::Success )
@ -125,7 +125,7 @@ void QgsMapToolSplitFeatures::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No feature split done" ),
tr( "An error occurred during splitting." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}

View File

@ -73,7 +73,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "Coordinate transform error" ),
tr( "Cannot transform the point to the layers coordinate system" ),
QgsMessageBar::INFO,
Qgis::Info,
QgisApp::instance()->messageTimeout() );
return;
}
@ -98,7 +98,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No parts were split" ),
tr( "If there are selected parts, the split tool only applies to those. If you would like to split all parts under the split line, clear the selection." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode == QgsGeometry::OperationResult::GeometryEngineError )
@ -106,7 +106,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No part split done" ),
tr( "Cut edges detected. Make sure the line splits parts into multiple parts." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode == QgsGeometry::OperationResult::InvalidBaseGeometry )
@ -114,7 +114,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "No part split done" ),
tr( "The geometry is invalid. Please repair before trying to split it." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}
else if ( returnCode != QgsGeometry::OperationResult::Success )
@ -123,7 +123,7 @@ void QgsMapToolSplitParts::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgisApp::instance()->messageBar()->pushMessage(
tr( "Split error" ),
tr( "An error occurred during splitting." ),
QgsMessageBar::WARNING,
Qgis::Warning,
QgisApp::instance()->messageTimeout() );
}

View File

@ -309,7 +309,7 @@ void QgsPluginRegistry::loadPythonPlugin( const QString &packageName )
// add to settings
settings.setValue( "/PythonPlugins/" + packageName, true );
QgsMessageLog::logMessage( QObject::tr( "Loaded %1 (package: %2)" ).arg( pluginName, packageName ), QObject::tr( "Plugins" ), QgsMessageLog::INFO );
QgsMessageLog::logMessage( QObject::tr( "Loaded %1 (package: %2)" ).arg( pluginName, packageName ), QObject::tr( "Plugins" ), Qgis::Info );
settings.remove( "/PythonPlugins/watchDog/" + packageName );
}
@ -367,7 +367,7 @@ void QgsPluginRegistry::loadCppPlugin( const QString &fullPathName )
addPlugin( baseName, QgsPluginMetadata( myLib.fileName(), pName(), pl ) );
//add it to the qsettings file [ts]
settings.setValue( "/Plugins/" + baseName, true );
QgsMessageLog::logMessage( QObject::tr( "Loaded %1 (Path: %2)" ).arg( pName(), myLib.fileName() ), QObject::tr( "Plugins" ), QgsMessageLog::INFO );
QgsMessageLog::logMessage( QObject::tr( "Loaded %1 (Path: %2)" ).arg( pName(), myLib.fileName() ), QObject::tr( "Plugins" ), Qgis::Info );
QObject *o = dynamic_cast<QObject *>( pl );
if ( o )

View File

@ -101,7 +101,7 @@ void QgsSelectByFormDialog::zoomToFeatures( const QString &filter )
{
mMessageBar->pushMessage( QString(),
tr( "Zoomed to %n matching feature(s)", "number of matching features", featureCount ),
QgsMessageBar::INFO,
Qgis::Info,
timeout );
}
}
@ -109,7 +109,7 @@ void QgsSelectByFormDialog::zoomToFeatures( const QString &filter )
{
mMessageBar->pushMessage( QString(),
tr( "No matching features found" ),
QgsMessageBar::INFO,
Qgis::Info,
timeout );
}
}
@ -141,7 +141,7 @@ void QgsSelectByFormDialog::flashFeatures( const QString &filter )
{
mMessageBar->pushMessage( QString(),
tr( "No matching features found" ),
QgsMessageBar::INFO,
Qgis::Info,
timeout );
}
}

View File

@ -1138,11 +1138,11 @@ void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
if ( !msgError.isNull() )
{
QgisApp::instance()->messageBar()->pushMessage( infoWindowTitle, msgError, QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( infoWindowTitle, msgError, Qgis::Warning, QgisApp::instance()->messageTimeout() );
}
else
{
QgisApp::instance()->messageBar()->pushMessage( infoWindowTitle, tr( "Style saved" ), QgsMessageBar::INFO, QgisApp::instance()->messageTimeout() );
QgisApp::instance()->messageBar()->pushMessage( infoWindowTitle, tr( "Style saved" ), Qgis::Info, QgisApp::instance()->messageTimeout() );
}
}

View File

@ -383,7 +383,7 @@ QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProce
}
catch ( QgsProcessingException &e )
{
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), Qgis::Critical );
feedback->reportError( e.what() );
return QVariantMap();
}
@ -409,7 +409,7 @@ bool QgsProcessingAlgorithm::prepare( const QVariantMap &parameters, QgsProcessi
}
catch ( QgsProcessingException &e )
{
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), Qgis::Critical );
feedback->reportError( e.what() );
return false;
}
@ -494,7 +494,7 @@ QVariantMap QgsProcessingAlgorithm::postProcess( QgsProcessingContext &context,
}
catch ( QgsProcessingException &e )
{
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), Qgis::Critical );
feedback->reportError( e.what() );
return QVariantMap();
}

View File

@ -54,7 +54,7 @@ bool QgsProcessingAlgRunnerTask::run()
}
catch ( QgsProcessingException &e )
{
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), Qgis::Critical );
mFeedback->reportError( e.what() );
return false;
}

View File

@ -71,6 +71,19 @@ class CORE_EXPORT Qgis
// Enumerations
//
/**
* \brief Level for messages
* This will be used both for message log and message bar in application.
*/
enum MessageLevel
{
Info = 0,
Warning = 1,
Critical = 2,
Success = 3,
None = 4
};
/**
* Raster data types.
* This is modified and extended copy of GDALDataType.

View File

@ -151,7 +151,7 @@ void QgsApplication::init( QString profileFolder )
qRegisterMetaType<QgsProcessingOutputLayerDefinition>( "QgsProcessingOutputLayerDefinition" );
qRegisterMetaType<QgsUnitTypes::LayoutUnit>( "QgsUnitTypes::LayoutUnit" );
qRegisterMetaType<QgsFeatureIds>( "QgsFeatureIds" );
qRegisterMetaType<QgsMessageLog::MessageLevel>( "QgsMessageLog::MessageLevel" );
qRegisterMetaType<Qgis::MessageLevel>( "Qgis::MessageLevel" );
qRegisterMetaType<QgsReferencedRectangle>( "QgsReferencedRectangle" );
qRegisterMetaType<QgsReferencedPointXY>( "QgsReferencedPointXY" );
qRegisterMetaType<QgsLayoutRenderContext::Flags>( "QgsLayoutRenderContext::Flags" );

View File

@ -205,7 +205,7 @@ bool QgsFeature::setAttribute( int idx, const QVariant &value )
{
if ( idx < 0 || idx >= d->attributes.size() )
{
QgsMessageLog::logMessage( QObject::tr( "Attribute index %1 out of bounds [0;%2]" ).arg( idx ).arg( d->attributes.size() ), QString(), QgsMessageLog::WARNING );
QgsMessageLog::logMessage( QObject::tr( "Attribute index %1 out of bounds [0;%2]" ).arg( idx ).arg( d->attributes.size() ), QString(), Qgis::Warning );
return false;
}

View File

@ -67,7 +67,7 @@ int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRect
QgsMessageLog::logMessage(
tr( "GML Getfeature network request update failed for authcfg %1" ).arg( authcfg ),
tr( "Network" ),
QgsMessageLog::CRITICAL
Qgis::Critical
);
return 1;
}
@ -86,7 +86,7 @@ int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRect
QgsMessageLog::logMessage(
tr( "GML Getfeature network reply update failed for authcfg %1" ).arg( authcfg ),
tr( "Network" ),
QgsMessageLog::CRITICAL
Qgis::Critical
);
return 1;
}
@ -148,7 +148,7 @@ int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRect
QgsMessageLog::logMessage(
tr( "GML Getfeature network request failed with error: %1" ).arg( replyErrorString ),
tr( "Network" ),
QgsMessageLog::CRITICAL
Qgis::Critical
);
return 1;
}

View File

@ -22,17 +22,17 @@
class QgsMessageLogConsole;
void QgsMessageLog::logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )
void QgsMessageLog::logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level )
{
QgsDebugMsg( QString( "%1 %2[%3] %4" ).arg( QDateTime::currentDateTime().toString( Qt::ISODate ), tag ).arg( level ).arg( message ) );
QgsApplication::messageLog()->emitMessage( message, tag, level );
}
void QgsMessageLog::emitMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )
void QgsMessageLog::emitMessage( const QString &message, const QString &tag, Qgis::MessageLevel level )
{
emit messageReceived( message, tag, level );
if ( level != QgsMessageLog::INFO )
if ( level != Qgis::Info )
{
emit messageReceived( true );
}
@ -41,16 +41,16 @@ void QgsMessageLog::emitMessage( const QString &message, const QString &tag, Qgs
QgsMessageLogConsole::QgsMessageLogConsole()
: QObject( QgsApplication::messageLog() )
{
connect( QgsApplication::messageLog(), static_cast < void ( QgsMessageLog::* )( const QString &, const QString &, QgsMessageLog::MessageLevel ) >( &QgsMessageLog::messageReceived ),
connect( QgsApplication::messageLog(), static_cast < void ( QgsMessageLog::* )( const QString &, const QString &, Qgis::MessageLevel ) >( &QgsMessageLog::messageReceived ),
this, &QgsMessageLogConsole::logMessage );
}
void QgsMessageLogConsole::logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )
void QgsMessageLogConsole::logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level )
{
std::cout
<< tag.toLocal8Bit().data() << "[" <<
( level == QgsMessageLog::INFO ? "INFO"
: level == QgsMessageLog::WARNING ? "WARNING"
( level == Qgis::Info ? "INFO"
: level == Qgis::Warning ? "WARNING"
: "CRITICAL" )
<< "]: " << message.toLocal8Bit().data() << std::endl;
}

View File

@ -20,6 +20,7 @@
#include <QObject>
#include "qgis_core.h"
#include "qgis.h"
/**
* \ingroup core
@ -40,32 +41,22 @@ class CORE_EXPORT QgsMessageLog : public QObject
public:
enum MessageLevel
{
ALL = 0,
INFO = 0,
WARNING = 1,
CRITICAL = 2,
NONE = 3
};
Q_ENUM( MessageLevel );
/**
* Constructor for QgsMessageLog.
*/
QgsMessageLog() = default;
//! add a message to the instance (and create it if necessary)
static void logMessage( const QString &message, const QString &tag = QString(), MessageLevel level = QgsMessageLog::WARNING );
static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::Warning );
signals:
void messageReceived( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void messageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level );
void messageReceived( bool received );
private:
void emitMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void emitMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
};
@ -84,7 +75,7 @@ class CORE_EXPORT QgsMessageLogConsole : public QObject
QgsMessageLogConsole();
public slots:
void logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level );
void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
};
#endif

View File

@ -99,7 +99,7 @@ QStringList makeKeyTokens_( const QString &scope, const QString &key )
{
QString errorString = QObject::tr( "Entry token invalid : '%1'. The token will not be saved to file." ).arg( keyToken );
QgsMessageLog::logMessage( errorString, QString(), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( errorString, QString(), Qgis::Critical );
}

View File

@ -761,7 +761,7 @@ bool QgsVectorLayerFeatureIterator::checkGeometryValidity( const QgsFeature &fea
{
if ( !feature.geometry().isGeosValid() )
{
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), Qgis::Critical );
if ( mRequest.invalidGeometryCallback() )
{
mRequest.invalidGeometryCallback()( feature );
@ -774,7 +774,7 @@ bool QgsVectorLayerFeatureIterator::checkGeometryValidity( const QgsFeature &fea
case QgsFeatureRequest::GeometryAbortOnInvalid:
if ( !feature.geometry().isGeosValid() )
{
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), QgsMessageLog::CRITICAL );
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), Qgis::Critical );
close();
if ( mRequest.invalidGeometryCallback() )
{

View File

@ -445,7 +445,7 @@ void QgsAuthAuthoritiesEditor::btnAddCa_clicked()
if ( !QgsApplication::authManager()->storeCertAuthorities( certs ) )
{
messageBar()->pushMessage( tr( "ERROR storing CA(s) in authentication database" ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
}
QgsApplication::authManager()->rebuildCaCertsCache();
@ -487,7 +487,7 @@ void QgsAuthAuthoritiesEditor::btnRemoveCa_clicked()
if ( digest.isEmpty() )
{
messageBar()->pushMessage( tr( "Certificate id missing" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -516,21 +516,21 @@ void QgsAuthAuthoritiesEditor::btnRemoveCa_clicked()
if ( cert.isNull() )
{
messageBar()->pushMessage( tr( "Certificate could not be found in database for id %1:" ).arg( digest ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
if ( !QgsApplication::authManager()->removeCertAuthority( cert ) )
{
messageBar()->pushMessage( tr( "ERROR removing CA from authentication database for id %1:" ).arg( digest ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
if ( !QgsApplication::authManager()->removeCertTrustPolicy( cert ) )
{
messageBar()->pushMessage( tr( "ERROR removing cert trust policy from authentication database for id %1:" ).arg( digest ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
@ -738,7 +738,7 @@ void QgsAuthAuthoritiesEditor::btnCaFileClear_clicked()
if ( !QgsApplication::authManager()->removeCertTrustPolicies( certs ) )
{
messageBar()->pushMessage( tr( "ERROR removing cert(s) trust policy from authentication database." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
QgsApplication::authManager()->rebuildCertTrustCache();
@ -764,7 +764,7 @@ void QgsAuthAuthoritiesEditor::showTrustedCertificateAuthorities()
void QgsAuthAuthoritiesEditor::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthAuthoritiesEditor::showEvent( QShowEvent *e )

View File

@ -152,7 +152,7 @@ void QgsAuthConfigEditor::eraseAuthenticationDatabase()
void QgsAuthConfigEditor::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthConfigEditor::toggleTitleVisibility( bool visible )

View File

@ -244,7 +244,7 @@ void QgsAuthEditorWidgets::eraseAuthenticationDatabase()
void QgsAuthEditorWidgets::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthEditorWidgets::passwordHelperDelete()

View File

@ -69,7 +69,7 @@ bool QgsAuthGuiUtils::isDisabled( QgsMessageBar *msgbar, int timeout )
{
msgbar->pushMessage( QObject::tr( "Authentication System" ),
QObject::tr( "DISABLED. Resources authenticating via the system can not be accessed" ),
QgsMessageBar::CRITICAL, timeout );
Qgis::Critical, timeout );
return true;
}
return false;
@ -84,7 +84,7 @@ void QgsAuthGuiUtils::setMasterPassword( QgsMessageBar *msgbar, int timeout )
{
msgbar->pushMessage( QgsApplication::authManager()->authManTag(),
QObject::tr( "Master password already set." ),
QgsMessageBar::INFO, timeout );
Qgis::Info, timeout );
return;
}
( void )QgsApplication::authManager()->setMasterPassword( true );
@ -96,7 +96,7 @@ void QgsAuthGuiUtils::clearCachedMasterPassword( QgsMessageBar *msgbar, int time
return;
QString msg( QObject::tr( "Master password not cleared because it is not set." ) );
QgsMessageBar::MessageLevel level( QgsMessageBar::INFO );
Qgis::MessageLevel level( Qgis::Info );
if ( QgsApplication::authManager()->masterPasswordIsSet() )
{
@ -105,7 +105,7 @@ void QgsAuthGuiUtils::clearCachedMasterPassword( QgsMessageBar *msgbar, int time
if ( QgsApplication::authManager()->masterPasswordIsSet() )
{
msg = QObject::tr( "Master password FAILED to be cleared." );
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
}
@ -118,13 +118,13 @@ void QgsAuthGuiUtils::resetMasterPassword( QgsMessageBar *msgbar, int timeout, Q
return;
QString msg( QObject::tr( "Master password reset" ) );
QgsMessageBar::MessageLevel level( QgsMessageBar::INFO );
Qgis::MessageLevel level( Qgis::Info );
// check that a master password is even set in auth db
if ( !QgsApplication::authManager()->masterPasswordHashInDatabase() )
{
msg = QObject::tr( "Master password reset: NO current password hash in database" );
msgbar->pushMessage( QgsApplication::authManager()->authManTag(), msg, QgsMessageBar::WARNING, 0 );
msgbar->pushMessage( QgsApplication::authManager()->authManTag(), msg, Qgis::Warning, 0 );
return;
}
@ -144,7 +144,7 @@ void QgsAuthGuiUtils::resetMasterPassword( QgsMessageBar *msgbar, int timeout, Q
if ( !QgsApplication::authManager()->resetMasterPassword( newpass, oldpass, keepbackup, &backuppath ) )
{
msg = QObject::tr( "Master password FAILED to be reset" );
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
if ( !backuppath.isEmpty() )
@ -163,7 +163,7 @@ void QgsAuthGuiUtils::clearCachedAuthenticationConfigs( QgsMessageBar *msgbar, i
QgsApplication::authManager()->clearAllCachedConfigs();
QString msg = QObject::tr( "Cached authentication configurations for session cleared" );
msgbar->pushMessage( QgsApplication::authManager()->authManTag(), msg, QgsMessageBar::INFO, timeout );
msgbar->pushMessage( QgsApplication::authManager()->authManTag(), msg, Qgis::Info, timeout );
}
void QgsAuthGuiUtils::removeAuthenticationConfigs( QgsMessageBar *msgbar, int timeout, QWidget *parent )
@ -182,12 +182,12 @@ void QgsAuthGuiUtils::removeAuthenticationConfigs( QgsMessageBar *msgbar, int ti
}
QString msg( QObject::tr( "Authentication configurations removed." ) );
QgsMessageBar::MessageLevel level( QgsMessageBar::INFO );
Qgis::MessageLevel level( Qgis::Info );
if ( !QgsApplication::authManager()->removeAllAuthenticationConfigs() )
{
msg = QObject::tr( "Authentication configurations FAILED to be removed." );
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
msgbar->pushMessage( QgsApplication::authManager()->authManTag(), msg, level, timeout );
@ -215,13 +215,13 @@ void QgsAuthGuiUtils::eraseAuthenticationDatabase( QgsMessageBar *msgbar, int ti
}
QString msg( QObject::tr( "Active authentication database erased." ) );
QgsMessageBar::MessageLevel level( QgsMessageBar::WARNING );
Qgis::MessageLevel level( Qgis::Warning );
QString backuppath;
if ( !QgsApplication::authManager()->eraseAuthenticationDatabase( true, &backuppath ) )
{
msg = QObject::tr( "Authentication database FAILED to be erased." );
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
else
{
@ -229,7 +229,7 @@ void QgsAuthGuiUtils::eraseAuthenticationDatabase( QgsMessageBar *msgbar, int ti
{
msg += QObject::tr( " (backup: %1)" ).arg( backuppath );
}
level = QgsMessageBar::CRITICAL;
level = Qgis::Critical;
}
timeout = 0; // no timeout, so user can read restart message
@ -274,18 +274,18 @@ void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, int timeout,
return;
}
QString msg;
QgsMessageBar::MessageLevel level;
Qgis::MessageLevel level;
if ( ! QgsApplication::authManager()->passwordHelperDelete() )
{
msg = QgsApplication::authManager()->passwordHelperErrorMessage();
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
else
{
msg = QObject::tr( "Master password was successfully deleted from your %1" )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
level = QgsMessageBar::INFO;
level = Qgis::Info;
}
msgbar->pushMessage( QObject::tr( "Password helper delete" ), msg, level, timeout );
}
@ -293,24 +293,24 @@ void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, int timeout,
void QgsAuthGuiUtils::passwordHelperSync( QgsMessageBar *msgbar, int timeout )
{
QString msg;
QgsMessageBar::MessageLevel level;
Qgis::MessageLevel level;
if ( ! QgsApplication::authManager()->masterPasswordIsSet() )
{
msg = QObject::tr( "Master password is not set and cannot be stored in your %1." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
else if ( ! QgsApplication::authManager()->passwordHelperSync() )
{
msg = QgsApplication::authManager()->passwordHelperErrorMessage();
level = QgsMessageBar::WARNING;
level = Qgis::Warning;
}
else
{
msg = QObject::tr( "Master password has been successfully stored in your %1." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
level = QgsMessageBar::INFO;
level = Qgis::Info;
}
msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, level, timeout );
}
@ -322,7 +322,7 @@ void QgsAuthGuiUtils::passwordHelperEnable( bool enabled, QgsMessageBar *msgbar,
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ) :
QObject::tr( "Your %1 will <b>not be used anymore</b> to store and retrieve the master password." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, QgsMessageBar::INFO, timeout );
msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, Qgis::Info, timeout );
}
void QgsAuthGuiUtils::passwordHelperLoggingEnable( bool enabled, QgsMessageBar *msgbar, int timeout )

View File

@ -303,7 +303,7 @@ void QgsAuthIdentitiesEditor::btnAddIdentity_clicked()
if ( !QgsApplication::authManager()->storeCertIdentity( bundle.first, bundle.second ) )
{
messageBar()->pushMessage( tr( "ERROR storing identity bundle in authentication database." ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
}
populateIdentitiesView();
mRootCertIdentItem->setExpanded( true );
@ -327,7 +327,7 @@ void QgsAuthIdentitiesEditor::btnRemoveIdentity_clicked()
if ( digest.isEmpty() )
{
messageBar()->pushMessage( tr( "Certificate id missing." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -351,7 +351,7 @@ void QgsAuthIdentitiesEditor::btnRemoveIdentity_clicked()
if ( !QgsApplication::authManager()->removeCertIdentity( digest ) )
{
messageBar()->pushMessage( tr( "ERROR removing cert identity from authentication database for id %1:" ).arg( digest ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
@ -382,7 +382,7 @@ void QgsAuthIdentitiesEditor::btnGroupByOrg_toggled( bool checked )
void QgsAuthIdentitiesEditor::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthIdentitiesEditor::showEvent( QShowEvent *e )

View File

@ -298,13 +298,13 @@ void QgsAuthServersEditor::btnRemoveServer_clicked()
if ( digest.isEmpty() )
{
messageBar()->pushMessage( tr( "SSL custom config id missing" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
if ( hostport.isEmpty() )
{
messageBar()->pushMessage( tr( "SSL custom config host:port missing" ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -330,7 +330,7 @@ void QgsAuthServersEditor::btnRemoveServer_clicked()
{
messageBar()->pushMessage( tr( "ERROR removing SSL custom config from authentication database for host:port, id %1:" )
.arg( hostport, digest ),
QgsMessageBar::CRITICAL );
Qgis::Critical );
return;
}
@ -354,13 +354,13 @@ void QgsAuthServersEditor::btnEditServer_clicked()
if ( digest.isEmpty() )
{
messageBar()->pushMessage( tr( "SSL custom config id missing." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
if ( hostport.isEmpty() )
{
messageBar()->pushMessage( tr( "SSL custom config host:port missing." ),
QgsMessageBar::WARNING );
Qgis::Warning );
return;
}
@ -398,7 +398,7 @@ void QgsAuthServersEditor::btnGroupByOrg_toggled( bool checked )
void QgsAuthServersEditor::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthServersEditor::showEvent( QShowEvent *e )

View File

@ -307,7 +307,7 @@ void QgsAuthTrustedCAsDialog::btnGroupByOrg_toggled( bool checked )
void QgsAuthTrustedCAsDialog::authMessageOut( const QString &message, const QString &authtag, QgsAuthManager::MessageLevel level )
{
int levelint = ( int )level;
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
messageBar()->pushMessage( authtag, message, ( Qgis::MessageLevel )levelint, 7 );
}
void QgsAuthTrustedCAsDialog::showEvent( QShowEvent *e )

View File

@ -59,7 +59,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
if ( !mQDateTimeEdit )
{
QgsDebugMsg( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." );
QgsMessageLog::logMessage( QStringLiteral( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." ), QStringLiteral( "UI forms" ), QgsMessageLog::WARNING );
QgsMessageLog::logMessage( QStringLiteral( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." ), QStringLiteral( "UI forms" ), Qgis::Warning );
return;
}

View File

@ -455,14 +455,14 @@ void QgsAttributeForm::pushSelectedFeaturesMessage()
mMessageBar->pushMessage( QString(),
tr( "%1 matching %2 selected" ).arg( count )
.arg( count == 1 ? tr( "feature" ) : tr( "features" ) ),
QgsMessageBar::INFO,
Qgis::Info,
messageTimeout() );
}
else
{
mMessageBar->pushMessage( QString(),
tr( "No matching features found" ),
QgsMessageBar::WARNING,
Qgis::Warning,
messageTimeout() );
}
}
@ -557,12 +557,12 @@ bool QgsAttributeForm::saveMultiEdits()
{
mLayer->endEditCommand();
mLayer->triggerRepaint();
mMultiEditMessageBarItem = new QgsMessageBarItem( tr( "Attribute changes for multiple features applied" ), QgsMessageBar::SUCCESS, messageTimeout() );
mMultiEditMessageBarItem = new QgsMessageBarItem( tr( "Attribute changes for multiple features applied" ), Qgis::Success, messageTimeout() );
}
else
{
mLayer->destroyEditCommand();
mMultiEditMessageBarItem = new QgsMessageBarItem( tr( "Changes could not be applied" ), QgsMessageBar::WARNING, messageTimeout() );
mMultiEditMessageBarItem = new QgsMessageBarItem( tr( "Changes could not be applied" ), Qgis::Warning, messageTimeout() );
}
if ( !mButtonBox->isVisible() )
@ -695,7 +695,7 @@ void QgsAttributeForm::onAttributeChanged( const QVariant &value )
connect( msgLabel, &QLabel::linkActivated, this, &QgsAttributeForm::multiEditMessageClicked );
clearMultiEditMessages();
mMultiEditUnsavedMessageBarItem = new QgsMessageBarItem( msgLabel, QgsMessageBar::WARNING );
mMultiEditUnsavedMessageBarItem = new QgsMessageBarItem( msgLabel, Qgis::Warning );
if ( !mButtonBox->isVisible() )
mMessageBar->pushItem( mMultiEditUnsavedMessageBarItem );
}

Some files were not shown because too many files have changed in this diff Show More