X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainpage.cpp;fp=src%2Fqtui%2Fmainpage.cpp;h=a0e5f1178b4543fa8f1076b8b308e69d64a3e3f1;hp=82387ab61e0ca02be1b0eea3707330c24ec11789;hb=66e6d26b38fb6e4528654e6525d205e9e9ca3243;hpb=b49c64970b6237fc95f8ca88c8bb6bcf04c251d7 diff --git a/src/qtui/mainpage.cpp b/src/qtui/mainpage.cpp index 82387ab6..a0e5f117 100644 --- a/src/qtui/mainpage.cpp +++ b/src/qtui/mainpage.cpp @@ -18,28 +18,34 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include +#include +#include #include #include "mainpage.h" +#include "coreconnectdlg.h" +#include "client.h" MainPage::MainPage(QWidget *parent) : QWidget(parent) { -} - - -void MainPage::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - QPainter painter(this); - QImage img(":/pics/quassel-logo.png"); // FIXME load externally - - if (img.height() > height() || img.width() > width()) - img = img.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - - int xmargin = (width() - img.width()) / 2; - int ymargin = (height() - img.height()) / 2; - - painter.drawImage(xmargin, ymargin, img); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setAlignment(Qt::AlignCenter); + QLabel *label = new QLabel(this); + label->setPixmap(QPixmap(":/pics/quassel-logo.png")); + layout->addWidget(label); + + if (Quassel::runMode() != Quassel::Monolithic) { + QPushButton *connectButton = new QPushButton(QIcon::fromTheme("network-connect"), tr("Connect to Core...")); + connect(connectButton, &QPushButton::clicked, [this](){ + CoreConnectDlg dlg(this); + if (dlg.exec() == QDialog::Accepted) { + AccountId accId = dlg.selectedAccount(); + if (accId.isValid()) + Client::coreConnection()->connectToCore(accId); + } + }); + layout->addWidget(connectButton); + } }