Exemplo n.º 1
0
void Bb10Ui::init()
{
    qDebug() << "xxxxx Bb10Ui::init";
    s_uiStyle = new Bb10UiStyle(this);
    m_chatListPage = Page::create();
    Container* container = new Container();
    DockLayout* chatListLayout = new DockLayout();
    container->setLayout(chatListLayout);
    m_channelListView = new ListView();
    m_channelListView->setLayoutProperties(StackLayoutProperties::create().spaceQuota(1));
    m_channelListView->setHorizontalAlignment(HorizontalAlignment::Fill);
    m_channelListView->setListItemProvider(new ChannelListItemProvider());
    container->add(m_channelListView);
    m_chatListPage->setContent(container);
    connect(m_channelListView, SIGNAL(triggered(const QVariantList)), this, SLOT(onChannelListTriggered(const QVariantList)));
    m_editIdentity = ActionItem::create()
        .title("Edit Identity")
        .image(Image("icons/editentity.png"));
    connect(m_editIdentity, SIGNAL(triggered()), Bb10Ui::instance(), SLOT(showEditIdentityPage()));
    m_chatListPage->addAction(m_editIdentity, ActionBarPlacement::OnBar);

    m_connect = ActionItem::create().title("Disconnected");
    //m_connect->setImage(Image(QUrl("file://" + QDir::homePath() + "/icons/disconnected.png")));
    m_connect->setImage(Image("icons/disconnected.png"));
    m_chatListPage->addAction(m_connect, ActionBarPlacement::OnBar);
    connect(m_connect, SIGNAL(triggered()), this, SLOT(toggleConnection()));

    m_joinChannel = ActionItem::create()
        .title("Join Channel")
        .image(Image("icons/join.png"));
    m_chatListPage->addAction(m_joinChannel, ActionBarPlacement::OnBar);
    connect(m_joinChannel, SIGNAL(triggered()), this, SLOT(showJoinChannelDlg()));

    m_navPane->push(m_chatListPage);

    connect(Application::instance(), SIGNAL(fullscreen()), this, SLOT(onFullscreen()));
    connect(Application::instance(), SIGNAL(thumbnail()), this, SLOT(onThumbnail()));

    connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), SLOT(clientNetworkCreated(NetworkId)));
    connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList)), SLOT(showCoreConfigWizard(QVariantList)));
    connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString)));
    connect(Client::coreConnection(), SIGNAL(coreSetupSuccess()), SLOT(showCoreSetupSuccess()));
    connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), SLOT(messagesInserted(const QModelIndex &, int, int)));
    CoreConnection *conn = Client::coreConnection();
    if (!conn->connectToCore()) {
        qDebug() << "xxxxx !conn->connectToCore";
        // No autoconnect selected (or no accounts)
        //showCoreConnectionDlg();
    } else
        qDebug() << "xxxxx conn->connectToCore success!";

    m_invokeRequest.setAction("bb.action.OPEN");
    m_invokeRequest.setTargetTypes(InvokeTarget::Application);
    m_invokeRequest.setMimeType("text/plain");
    m_invokeRequest.setTarget("quassel.irc.bb10");

    connect(m_navPane, SIGNAL(topChanged(bb::cascades::Page*)), this, SLOT(navPaneTopChanged(bb::cascades::Page*)));

    connect(m_navPane, SIGNAL(popTransitionEnded(bb::cascades::Page)), this, SLOT(onNavPanePopped(bb::cascades::Page*)));
}
void CoreConnectionStatusWidget::update()
{
    CoreConnection *conn = coreConnection();
    if (conn->progressMaximum() >= 0) {
        ui.progressBar->setMinimum(conn->progressMinimum());
        ui.progressBar->setMaximum(conn->progressMaximum());
        ui.progressBar->setValue(conn->progressValue());
        ui.progressBar->show();
    }
    else
        ui.progressBar->hide();

    ui.messageLabel->setText(conn->progressText());
}
void DockManagerNotificationBackend::updateProgress(int progress)
{
    if (!_enabled || !_item)
        return;

    CoreConnection* c = Client::instance()->coreConnection();
    int perc = 0;
    if (c->progressMaximum() == c->progressMinimum())
        perc = 0;
    else
        perc = (progress - c->progressMinimum()) * 100 / (c->progressMaximum() - c->progressMinimum());

    QHash<QString, QVariant> args;
    args["progress"] = perc;
    _item->call("UpdateDockItem", args);
}
Exemplo n.º 4
0
void MainWin::init() {
  connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), SLOT(clientNetworkCreated(NetworkId)));
  connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), SLOT(clientNetworkRemoved(NetworkId)));
  connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
           SLOT(messagesInserted(const QModelIndex &, int, int)));
  connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId)));
  connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString)));

  connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList)), SLOT(showCoreConfigWizard(QVariantList)));
  connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString)));
  connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount *, bool *, QString)), SLOT(userAuthenticationRequired(CoreAccount *, bool *, QString)));
  connect(Client::coreConnection(), SIGNAL(handleNoSslInClient(bool*)), SLOT(handleNoSslInClient(bool *)));
  connect(Client::coreConnection(), SIGNAL(handleNoSslInCore(bool*)), SLOT(handleNoSslInCore(bool *)));
#ifdef HAVE_SSL
  connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *)));
#endif

  // Setup Dock Areas
  setDockNestingEnabled(true);
  setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
  setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
  setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
  setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

  // Order is sometimes important
  setupActions();
  setupBufferWidget();
  setupMenus();
  setupTopicWidget();
  setupNickWidget();
  setupInputWidget();
  setupChatMonitor();
  setupStatusBar();
  setupToolBars();
  setupSystray();
  setupTitleSetter();
  setupHotList();

#ifndef HAVE_KDE
#  ifdef HAVE_PHONON
  QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
#  endif
#  ifndef QT_NO_SYSTEMTRAYICON
  QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
#  endif

  QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));

#else /* HAVE_KDE */
  QtUi::registerNotificationBackend(new KNotificationBackend(this));
#endif /* HAVE_KDE */

#ifdef HAVE_INDICATEQT
  QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
#endif

  // we assume that at this point, all configurable actions are defined!
  QtUi::loadShortcuts();

  connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId)));

  setDisconnectedState();  // Disable menus and stuff

#ifdef HAVE_KDE
  setAutoSaveSettings();
#endif

  // restore mainwin state
  QtUiSettings s;
  restoreStateFromSettings(s);

  // restore locked state of docks
  QtUi::actionCollection("General")->action("LockLayout")->setChecked(s.value("LockLayout", false).toBool());

  CoreConnection *conn = Client::coreConnection();
  if(!conn->connectToCore()) {
    // No autoconnect selected (or no accounts)
    showCoreConnectionDlg();
  }
}