X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fcoreconnectdlg.cpp;h=954be2d194530161f080a8412e721e8aefb9dbb4;hb=7e5d08e8e20162b5cd13413693187be90f738a1e;hp=ad7e68aff7d495d139b69781c8c19ddb90bcf144;hpb=4df7862b00b2113dabdf52342b2c15560313f476;p=quassel.git diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index ad7e68af..954be2d1 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -24,19 +24,34 @@ #include "coreconnectdlg.h" +#include "client.h" #include "clientsettings.h" #include "clientsyncer.h" #include "coreconfigwizard.h" +#include "iconloader.h" +#include "quassel.h" CoreConnectDlg::CoreConnectDlg(bool autoconnect, QWidget *parent) : QDialog(parent) { ui.setupUi(this); + ui.editAccount->setIcon(SmallIcon("document-properties")); + ui.addAccount->setIcon(SmallIcon("list-add")); + ui.deleteAccount->setIcon(SmallIcon("list-remove")); + ui.connectIcon->setPixmap(BarIcon("network-disconnect")); + ui.secureConnection->setPixmap(SmallIcon("document-encrypt")); + + if(Quassel::runMode() != Quassel::Monolithic) { + ui.useInternalCore->hide(); + } // make it look more native under Mac OS X: setWindowFlags(Qt::Sheet); clientSyncer = new ClientSyncer(this); + connect(this, SIGNAL(newClientSyncer(ClientSyncer *)), Client::instance(), SIGNAL(newClientSyncer(ClientSyncer *))); + emit newClientSyncer(clientSyncer); // announce the new client syncer via the client. + wizard = 0; doingAutoConnect = false; @@ -205,6 +220,11 @@ void CoreConnectDlg::on_accountButtonBox_accepted() { connectToCore(); } +void CoreConnectDlg::on_useInternalCore_clicked() { + clientSyncer->useInternalCore(); + startSync(); +} + /***************************************************** * Connecting to the Core ****************************************************/ @@ -213,7 +233,7 @@ void CoreConnectDlg::on_accountButtonBox_accepted() { void CoreConnectDlg::connectToCore() { ui.secureConnection->hide(); - ui.connectIcon->setPixmap(QPixmap::fromImage(QImage(":/22x22/actions/network-disconnect"))); + ui.connectIcon->setPixmap(BarIcon("network-disconnect")); ui.connectLabel->setText(tr("Connect to %1").arg(accountData["Host"].toString())); ui.coreInfoLabel->setText(""); ui.loginStack->setCurrentWidget(ui.loginEmptyPage); @@ -229,7 +249,7 @@ void CoreConnectDlg::connectToCore() { void CoreConnectDlg::initPhaseError(const QString &error) { doingAutoConnect = false; ui.secureConnection->hide(); - ui.connectIcon->setPixmap(QPixmap::fromImage(QImage(":/22x22/status/dialog-error"))); + ui.connectIcon->setPixmap(BarIcon("dialog-error")); //ui.connectLabel->setBrush(QBrush("red")); ui.connectLabel->setText(tr("
Connection to %1 failed!
").arg(accountData["Host"].toString())); ui.coreInfoLabel->setText(error); @@ -275,7 +295,7 @@ void CoreConnectDlg::restartPhaseNull() { *********************************************************/ void CoreConnectDlg::startLogin() { - ui.connectIcon->setPixmap(QPixmap::fromImage(QImage(":/22x22/actions/network-connect"))); + ui.connectIcon->setPixmap(BarIcon("network-connect")); ui.loginStack->setCurrentWidget(ui.loginCredentialsPage); //ui.loginStack->setMinimumSize(ui.loginStack->sizeHint()); ui.loginStack->updateGeometry(); ui.loginButtonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); @@ -336,6 +356,7 @@ void CoreConnectDlg::loginFailed(const QString &error) { if(wizard) { wizard->reject(); } + ui.connectIcon->setPixmap(BarIcon("dialog-error")); ui.loginStack->setCurrentWidget(ui.loginCredentialsPage); ui.loginGroup->setTitle(tr("Login")); ui.user->setEnabled(true); @@ -436,14 +457,17 @@ CoreAccountEditDlg::CoreAccountEditDlg(AccountId id, const QVariantMap &acct, co : QDialog(parent) { ui.setupUi(this); + ui.useSsl->setIcon(SmallIcon("document-encrypt")); + existing = _existing; if(id.isValid()) { + account = acct; + existing.removeAll(acct["AccountName"].toString()); ui.host->setText(acct["Host"].toString()); ui.port->setValue(acct["Port"].toUInt()); - ui.useInternal->setChecked(acct["UseInternal"].toBool()); ui.accountName->setText(acct["AccountName"].toString()); -#ifndef QT_NO_OPENSSL +#ifdef HAVE_SSL ui.useSsl->setChecked(acct["useSsl"].toBool()); #else ui.useSsl->setChecked(false); @@ -457,26 +481,17 @@ CoreAccountEditDlg::CoreAccountEditDlg(AccountId id, const QVariantMap &acct, co ui.proxyPassword->setText(acct["proxyPassword"].toString()); } else { setWindowTitle(tr("Add Core Account")); -#ifdef QT_NO_OPENSSL +#ifndef HAVE_SSL ui.useSsl->setChecked(false); ui.useSsl->setEnabled(false); #endif } - -#ifndef BUILD_MONO - // if we don't have a mono build we hide the option to use the internal connection and force the setting to use remote host - ui.useInternal->setChecked(false); - ui.useInternal->hide(); - ui.useRemote->hide(); - ui.labelUseBuiltinCore->hide(); -#endif } QVariantMap CoreAccountEditDlg::accountData() { account["AccountName"] = ui.accountName->text().trimmed(); account["Host"] = ui.host->text().trimmed(); account["Port"] = ui.port->value(); - account["UseInternal"] = ui.useInternal->isChecked(); account["useSsl"] = ui.useSsl->isChecked(); account["useProxy"] = ui.useProxy->isChecked(); account["proxyHost"] = ui.proxyHost->text().trimmed(); @@ -488,7 +503,7 @@ QVariantMap CoreAccountEditDlg::accountData() { } void CoreAccountEditDlg::setWidgetStates() { - bool ok = !ui.accountName->text().trimmed().isEmpty() && !existing.contains(ui.accountName->text()) && (ui.useInternal->isChecked() || !ui.host->text().isEmpty()); + bool ok = !ui.accountName->text().trimmed().isEmpty() && !existing.contains(ui.accountName->text()) && !ui.host->text().isEmpty(); ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok); } @@ -501,8 +516,3 @@ void CoreAccountEditDlg::on_accountName_textChanged(const QString &text) { Q_UNUSED(text); setWidgetStates(); } - -void CoreAccountEditDlg::on_useRemote_toggled(bool state) { - Q_UNUSED(state); - setWidgetStates(); -}