//note will still receive a call to disconnect from JSObjectScript.cpp, so don't
//do too much clean up here.
v8::Handle<v8::Value> JSPresenceStruct::clear()
{
    requestDisconnect();
    if (isConnected)
        deregisterAsPosListener();

    isConnected = false;
    clearPreviousConnectedCB();
    return JSSuspendable::clear();
}
Beispiel #2
0
void IRCServer::handleServerConnStateChange(int action) {
	// TODO: present these errors in a prettier way

	if (action == 1) {
		if (config.nickname.size() == 0) {
			status.pushMessage("Use /defaultnick <name> to set a nickname");
		} else if (config.altNick.size() == 0) {
			status.pushMessage("Use /altnick <name> to set an alternate nickname");
		} else if (config.hostname.size() == 0) {
			status.pushMessage("Use /server <name> to set an IRC server to connect to");
		} else {
			requestConnect();
		}
	} else if (action == 2) {
		requestDisconnect();
	}
}
    MatlabControlWidget::MatlabControlWidget(QWidget *_parent)
        : QWidget(_parent)
    {
        setupUi(this);
        connect(connectButton, SIGNAL(clicked()), this, SLOT(connectClicked()));
        connect(disconnectButton, SIGNAL(clicked()), this, SIGNAL(requestDisconnect()));
        connect(setPathButton, SIGNAL(clicked()), this, SLOT(showPathDialog()));

        pathEdit->setEnabled(false);

        QSettings settings(QApplication::organizationName(), QApplication::applicationName());
        QString lastDir = settings.value("matlab/path",  QApplication::applicationDirPath()).toString();
        pathEdit->setText(lastDir);

        setDisconnected();

    }
Beispiel #4
0
MainWindow::MainWindow() : QMainWindow() {
	
	setWindowTitle("Miroslav Beta 7");
	
	menuBar();

	fileMenu = menuBar()->addMenu(tr("File"));
	settingsMenu = menuBar()->addMenu(tr("Settings"));
	
	connectAction = new QAction(tr("Connect..."), this);
	reconnectAction = new QAction(tr("Reconnect"), this);
	disconnectAction = new QAction(tr("Disconnect"), this);
	disconnectAction->setEnabled(false);
	closeWindowAction = new QAction(tr("Close Window"), this);
	quitAction = new QAction(tr("Quit"), this);
	

	fileMenu->addAction(connectAction);
	fileMenu->addAction(reconnectAction);
	fileMenu->addAction(disconnectAction);
	fileMenu->addSeparator();
	fileMenu->addAction(closeWindowAction);
	fileMenu->addAction(quitAction);

	changeNickAction = new QAction(tr("Change Nickname..."), this);
	changeNickAction->setEnabled(false);
	changeColorAction = new QAction(tr("Change Text Color..."), this);
	changeColorAction->setEnabled(false);

	settingsMenu->addAction(changeNickAction);
	settingsMenu->addAction(changeColorAction);

	mainWidget = new MainWidget(this);
	setCentralWidget(mainWidget);
	resize(600,350);
	
	trayIcon = new TrayIcon(this);
	
	// Menu connections
	connect(connectAction, SIGNAL(triggered()), mainWidget, SLOT(requestConnection()));
	connect(reconnectAction, SIGNAL(triggered()), mainWidget, SLOT(loadSettings()));
	connect(disconnectAction, SIGNAL(triggered()), mainWidget, SLOT(requestDisconnect()));
	connect(closeWindowAction, SIGNAL(triggered()), trayIcon, SLOT(showHideWindow()));
	connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
	
	connect(changeNickAction, SIGNAL(triggered()), mainWidget, SLOT(requestChangeNick()));
	connect(changeColorAction, SIGNAL(triggered()), mainWidget, SLOT(requestChangeColor()));
	
	// Menu activate connections
	connect(mainWidget, SIGNAL(canConnect(bool)), this, SLOT(canConnect(bool)));
	connect(mainWidget, SIGNAL(canDisconnect(bool)), this, SLOT(canDisconnect(bool)));
	connect(mainWidget, SIGNAL(canChangeNick(bool)), this, SLOT(canChangeNick(bool)));
	connect(mainWidget, SIGNAL(canChangeColor(bool)), this, SLOT(canChangeColor(bool)));
	
	// Tray Icon connections
	connect(trayIcon, SIGNAL(requestExit()), qApp, SLOT(quit()));
	connect(trayIcon, SIGNAL(showChatWindow(bool)), this, SLOT(setVisible(bool)));	

	connect(mainWidget, SIGNAL(newMessage(QString, QString)), this, SLOT(newMessage(QString, QString)));
	
	mainWidget->loadSettings();
	show();
}