QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
18#include "qgsgui.h"
19#include <QMessageBox>
20#include <QPushButton>
21
23
24QgsTiledSceneConnectionDialog::QgsTiledSceneConnectionDialog( QWidget *parent )
25 : QDialog( parent )
26{
27 setupUi( this );
29
30 buttonBox->button( QDialogButtonBox::Ok )->setDisabled( true );
31
32 connect( mEditName, &QLineEdit::textChanged, this, &QgsTiledSceneConnectionDialog::updateOkButtonState );
33 connect( mEditUrl, &QLineEdit::textChanged, this, &QgsTiledSceneConnectionDialog::updateOkButtonState );
34}
35
36void QgsTiledSceneConnectionDialog::setConnection( const QString &name, const QString &uri )
37{
38 mEditName->setText( name );
39
41 mEditUrl->setText( conn.url );
42
43 mAuthSettings->setUsername( conn.username );
44 mAuthSettings->setPassword( conn.password );
45 mEditReferer->setText( conn.httpHeaders[QgsHttpHeaders::KEY_REFERER].toString() );
46 mAuthSettings->setConfigId( conn.authCfg );
47}
48
49QString QgsTiledSceneConnectionDialog::connectionUri() const
50{
52 conn.url = mEditUrl->text();
53
54 conn.username = mAuthSettings->username();
55 conn.password = mAuthSettings->password();
56 conn.httpHeaders[QgsHttpHeaders::KEY_REFERER] = mEditReferer->text();
57 conn.authCfg = mAuthSettings->configId( );
58
60}
61
62QString QgsTiledSceneConnectionDialog::connectionName() const
63{
64 return mEditName->text();
65}
66
67void QgsTiledSceneConnectionDialog::updateOkButtonState()
68{
69 const bool enabled = !mEditName->text().isEmpty() && !mEditUrl->text().isEmpty();
70 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( enabled );
71}
72
73void QgsTiledSceneConnectionDialog::accept()
74{
75 QDialog::accept();
76}
77
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:194
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.