QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgstiledsceneconnectiondialog.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledsceneconnectiondialog.cpp
3 ---------------------
4 begin : June 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17#include "moc_qgstiledsceneconnectiondialog.cpp"
19#include "qgsgui.h"
20#include <QMessageBox>
21#include <QPushButton>
22
24
25QgsTiledSceneConnectionDialog::QgsTiledSceneConnectionDialog( QWidget *parent )
26 : QDialog( parent )
27{
28 setupUi( this );
30
31 buttonBox->button( QDialogButtonBox::Ok )->setDisabled( true );
32
33 connect( mEditName, &QLineEdit::textChanged, this, &QgsTiledSceneConnectionDialog::updateOkButtonState );
34 connect( mEditUrl, &QLineEdit::textChanged, this, &QgsTiledSceneConnectionDialog::updateOkButtonState );
35}
36
37void QgsTiledSceneConnectionDialog::setConnection( const QString &name, const QString &uri )
38{
39 mEditName->setText( name );
40
42 mEditUrl->setText( conn.url );
43
44 mAuthSettings->setUsername( conn.username );
45 mAuthSettings->setPassword( conn.password );
46 mEditReferer->setText( conn.httpHeaders[QgsHttpHeaders::KEY_REFERER].toString() );
47 mAuthSettings->setConfigId( conn.authCfg );
48}
49
50QString QgsTiledSceneConnectionDialog::connectionUri() const
51{
53 conn.url = mEditUrl->text();
54
55 conn.username = mAuthSettings->username();
56 conn.password = mAuthSettings->password();
57 conn.httpHeaders[QgsHttpHeaders::KEY_REFERER] = mEditReferer->text();
58 conn.authCfg = mAuthSettings->configId( );
59
61}
62
63QString QgsTiledSceneConnectionDialog::connectionName() const
64{
65 return mEditName->text();
66}
67
68void QgsTiledSceneConnectionDialog::updateOkButtonState()
69{
70 const bool enabled = !mEditName->text().isEmpty() && !mEditUrl->text().isEmpty();
71 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled );
72}
73
74void QgsTiledSceneConnectionDialog::accept()
75{
76 QDialog::accept();
77}
78
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Definition qgsgui.cpp:209
static const QString KEY_REFERER
Used in settings as the referer key.
static Data decodedUri(const QString &uri)
Returns a connection uri decoded to a data structure.
static QString encodedUri(const Data &data)
Returns connection data encoded as a string.
Represents decoded data of a tiled scene connection.
QString authCfg
Authentication configuration ID.