コード例 #1
0
void BattleResultsApplied::applyCl(CClient *cl)
{
	INTERFACE_CALL_IF_PRESENT(player1, battleResultsApplied);
	INTERFACE_CALL_IF_PRESENT(player2, battleResultsApplied);
	INTERFACE_CALL_IF_PRESENT(PlayerColor::UNFLAGGABLE, battleResultsApplied);
	if(GS(cl)->initialOpts->mode == StartInfo::DUEL)
	{
		handleQuit();
	}
}
コード例 #2
0
void keyServer::slotSearch()
{
        if (page->kCBimportks->currentText().isEmpty())
                return;

        if (page->kLEimportid->text().isEmpty()) {
                KMessageBox::sorry(this,i18n("You must enter a search string."));
                return;
        }

        //listpop = new KeyServer( this,"result",WType_Dialog | WShowModal);

	dialogServer=new KDialogBase(KDialogBase::Swallow, i18n("Import Key From Keyserver"),  KDialogBase::Ok | KDialogBase::Close,KDialogBase::Ok,this,0,true);

	dialogServer->setButtonText(KDialogBase::Ok,i18n("&Import"));
	dialogServer->enableButtonOK(false);
	listpop=new searchRes();
	listpop->kLVsearch->setColumnWidthMode(0,QListView::Manual);
	listpop->kLVsearch->setColumnWidthMode(1,QListView::Manual);
	listpop->kLVsearch->setColumnWidth(0,150);
	listpop->kLVsearch->setColumnWidth(1,130);
        listpop->statusText->setText(i18n("Connecting to the server..."));
        connect(listpop->kLVsearch,SIGNAL(selectionChanged()),this,SLOT(transferKeyID()));
        connect(dialogServer,SIGNAL(okClicked()),this,SLOT(preimport()));
        connect(listpop->kLVsearch,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),dialogServer,SIGNAL(okClicked()));

        connect(dialogServer,SIGNAL(closeClicked()),this,SLOT(handleQuit()));
        connect( listpop , SIGNAL( destroyed() ) , this, SLOT( abortSearch()));
        count=0;
        cycle=false;
        readmessage=QString::null;
        searchproc=new KProcIO(QTextCodec::codecForLocale());
        QString keyserv=page->kCBimportks->currentText();
        *searchproc<<"gpg"<<"--utf8-strings";
        if (page->cBproxyI->isChecked()) {
                searchproc->setEnvironment("http_proxy",page->kLEproxyI->text());
                *searchproc<<	"--keyserver-options"<<"honor-http-proxy";
        } else
                *searchproc<<	"--keyserver-options"<<"no-honor-http-proxy";
        *searchproc<<"--keyserver"<<keyserv<<"--command-fd=0"<<"--status-fd=2"<<"--search-keys"<<page->kLEimportid->text().stripWhiteSpace();

        keyNumbers=0;
        QObject::connect(searchproc, SIGNAL(processExited(KProcess *)),this, SLOT(slotsearchresult(KProcess *)));
        QObject::connect(searchproc, SIGNAL(readReady(KProcIO *)),this, SLOT(slotsearchread(KProcIO *)));
        searchproc->start(KProcess::NotifyOnExit,true);
	QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
	dialogServer->setMainWidget(listpop);
	listpop->setMinimumSize(listpop->sizeHint());
	listpop->setMinimumWidth(550);
        dialogServer->exec();
}
コード例 #3
0
ファイル: PlayerDriver.cpp プロジェクト: zhxinx/HelixInWebkit
PlayerCommand* PlayerDriver::DoProcessQueue(status_t& ret)
{
    PlayerCommand* ec = dequeueCommand();
	printf("HelixOverWebkit [%s] [%s] [%d] ec %p, ec->command() %d\n", __FILE__, __FUNCTION__, __LINE__, ec, (ec == NULL)?-1: ec->command());
    if (ec)
    {
        switch(ec->command())
        {
        case PlayerCommand::PLAYER_SET_DATA_SOURCE:
            ret = handleSetDataSource(static_cast<PlayerSetDataSource*>(ec));
            break;

        case PlayerCommand::PLAYER_PREPARE:
            ret = handlePrepare(static_cast<PlayerPrepare*>(ec));
            break;

        case PlayerCommand::PLAYER_START:
            ret = handleStart(static_cast<PlayerStart*>(ec));
            break;

        case PlayerCommand::PLAYER_STOP:
            ret = handleStop(static_cast<PlayerStop*>(ec));
            break;

        case PlayerCommand::PLAYER_PAUSE:
            ret = handlePause(static_cast<PlayerPause*>(ec));
            break;

        case PlayerCommand::PLAYER_SEEK:
            ret = handleSeek(static_cast<PlayerSeek*>(ec));
            break;

        case PlayerCommand::PLAYER_GET_POSITION:
            ret = handleGetPosition(static_cast<PlayerGetPosition*>(ec));
            break;

        case PlayerCommand::PLAYER_RESET:
            ret = handleReset(static_cast<PlayerReset*>(ec));
            break;

        case PlayerCommand::PLAYER_QUIT:
            ret = handleQuit(static_cast<PlayerQuit*>(ec));
            break;

        default:
            //cout << "Unexpected command %d" <<  ec->command();
            break;
        }
    }
    return ec;
}
コード例 #4
0
ファイル: MailServer.cpp プロジェクト: swe1repo/hts-ue1-2
void MailServer::messageReceived(int sd, boost::shared_ptr<Message> msg)
{
	DEBUG("A message has been dispatched!");

	// Don't accept messages from users that aren't authenticated yet.
	if( msg->getType() != Message::MessageTypeLogin &&
		msg->getType() != Message::MessageTypeQuit  &&
		loginManager_.isLoggedIn() == false)
	{
		sendErr(sd);
		return;
	}

	switch( msg->getType() )
	{
		case Message::MessageTypeSend:
			handleSend(static_cast<SendMessage&>(*msg));
			break;
		case Message::MessageTypeList:
			handleList(static_cast<ListMessage&>(*msg));
			break;
		case Message::MessageTypeRead:
			handleRead(static_cast<ReadMessage&>(*msg));
			break;
		case Message::MessageTypeDel:
			handleDel(static_cast<DelMessage&>(*msg));
			break;
		case Message::MessageTypeQuit:
			handleQuit(static_cast<QuitMessage&>(*msg));
			break;
		case Message::MessageTypeLogin:
			handleLogin(static_cast<LoginMessage&>(*msg));
			break;
		case Message::MessageTypeInvalid:
		default:
			DEBUG("Ignoring: An invalid/unknown message type was received. Code: [" << (*msg).getType() << "].");
			break;
	}
}
コード例 #5
0
ファイル: sig.c プロジェクト: alemic/wheatserver
void signalGenericHandle(int sig)
{
    if (sig == SIGCHLD)
        handleChld();
    else if (sig == SIGHUP)
        handleHup();
    else if (sig == SIGQUIT)
        handleQuit();
    else if (sig == SIGINT)
        handleInt();
    else if (sig == SIGTERM)
        handleTerm();
    else if (sig == SIGTTIN)
        handleTtin();
    else if (sig == SIGTTOU)
        handleTtou();
    else if (sig == SIGUSR1)
        handleUsr1();
    else if (sig == SIGUSR2)
        handleUsr2();
    else if (sig == SIGWINCH)
        handleWinch();
}
コード例 #6
0
ファイル: main.cpp プロジェクト: CurtisMcKinney/OSCthulhu
//stdin and stdout for interapplication communication
int main(int argc, char *argv[])
{
    QSemaphore* wait4CleanupDone = new QSemaphore(1);
    int r;
    if(argc>2) {
    if(std::string(argv[1]).compare("Server") == 0) {
       //Standard Server Mode
       QCoreApplication a(argc, argv);
       OSCthulhuServer* server = new OSCthulhuServer(atoi(argv[2]),QString(argv[3]));
       r = a.exec();
       wait4CleanupDone->acquire();
   } else if(std::string(argv[1]).compare("daemon") == 0) {
    #if defined(__WIN32__) || defined(WIN32)

    #else
       //Daemon Server Mode
       /* Our process ID and Session ID */
              pid_t pid, sid;

              /* Fork off the parent process */
              pid = fork();
              if (pid < 0) {
                      exit(EXIT_FAILURE);
              }
              /* If we got a good PID, then
                 we can exit the parent process. */
              if (pid > 0) {
                      exit(EXIT_SUCCESS);
              }

              /* Change the file mode mask */
              umask(0);

              /* Open any logs here */

              /* Create a new SID for the child process */
              sid = setsid();
              if (sid < 0) {
                      /* Log the failure */
                      exit(EXIT_FAILURE);
              }

              /* Change the current working directory */
              if ((chdir("/")) < 0) {
                      /* Log the failure */
                      exit(EXIT_FAILURE);
              }

              /* Close out the standard file descriptors */
              close(STDIN_FILENO);
              close(STDOUT_FILENO);
              close(STDERR_FILENO);

       QCoreApplication a(argc, argv);
       OSCthulhuServer* server = new OSCthulhuServer(atoi(argv[2]),QString(argv[3]));
       r = a.exec();
       wait4CleanupDone->acquire();
       exit(EXIT_SUCCESS);
       #endif
   }

   } else {
       //Client Mode

       QApplication a(argc, argv);
       a.setApplicationName("OSCthulhu");
       a.setApplicationVersion("2.0a");
       a.setOrganizationName("Curtis McKinney");
       a.setOrganizationDomain("curtismckinney.com");
       QFile styleFile(":/style/gui/cthulhuStyleSheet.qss");
       if(styleFile.open(QFile::ReadOnly))
       {
           QString styleSheet = QLatin1String(styleFile.readAll());
           qApp->setStyleSheet(styleSheet);
       }
       //a.setStyle(new QPlastiqueStyle);

       QSettings* settings = new QSettings();
       OSCthulhuClient* client = new OSCthulhuClient(
                   settings->value("serverAddress",QVariant("127.0.0.1")).toString(),
                   settings->value("serverPassword",QVariant("lagpass")).toString(),
                   settings->value("userName",QVariant("Hatchling")).toString(),
                   settings->value("userPassword",QVariant("fakePass")).toString(),
                   settings->value("serverPort",QVariant(32242)).toInt(),
                   settings->value("clientPort",QVariant(32243)).toInt(),
                   settings->value("appPort",QVariant(32244)).toInt(),
                   wait4CleanupDone,
                   settings
       );

       QObject::connect(&a, SIGNAL(aboutToQuit()), client, SLOT(handleQuit()));
       r = a.exec();
       wait4CleanupDone->acquire();
    }
    return r;
}
コード例 #7
0
ファイル: QtLoginWindow.cpp プロジェクト: swift/swift
QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* settings, TimerFactory* timerFactory) : QMainWindow(), settings_(settings), timerFactory_(timerFactory) {
    uiEventStream_ = uiEventStream;

    setWindowTitle("Swift");
#ifndef Q_OS_MAC
#ifdef  Q_OS_WIN32
    setWindowIcon(QIcon(":/logo-icon-16-win.png"));
#else
    setWindowIcon(QIcon(":/logo-icon-16.png"));
#endif
#endif
    QtUtilities::setX11Resource(this, "Main");
    setAccessibleName(tr("Swift Login Window"));
    //setAccessibleDescription(tr("This window is used for providing credentials to log into your XMPP service"));

    resize(200, 500);
    setContentsMargins(0,0,0,0);
    QWidget *centralWidget = new QWidget(this);
    setCentralWidget(centralWidget);
    QBoxLayout *topLayout = new QBoxLayout(QBoxLayout::TopToBottom, centralWidget);
    stack_ = new QStackedWidget(centralWidget);
    topLayout->addWidget(stack_);
    topLayout->setMargin(0);
    loginWidgetWrapper_ = new QWidget(this);
    loginWidgetWrapper_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, loginWidgetWrapper_);
    layout->addStretch(2);

    QLabel* logo = new QLabel(this);
    QIcon swiftWithTextLogo = QIcon(":/logo-shaded-text.png");
    logo->setPixmap(swiftWithTextLogo.pixmap(QSize(192,192)));

    QWidget *logoWidget = new QWidget(this);
    QHBoxLayout *logoLayout = new QHBoxLayout();
    logoLayout->setMargin(0);
    logoLayout->addStretch(0);
    logoLayout->addWidget(logo);
    logoLayout->addStretch(0);
    logoWidget->setLayout(logoLayout);
    layout->addWidget(logoWidget);

    layout->addStretch(2);

    QLabel* jidLabel = new QLabel(this);
    jidLabel->setText("<font size='-1'>" + tr("User address:") + "</font>");
    layout->addWidget(jidLabel);


    username_ = new QComboBox(this);
    username_->setEditable(true);
    username_->setWhatsThis(tr("User address - looks like [email protected]"));
    username_->setToolTip(tr("User address - looks like [email protected]"));
    username_->view()->installEventFilter(this);
    username_->setAccessibleName(tr("User address (of the form [email protected])"));
    username_->setAccessibleDescription(tr("This is the user address that you'll be using to log in with"));
    layout->addWidget(username_);
    QLabel* jidHintLabel = new QLabel(this);
    jidHintLabel->setText("<font size='-1' color='grey' >" + tr("Example: [email protected]") + "</font>");
    jidHintLabel->setAlignment(Qt::AlignRight);
    layout->addWidget(jidHintLabel);


    QLabel* passwordLabel = new QLabel();
    passwordLabel->setText("<font size='-1'>" + tr("Password:"******"</font>");
    passwordLabel->setAccessibleName(tr("User password"));
    passwordLabel->setAccessibleDescription(tr("This is the password you'll use to log in to the XMPP service"));
    layout->addWidget(passwordLabel);


    QWidget* w = new QWidget(this);
    w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    layout->addWidget(w);

    QHBoxLayout* credentialsLayout = new QHBoxLayout(w);
    credentialsLayout->setMargin(0);
    credentialsLayout->setSpacing(3);
    password_ = new QLineEdit(this);
    password_->setEchoMode(QLineEdit::Password);
    connect(password_, SIGNAL(returnPressed()), this, SLOT(loginClicked()));
    connect(username_->lineEdit(), SIGNAL(returnPressed()), password_, SLOT(setFocus()));
    connect(username_, SIGNAL(editTextChanged(const QString&)), this, SLOT(handleUsernameTextChanged()));
    credentialsLayout->addWidget(password_);

    certificateButton_ = new QToolButton(this);
    certificateButton_->setCheckable(true);
    certificateButton_->setIcon(QIcon(":/icons/certificate.png"));
    certificateButton_->setToolTip(tr("Click if you have a personal certificate used for login to the service."));
    certificateButton_->setWhatsThis(tr("Click if you have a personal certificate used for login to the service."));
    certificateButton_->setAccessibleName(tr("Login with certificate"));
    certificateButton_->setAccessibleDescription(tr("Click if you have a personal certificate used for login to the service."));

    credentialsLayout->addWidget(certificateButton_);
    connect(certificateButton_, SIGNAL(clicked(bool)), SLOT(handleCertficateChecked(bool)));

    loginButton_ = new QPushButton(this);
    loginButton_->setText(tr("Connect"));
    loginButton_->setAutoDefault(true);
    loginButton_->setDefault(true);
    loginButton_->setAccessibleName(tr("Connect now"));
    layout->addWidget(loginButton_);

    QLabel* connectionOptionsLabel = new QLabel(this);
    connectionOptionsLabel->setText("<a href=\"#\"><font size='-1'>" + QObject::tr("Connection Options") + "</font></a>");
    connectionOptionsLabel->setTextFormat(Qt::RichText);
    connectionOptionsLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    layout->addWidget(connectionOptionsLabel);
    connect(connectionOptionsLabel, SIGNAL(linkActivated(const QString&)), SLOT(handleOpenConnectionOptions()));

    message_ = new QLabel(this);
    message_->setTextFormat(Qt::RichText);
    message_->setWordWrap(true);
    layout->addWidget(message_);

    layout->addStretch(2);
    remember_ = new QCheckBox(tr("Remember Password?"), this);
    layout->addWidget(remember_);
    loginAutomatically_ = new QCheckBox(tr("Login Automatically?"), this);
    layout->addWidget(loginAutomatically_);

    connect(loginButton_, SIGNAL(clicked()), SLOT(loginClicked()));
    stack_->addWidget(loginWidgetWrapper_);
#ifdef SWIFTEN_PLATFORM_MACOSX
    menuBar_ = new QMenuBar(nullptr);
#else
    menuBar_ = menuBar();
#endif
    QApplication::setQuitOnLastWindowClosed(false);

    swiftMenu_ = new QMenu(tr("&Swift"), this);
#ifdef SWIFTEN_PLATFORM_MACOSX
    generalMenu_ = new QMenu(tr("&General"), this);
#else
    generalMenu_ = swiftMenu_;
#endif

#ifdef SWIFTEN_PLATFORM_MACOSX
    QAction* aboutAction = new QAction(QString("&About %1").arg("Swift"), this);
#else
    QAction* aboutAction = new QAction(QString(tr("&About %1")).arg("Swift"), this);
#endif
    connect(aboutAction, SIGNAL(triggered()), SLOT(handleAbout()));
    swiftMenu_->addAction(aboutAction);

    xmlConsoleAction_ = new QAction(tr("&Show Debug Console"), this);
    connect(xmlConsoleAction_, SIGNAL(triggered()), SLOT(handleShowXMLConsole()));
    generalMenu_->addAction(xmlConsoleAction_);

#ifdef SWIFT_EXPERIMENTAL_FT
    fileTransferOverviewAction_ = new QAction(tr("Show &File Transfer Overview"), this);
    connect(fileTransferOverviewAction_, SIGNAL(triggered()), SLOT(handleShowFileTransferOverview()));
    generalMenu_->addAction(fileTransferOverviewAction_);
#endif

    highlightEditorAction_ = new QAction(tr("&Edit Highlight Rules"), this);
    connect(highlightEditorAction_, SIGNAL(triggered()), SLOT(handleShowHighlightEditor()));
    generalMenu_->addAction(highlightEditorAction_);

    toggleSoundsAction_ = new QAction(tr("&Play Sounds"), this);
    toggleSoundsAction_->setCheckable(true);
    toggleSoundsAction_->setChecked(settings_->getSetting(SettingConstants::PLAY_SOUNDS));
    connect(toggleSoundsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool)));
    generalMenu_->addAction(toggleSoundsAction_);

    toggleNotificationsAction_ = new QAction(tr("Display Pop-up &Notifications"), this);
    toggleNotificationsAction_->setCheckable(true);
    toggleNotificationsAction_->setChecked(settings_->getSetting(SettingConstants::SHOW_NOTIFICATIONS));
    connect(toggleNotificationsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleNotifications(bool)));

#ifndef SWIFTEN_PLATFORM_MACOSX
    swiftMenu_->addSeparator();
#endif

#ifdef SWIFTEN_PLATFORM_MACOSX
    QAction* quitAction = new QAction("&Quit", this);
#else
    QAction* quitAction = new QAction(tr("&Quit"), this);
#endif
    connect(quitAction, SIGNAL(triggered()), SLOT(handleQuit()));
    swiftMenu_->addAction(quitAction);

    setInitialMenus();
    settings_->onSettingChanged.connect(boost::bind(&QtLoginWindow::handleSettingChanged, this, _1));

    bool eagle = settings_->getSetting(SettingConstants::FORGET_PASSWORDS);
    remember_->setEnabled(!eagle);
    loginAutomatically_->setEnabled(!eagle);
    xmlConsoleAction_->setEnabled(!eagle);
    if (eagle) {
        remember_->setChecked(false);
        loginAutomatically_->setChecked(false);
    }

#ifdef SWIFTEN_PLATFORM_MACOSX
    // Temporary workaround for case 501. Could be that this code is still
    // needed when Qt provides a proper fix
    qApp->installEventFilter(this);
#endif


    this->show();
}