void ThymioVPLStandalone::setupConnections() { // editor connect(editor, SIGNAL(textChanged()), SLOT(editorContentChanged())); // target events connect(target.get(), SIGNAL(nodeConnected(unsigned)), SLOT(nodeConnected(unsigned))); connect(target.get(), SIGNAL(nodeDisconnected(unsigned)), SLOT(nodeDisconnected(unsigned))); connect(target.get(), SIGNAL(networkDisconnected()), SLOT(networkDisconnected())); // right now, we ignore errors /*connect(target, SIGNAL(arrayAccessOutOfBounds(unsigned, unsigned, unsigned, unsigned)), SLOT(arrayAccessOutOfBounds(unsigned, unsigned, unsigned, unsigned))); connect(target, SIGNAL(divisionByZero(unsigned, unsigned)), SLOT(divisionByZero(unsigned, unsigned))); connect(target, SIGNAL(eventExecutionKilled(unsigned, unsigned)), SLOT(eventExecutionKilled(unsigned, unsigned))); connect(target, SIGNAL(nodeSpecificError(unsigned, unsigned, QString)), SLOT(nodeSpecificError(unsigned, unsigned, QString))); */ connect(target.get(), SIGNAL(variablesMemoryEstimatedDirty(unsigned)), SLOT(variablesMemoryEstimatedDirty(unsigned))); connect(target.get(), SIGNAL(variablesMemoryChanged(unsigned, unsigned, const VariablesDataVector &)), SLOT(variablesMemoryChanged(unsigned, unsigned, const VariablesDataVector &))); }
AccountManager::AccountManager() : QObject( qApp ), d(new Private()) { setObjectName( "KopeteAccountManager" ); connect( Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(networkConnected()) ); connect( Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(networkDisconnected()) ); connect( Solid::PowerManagement::notifier(), SIGNAL(resumingFromSuspend()), this, SLOT(resume()) ); #ifdef __GNUC__ #warning TODO: Switch to a org.kde.Solid.PowerManagement Sleeping/Suspending signal when available. #endif QDBusConnection::systemBus().connect( "org.freedesktop.UPower", "/org/freedesktop/UPower", "", "Sleeping", this, SLOT( suspend() ) ); d->suspended = false; }
EvernoteSync::EvernoteSync(StorageManager *storageManager, ConnectionManager *connectionManager, QObject *parent) : QObject(parent) , m_storageManager(storageManager) , m_connectionManager(connectionManager) #ifndef QT_SIMULATOR , m_evernoteAccess(new EvernoteAccess(storageManager, connectionManager, this)) #endif , m_isSyncInProgress(false) , m_isThreadRunning(false) , m_syncProgress(0) , m_isRateLimitingInEffect(false) { connect(m_connectionManager, SIGNAL(connected()), SLOT(networkConnected())); connect(m_connectionManager, SIGNAL(disconnected()), SLOT(networkDisconnected())); connect(&m_rateLimitTimer, SIGNAL(timeout()), SLOT(rateLimitReset())); }
CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::CMainWindow) { ui->setupUi(this); networkDisconnected(); disableBattleroom(); setWindowTitle(QString("HoSpLo v") + VERSION); ui->ChannelSplitter->setSizes(QList<int>() << 100 << 300); ui->ChatSplitter->setSizes(QList<int>() << 300 << 100); ui->graphicsView->setScene(&MapScene); ui->BattleMapView->setScene(&CBattleroomManager::instance()->MapScene); ui->SmallBattleMapView->setScene(&CBattleroomManager::instance()->MapScene); ui->graphicsView->setRenderHint(QPainter::Antialiasing, true); ui->ChatTabWidget->chatView()->setVisible(false); Map = new CMap("DeltaSiegeDry.smf"); Map->loadFromUnitSync(); static QList<CUser *> Users; /*Users << new CUser("Kosyak1", 1000, "RU") << new CUser("Kosyak2", 1000, "RU") << new CUser("Kosyak3", 1000, "RU") << new CUser("Kosyak4", 1000, "RU") << new CUser("Kosyak5", 1000, "RU"); Users[0]->Command = 1; Users[0]->Color = QColor(255, 255, 255); Users[1]->Command = 2; Users[1]->Color = QColor(0, 0, 0); Users[2]->Command = 3; Users[2]->Color = QColor(255, 0, 0); Users[3]->Command = 4; Users[3]->Color = QColor(0, 255, 0); Users[4]->Command = 5; Users[4]->Color = QColor(0, 0, 255);*/ MapScene.setMap(Map, StartPosition::IN_GAME); MapScene.addBox(1, QRect(0, 0, 50, 200)); MapScene.addBox(2, QRect(150, 0, 50, 200)); //MapScene.setUsers(&Users); ui->ChannelUserView->setModel(CUserManager::instance()->chatModel()); ui->ChannelsView->setModel(CChatManager::instance()->channelSortModel()); ui->BattleListView->setModel(CBattleManager::instance()->battleListModel()); ui->BattleListView->addAction(ui->actionDownloadMap); ui->BattleListView->addAction(ui->actionDownloadMod); ui->BattlePreviewView->setModel(CBattleManager::instance()->battlePreviewModel()); ui->DownloadView->setModel(CDownloadManager::instance()->sortModel()); ui->DownloadView->setItemDelegateForColumn(Downloader::COL_PROGRESS, new CProgressDelegate()); ui->DownloadView->addAction(ui->actionDeleteDownload); ui->BattleUserView->setModel(&CBattleroomManager::instance()->UserProxy); ui->BattleUserView->setItemDelegateForColumn(BattleroomManager::COL_SIDE, &CBattleroomManager::instance()->sideDelegate); ui->ChatMessageEdit->addAction(ui->actionChatSend); ui->actionChatSend->setShortcutContext(Qt::WidgetShortcut); ui->BattleMessageEdit->addAction(ui->actionBattleSend); ui->actionBattleSend->setShortcutContext(Qt::WidgetShortcut); DownloadContextMenu = new QMenu(ui->DownloadView); DownloadContextMenu->addActions(ui->DownloadView->actions()); BattleContextMenu = new QMenu(ui->BattleListView); BattleContextMenu->addActions(ui->BattleListView->actions()); connectSignals(); readGeometry(); if(Settings.value("Network/AutoConnect", false).toBool()) ConnectDialog.accept(); }
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))); }