Ejemplo n.º 1
0
}void MainWindow::OnConnect(wxCommandEvent &event) {
    wxString address = showConnectDialog();
    MESSAGE m;
    m.msg_type = MSG_NET;
    m.param.pword[0] = NET_CONNECT_TO;
    strcpy(m.param.pstr,address);
    this->parent->getSocketClient()->Write(&m,sizeof(MESSAGE));
    //todo send connection signals
}
Ejemplo n.º 2
0
MainWindow::MainWindow(QString url, int quality, int listen_port, bool view_only):
    QMainWindow(0),
    vnc_view(0),
    scroll_area(new ScrollArea(this)),
    input_toolbuttons(new QActionGroup(this)),
    key_menu(0)
{
    setWindowTitle("Presence VNC");
#ifdef Q_WS_MAEMO_5
    setContextMenuPolicy(Qt::NoContextMenu);
    setAttribute(Qt::WA_Maemo5StackedWindow);
#endif

    migrateConfiguration();

    //set up toolbar
    toolbar = new QToolBar(0);
    key_menu_button = input_toolbuttons->addAction(toolbar->addAction(QChar(0x2026), this, SLOT(showKeyMenu()))); //"..." button
    key_menu_button->setCheckable(true); //used to indicate wether a modifier key is still pressed
    input_toolbuttons->addAction(toolbar->addAction(tr("Tab"), this, SLOT(sendTab())));
    input_toolbuttons->addAction(toolbar->addAction(tr("Esc"), this, SLOT(sendEsc())));
    input_toolbuttons->addAction(toolbar->addAction(tr("PgUp"), this, SLOT(sendPgUp())));
    input_toolbuttons->addAction(toolbar->addAction(tr("PgDn"), this, SLOT(sendPgDn())));
#ifdef Q_WS_MAEMO_5
    input_toolbuttons->addAction(toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/chat_enter.png"), "", this, SLOT(sendReturn())));
    input_toolbuttons->addAction(toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/control_keyboard.png"), "", this, SLOT(showInputPanel())));
#endif

    QSettings settings;
    zoom_slider = new QSlider(Qt::Horizontal, 0);
    zoom_slider->setRange(0, 100);
    connect(zoom_slider, SIGNAL(valueChanged(int)),
            this, SLOT(setZoomLevel(int)));
    connect(zoom_slider, SIGNAL(sliderReleased()),
            this, SLOT(zoomSliderReleased()));
    zoom_slider->setValue(settings.value("zoomlevel", 95).toInt());
    toolbar->addWidget(zoom_slider);

#ifdef Q_WS_MAEMO_5
    toolbar->addAction(QIcon("/usr/share/icons/hicolor/48x48/hildon/general_fullsize.png"), "", this, SLOT(toggleFullscreen()));
#else
    toolbar->addAction(tr("Toggle Fullscreen"), this, SLOT(toggleFullscreen()));
#endif
    addToolBar(toolbar);
    toolbar->setVisible(settings.value("show_toolbar", true).toBool());
    toolbar->setEnabled(false);

    //set up menu
    QAction *connect_action = new QAction(tr("Connect"), this);
    disconnect_action = new QAction(tr("Disconnect"), this);
    show_toolbar = new QAction(tr("Show toolbar"), this);
    show_toolbar->setCheckable(true);
    show_toolbar->setChecked(settings.value("show_toolbar", true).toBool());
    QAction *pref_action = new QAction(tr("Preferences"), this);
    QAction *about_action = new QAction(tr("About"), this);

#ifdef Q_WS_MAEMO_5
    menuBar()->addAction(connect_action);
    menuBar()->addAction(disconnect_action);
    menuBar()->addAction(show_toolbar);
    menuBar()->addAction(pref_action);
    menuBar()->addAction(about_action);
#else
    QMenu* session_menu = menuBar()->addMenu(tr("&Session"));
    session_menu->addAction(connect_action);
    session_menu->addAction(disconnect_action);
    session_menu->addSeparator();
    session_menu->addAction(pref_action);
    session_menu->addSeparator();
    session_menu->addAction(tr("&Quit"), this, SLOT(close()));

    QMenu* view_menu = menuBar()->addMenu(tr("&View"));
    view_menu->addAction(show_toolbar);

    QMenu* help_menu = menuBar()->addMenu(tr("&Help"));
    help_menu->addAction(about_action);
#endif

    connect(about_action, SIGNAL(triggered()),
            this, SLOT(about()));
    connect(pref_action, SIGNAL(triggered()),
            this, SLOT(showPreferences()));
    connect(connect_action, SIGNAL(triggered()),
            this, SLOT(showConnectDialog()));
    connect(disconnect_action, SIGNAL(triggered()),
            this, SLOT(disconnectFromHost()));
    connect(show_toolbar, SIGNAL(toggled(bool)),
            toolbar, SLOT(setVisible(bool)));
    connect(show_toolbar, SIGNAL(toggled(bool)),
            this, SLOT(updateScreenSpaceDelayed()));
#ifdef Q_WS_MAEMO_5
    QDBusConnection::systemBus().connect("", MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_DISPLAY_SIG,
                                         this, SLOT(displayStateChanged(QString)));
#endif

    setCentralWidget(scroll_area);

    connect(scroll_area, SIGNAL(fullscreenButtonClicked()),
            this, SLOT(toggleFullscreen()));

    grabZoomKeys(true);
    reloadSettings();

    if(url.isEmpty() and listen_port == 0) {
        disconnect_action->setEnabled(false);
        showConnectDialog();
    } else {
        connectToHost(url, quality, listen_port, view_only);
    }
}
Ejemplo n.º 3
0
/*! Menu register*/
void MainWindow::on_actionRegister_activated()
{
    logOrReg=false;
    showConnectDialog();    //zobrazi se register dialog
}
Ejemplo n.º 4
0
void CMainWindow::connectSignals()
{
    CChatManager *Manager = CChatManager::instance();
    CNetworkClient *Network = CNetworkClient::instance();
    CBattleManager *BattleManager = CBattleManager::instance();

    connect(ui->ChatTabWidget->tabBar(), SIGNAL(tabCloseRequested(int)), Manager, SLOT(closeChannel(int)));
    connect(ui->ChatTabWidget->tabBar(), SIGNAL(currentChanged(int)), Manager, SLOT(changeCurrentChannel(int)));
    connect(ui->ChatTabWidget->tabBar(), SIGNAL(tabMoved(int,int)), Manager, SLOT(moveChannel(int,int)));
    connect(Manager, SIGNAL(joined(CChannel*)), this, SLOT(createTab(CChannel*)));
    connect(Manager, SIGNAL(closeTab(int)), this, SLOT(removeTab(int)));
    connect(Manager, SIGNAL(currentChanged(CChannel*)), ui->ChatTabWidget->chatView(), SLOT(loadChannel(CChannel*)));
    connect(ui->ChannelsView, SIGNAL(doubleClicked(QModelIndex)), CChatManager::instance(), SLOT(doubleClicked(QModelIndex)));
    connect(ui->ChannelUserView, SIGNAL(doubleClicked(QModelIndex)),
            CUserManager::instance()->chatModel(), SLOT(doubleClicked(QModelIndex)));
    connect(ui->actionChatSend, SIGNAL(triggered()), this, SLOT(sendChat()));
    connect(ui->actionBattleSend, SIGNAL(triggered()), this, SLOT(sendBattle()));
    connect(Manager, SIGNAL(currentChanged(int)), ui->ChatTabWidget->tabBar(), SLOT(setCurrentIndex(int)));
    connect(ui->BattleListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            CBattleManager::instance(), SLOT(battleSelected(QModelIndex)));
    connect(ui->BattleListView, SIGNAL(doubleClicked(QModelIndex)), CBattleManager::instance(), SLOT(doubleClicked(QModelIndex)));
    connect(ui->BattlePreviewView, SIGNAL(doubleClicked(QModelIndex)),
            CBattleManager::instance()->battlePreviewModel(), SLOT(doubleClicked(QModelIndex)));
    connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(showConnectDialog()));
    connect(&ConnectDialog, SIGNAL(connect(QString,int,QString,QString)), Network, SLOT(connectToServer(QString,int,QString,QString)));
    connect(Network, SIGNAL(disconnected()), this, SLOT(networkDisconnected()));
    connect(Network, SIGNAL(connected()), this, SLOT(networkConnected()));
    connect(Network, SIGNAL(multiplayerDisabled()), this, SLOT(disableMultiplayerGUI()));
    connect(Network, SIGNAL(multiplayerEnabled()), this, SLOT(enableMultiplayerGUI()));
    connect(ui->actionDisconnect, SIGNAL(triggered()), Network, SLOT(disconnect()));
    connect(CBattleManager::instance(), SIGNAL(currentMapChanged(CMap*)), ui->MapInfo, SLOT(setMap(CMap*)));
    connect(CBattleroomManager::instance(), SIGNAL(mapChanged(CMap*)), ui->BattleMapInfo, SLOT(setMap(CMap*)));
    connect(CBattleroomManager::instance(), SIGNAL(updateChat(CChannel*)), ui->BattleChatText, SLOT(loadChannel(CChannel*)));
    connect(CBattleroomManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(ui->LeaveBattleButton, SIGNAL(clicked()), CBattleroomManager::instance(), SLOT(leaveBattle()));
    connect(ui->DownloadButton, SIGNAL(clicked()), this, SLOT(execDownload()));

    connect(ui->actionDeleteDownload, SIGNAL(triggered()), this, SLOT(removeDownload()));

    connect(ui->actionDownloadMap, SIGNAL(triggered()), BattleManager, SLOT(downloadMapForBattle()));
    connect(ui->actionDownloadMod, SIGNAL(triggered()), BattleManager, SLOT(downloadModForBattle()));

    connect(ui->DownloadView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDownloadContextMenu(QPoint)));
    connect(ui->BattleListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showBattleContextMenu(QPoint)));

    connect(Network, SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(CDownloadManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(Manager, SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(CDownloadManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(Network, SIGNAL(agreement(QString)), this, SLOT(showAgreement(QString)));

    connect(ui->actionReloadUnitSync, SIGNAL(triggered()), CUnitSync::instance(), SLOT(reload()));
    connect(CUnitSync::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString)));
    connect(CUserManager::instance(), SIGNAL(lobbyUserBattleStatusChanged(CBattleStatus*)),
            this, SLOT(updateBattleStatus(CBattleStatus*)));

    connect(CUnitSync::instance(), SIGNAL(loaded()), this, SLOT(unitsyncLoaded()));
    connect(CUnitSync::instance(), SIGNAL(unloaded()), this, SLOT(unitsyncUnloaded()));

    connect(ui->actionUpdateStatus, SIGNAL(triggered()), this, SLOT(changeBattleStatus()));

    connect(CBattleroomManager::instance(), SIGNAL(battleJoined(CBattle*)), this, SLOT(enableBattleroom(CBattle*)));
    connect(CBattleroomManager::instance(), SIGNAL(battleClosed()), this, SLOT(disableBattleroom()));
    connect(CBattleroomManager::instance(), SIGNAL(gameStarted()), this, SLOT(lockBattleroom()));
    connect(CBattleroomManager::instance(), SIGNAL(gameEnded()), this, SLOT(unlockBattleroom()));
    connect(CBattleroomManager::instance(), SIGNAL(battleStarted()), this, SLOT(onBattleStarted()));
    connect(CBattleroomManager::instance(), SIGNAL(battleEnded()), this, SLOT(onBattleEnded()));
    connect(ui->SelectColorButton, SIGNAL(clicked()), this, SLOT(selectColor()));
    connect(ui->StartBattleButton, SIGNAL(clicked()), CBattleroomManager::instance(), SLOT(startGame()));

    connect(&ColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(colorSelected(QColor)));
}
Ejemplo n.º 5
0
/*! Menu login*/
void MainWindow::on_actionLogin_activated()
{
    logOrReg=true;
    showConnectDialog();    //zobrazi se connect dialog
}