Skip to content

Commit 91fcb79

Browse files
authored
Merge pull request #8662 from elpaso/elpaso-backport-3_4
Weekly backports to 3.4
2 parents 7fd6a20 + 6f725b8 commit 91fcb79

File tree

7 files changed

+131
-55
lines changed

7 files changed

+131
-55
lines changed

python/plugins/db_manager/dlg_sql_layer_window.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ def __init__(self, iface, layer, parent=None):
147147

148148
# Update from layer
149149
# First the SQL from QgsDataSourceUri table
150-
sql = uri.table()
150+
sql = uri.table().replace('\n', ' ').strip()
151151
if uri.keyColumn() == '_uid_':
152-
match = re.search(r'^\(SELECT .+ AS _uid_,\* FROM \((.*)\) AS _subq_.+_\s*\)$', sql, re.S | re.X)
152+
match = re.search(r'^\(SELECT .+ AS _uid_,\* FROM \((.*)\) AS _subq_.+_\s*\)$', sql, re.S | re.X | re.IGNORECASE)
153153
if match:
154154
sql = match.group(1)
155155
else:
156-
match = re.search(r'^\((SELECT .+ FROM .+)\)$', sql, re.S | re.X)
156+
match = re.search(r'^\((SELECT .+ FROM .+)\)$', sql, re.S | re.X | re.IGNORECASE)
157157
if match:
158158
sql = match.group(1)
159159
# Need to check on table() since the parentheses were removed by the regexp

python/plugins/db_manager/dlg_sql_window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def createView(self):
561561
def _getSqlQuery(self):
562562
sql = self.editSql.selectedText()
563563
if len(sql) == 0:
564-
sql = self.editSql.text()
564+
sql = self.editSql.text().replace('\n', ' ').strip()
565565
return sql
566566

567567
def uniqueChanged(self):

src/app/qgsoptions.cpp

+38-22
Original file line numberDiff line numberDiff line change
@@ -1086,32 +1086,48 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
10861086

10871087
#ifdef HAVE_OPENCL
10881088

1089-
// Setup OpenCL (GPU) widget
1090-
mGPUEnableCheckBox->setChecked( QgsOpenClUtils::enabled( ) );
1091-
if ( QgsOpenClUtils::available( ) )
1092-
{
1093-
mGPUEnableCheckBox->setEnabled( true );
1089+
// Setup OpenCL Acceleration widget
10941090

1095-
for ( const auto &dev : QgsOpenClUtils::devices( ) )
1091+
connect( mGPUEnableCheckBox, &QCheckBox::toggled, [ = ]( bool checked )
1092+
{
1093+
if ( checked )
10961094
{
1097-
mOpenClDevicesCombo->addItem( QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Name, dev ), QgsOpenClUtils::deviceId( dev ) );
1095+
if ( QgsOpenClUtils::available( ) )
1096+
{
1097+
mOpenClContainerWidget->setEnabled( true );
1098+
mOpenClDevicesCombo->clear();
1099+
1100+
for ( const auto &dev : QgsOpenClUtils::devices( ) )
1101+
{
1102+
mOpenClDevicesCombo->addItem( QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Name, dev ), QgsOpenClUtils::deviceId( dev ) );
1103+
}
1104+
// Info updater
1105+
std::function<void( int )> infoUpdater = [ = ]( int )
1106+
{
1107+
mGPUInfoTextBrowser->setText( QgsOpenClUtils::deviceDescription( mOpenClDevicesCombo->currentData().toString() ) );
1108+
};
1109+
connect( mOpenClDevicesCombo, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), infoUpdater );
1110+
mOpenClDevicesCombo->setCurrentIndex( mOpenClDevicesCombo->findData( QgsOpenClUtils::deviceId( QgsOpenClUtils::activeDevice() ) ) );
1111+
infoUpdater( -1 );
1112+
mOpenClContainerWidget->show();
1113+
}
1114+
else
1115+
{
1116+
mGPUInfoTextBrowser->setText( tr( "No OpenCL compatible devices were found on your system.<br>"
1117+
"You may need to install additional libraries in order to enable OpenCL.<br>"
1118+
"Please check your logs for further details." ) );
1119+
mOpenClContainerWidget->setEnabled( false );
1120+
mGPUEnableCheckBox->setChecked( false );
1121+
}
10981122
}
1099-
// Info updater
1100-
std::function<void( int )> infoUpdater = [ = ]( int )
1123+
else
11011124
{
1102-
mGPUInfoTextBrowser->setText( QgsOpenClUtils::deviceDescription( mOpenClDevicesCombo->currentData().toString() ) );
1103-
};
1104-
connect( mOpenClDevicesCombo, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), infoUpdater );
1105-
mOpenClDevicesCombo->setCurrentIndex( mOpenClDevicesCombo->findData( QgsOpenClUtils::deviceId( QgsOpenClUtils::activeDevice() ) ) );
1106-
infoUpdater( -1 );
1107-
}
1108-
else
1109-
{
1110-
mGPUEnableCheckBox->setEnabled( false );
1111-
mGPUInfoTextBrowser->setText( tr( "An OpenCL compatible device was not found on your system.<br>"
1112-
"You may need to install additional libraries in order to enable OpenCL.<br>"
1113-
"Please check your logs for further details." ) );
1114-
}
1125+
mOpenClContainerWidget->setEnabled( false );
1126+
}
1127+
} );
1128+
1129+
mOpenClContainerWidget->setEnabled( false );
1130+
mGPUEnableCheckBox->setChecked( QgsOpenClUtils::enabled( ) );
11151131

11161132

11171133
#else

src/core/qgsreadwritelocker.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ void QgsReadWriteLocker::changeMode( QgsReadWriteLocker::Mode mode )
3434

3535
unlock();
3636

37+
mMode = mode;
38+
3739
if ( mMode == Read )
3840
mLock.lockForRead();
3941
else if ( mMode == Write )

src/core/qgsziputils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bool QgsZipUtils::unzip( const QString &zipFilename, const QString &dir, QString
110110
}
111111
else
112112
{
113-
QString err = QObject::tr( "Error opening zip archive: '%1'" ).arg( zip_strerror( z ) );
113+
QString err = QObject::tr( "Error opening zip archive: '%1'" ).arg( z ? zip_strerror( z ) : zipFilename );
114114
QgsMessageLog::logMessage( err, QStringLiteral( "QgsZipUtils" ) );
115115
return false;
116116
}

src/providers/spatialite/qgsspatialiteprovider.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -4603,9 +4603,21 @@ bool QgsSpatiaLiteProvider::checkLayerType()
46034603
// 3. check if ROWID injection works
46044604
if ( ! queryGeomTableName.isEmpty() )
46054605
{
4606+
// Check if the whole sql is aliased (I couldn't find a sqlite API call to get this information)
4607+
QRegularExpression re { R"re(\s+AS\s+(\w+)\n?\)?$)re" };
4608+
re.setPatternOptions( QRegularExpression::PatternOption::MultilineOption |
4609+
QRegularExpression::PatternOption::CaseInsensitiveOption );
4610+
QRegularExpressionMatch match { re.match( mTableName ) };
4611+
regex.setPattern( QStringLiteral( R"re(\s+AS\s+(\w+)\n?\)?$)re" ) );
4612+
QString tableAlias;
4613+
if ( match.hasMatch() )
4614+
{
4615+
tableAlias = match.captured( 1 );
4616+
}
46064617
QString newSql( mQuery.replace( QStringLiteral( "SELECT " ),
46074618
QStringLiteral( "SELECT %1.%2, " )
4608-
.arg( quotedIdentifier( queryGeomTableName ), QStringLiteral( "ROWID" ) ),
4619+
.arg( quotedIdentifier( tableAlias.isEmpty() ? queryGeomTableName : tableAlias ),
4620+
QStringLiteral( "ROWID" ) ),
46094621
Qt::CaseInsensitive ) );
46104622
sql = QStringLiteral( "SELECT ROWID FROM %1 WHERE ROWID IS NOT NULL LIMIT 1" ).arg( newSql );
46114623
ret = sqlite3_get_table( mSqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg );

src/ui/qgsoptionsbase.ui

+73-27
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
<item>
333333
<widget class="QStackedWidget" name="mOptionsStackedWidget">
334334
<property name="currentIndex">
335-
<number>0</number>
335+
<number>16</number>
336336
</property>
337337
<widget class="QWidget" name="mOptionsPageGeneral">
338338
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -1083,7 +1083,7 @@
10831083
<x>0</x>
10841084
<y>0</y>
10851085
<width>544</width>
1086-
<height>1096</height>
1086+
<height>1095</height>
10871087
</rect>
10881088
</property>
10891089
<layout class="QVBoxLayout" name="verticalLayout_22">
@@ -3216,7 +3216,7 @@
32163216
<x>0</x>
32173217
<y>0</y>
32183218
<width>613</width>
3219-
<height>646</height>
3219+
<height>641</height>
32203220
</rect>
32213221
</property>
32223222
<layout class="QVBoxLayout" name="verticalLayout_30">
@@ -3659,7 +3659,7 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
36593659
<rect>
36603660
<x>0</x>
36613661
<y>0</y>
3662-
<width>154</width>
3662+
<width>153</width>
36633663
<height>271</height>
36643664
</rect>
36653665
</property>
@@ -4867,8 +4867,8 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
48674867
<rect>
48684868
<x>0</x>
48694869
<y>0</y>
4870-
<width>857</width>
4871-
<height>828</height>
4870+
<width>616</width>
4871+
<height>736</height>
48724872
</rect>
48734873
</property>
48744874
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -5332,31 +5332,49 @@ The bigger the number, the faster zooming with the mouse wheel will be.</string>
53325332
</widget>
53335333
</item>
53345334
<item>
5335-
<widget class="QLabel" name="label_64">
5335+
<widget class="QCheckBox" name="mGPUEnableCheckBox">
53365336
<property name="text">
5337-
<string>The following OpenCL devices were found on this system (changing the default device requires QGIS to be restarted).</string>
5337+
<string>Enable OpenCL acceleration</string>
53385338
</property>
53395339
</widget>
53405340
</item>
53415341
<item>
5342-
<widget class="QComboBox" name="mOpenClDevicesCombo"/>
5343-
</item>
5344-
<item>
5345-
<widget class="QTextBrowser" name="mGPUInfoTextBrowser">
5346-
<property name="html">
5347-
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
5342+
<widget class="QWidget" name="mOpenClContainerWidget" native="true">
5343+
<layout class="QVBoxLayout" name="verticalLayout_32">
5344+
<property name="leftMargin">
5345+
<number>0</number>
5346+
</property>
5347+
<property name="topMargin">
5348+
<number>0</number>
5349+
</property>
5350+
<property name="rightMargin">
5351+
<number>0</number>
5352+
</property>
5353+
<property name="bottomMargin">
5354+
<number>0</number>
5355+
</property>
5356+
<item>
5357+
<widget class="QLabel" name="label_64">
5358+
<property name="text">
5359+
<string>The following OpenCL devices were found on this system (changing the default device requires QGIS to be restarted).</string>
5360+
</property>
5361+
</widget>
5362+
</item>
5363+
<item>
5364+
<widget class="QComboBox" name="mOpenClDevicesCombo"/>
5365+
</item>
5366+
<item>
5367+
<widget class="QTextBrowser" name="mGPUInfoTextBrowser">
5368+
<property name="html">
5369+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
53485370
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
53495371
p, li { white-space: pre-wrap; }
5350-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
5351-
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Placemark for OpenCL information results (mGPUInfoTextBrowser)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
5352-
</property>
5353-
</widget>
5354-
</item>
5355-
<item>
5356-
<widget class="QCheckBox" name="mGPUEnableCheckBox">
5357-
<property name="text">
5358-
<string>Enable OpenCL acceleration</string>
5359-
</property>
5372+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
5373+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
5374+
</property>
5375+
</widget>
5376+
</item>
5377+
</layout>
53605378
</widget>
53615379
</item>
53625380
<item>
@@ -5743,12 +5761,40 @@ p, li { white-space: pre-wrap; }
57435761
<tabstop>mRemoveUrlPushButton</tabstop>
57445762
<tabstop>mExcludeUrlListWidget</tabstop>
57455763
<tabstop>mAdvancedSettingsEnableButton</tabstop>
5746-
<tabstop>mOpenClDevicesCombo</tabstop>
5747-
<tabstop>mGPUInfoTextBrowser</tabstop>
5748-
<tabstop>mGPUEnableCheckBox</tabstop>
57495764
</tabstops>
57505765
<resources>
57515766
<include location="../../images/images.qrc"/>
5767+
<include location="../../images/images.qrc"/>
5768+
<include location="../../images/images.qrc"/>
5769+
<include location="../../images/images.qrc"/>
5770+
<include location="../../images/images.qrc"/>
5771+
<include location="../../images/images.qrc"/>
5772+
<include location="../../images/images.qrc"/>
5773+
<include location="../../images/images.qrc"/>
5774+
<include location="../../images/images.qrc"/>
5775+
<include location="../../images/images.qrc"/>
5776+
<include location="../../images/images.qrc"/>
5777+
<include location="../../images/images.qrc"/>
5778+
<include location="../../images/images.qrc"/>
5779+
<include location="../../images/images.qrc"/>
5780+
<include location="../../images/images.qrc"/>
5781+
<include location="../../images/images.qrc"/>
5782+
<include location="../../images/images.qrc"/>
5783+
<include location="../../images/images.qrc"/>
5784+
<include location="../../images/images.qrc"/>
5785+
<include location="../../images/images.qrc"/>
5786+
<include location="../../images/images.qrc"/>
5787+
<include location="../../images/images.qrc"/>
5788+
<include location="../../images/images.qrc"/>
5789+
<include location="../../images/images.qrc"/>
5790+
<include location="../../images/images.qrc"/>
5791+
<include location="../../images/images.qrc"/>
5792+
<include location="../../images/images.qrc"/>
5793+
<include location="../../images/images.qrc"/>
5794+
<include location="../../images/images.qrc"/>
5795+
<include location="../../images/images.qrc"/>
5796+
<include location="../../images/images.qrc"/>
5797+
<include location="../../images/images.qrc"/>
57525798
</resources>
57535799
<connections>
57545800
<connection>

0 commit comments

Comments
 (0)