示例#1
0
void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
{
    std::string::size_type pos = command.find(' ');
    std::string type(command, 0, pos);
    std::string args(command, pos == std::string::npos ? command.size() : pos + 1);

    if (type == "help") // Do help before tabs so they can't override it
    {
        handleHelp(args, tab);
    }
    else if (tab->handleCommand(type, args))
    {
        // Nothing to do
    }
    else if (type == "announce")
    {
        handleAnnounce(args, tab);
    }
    else if (type == "where")
    {
        handleWhere(args, tab);
    }
    else if (type == "who")
    {
        handleWho(args, tab);
    }
    else if (type == "msg" || type == "whisper" || type == "w")
    {
        handleMsg(args, tab);
    }
    else if (type == "query" || type == "q")
    {
        handleQuery(args, tab);
    }
    else if (type == "ignore")
    {
        handleIgnore(args, tab);
    }
    else if (type == "unignore")
    {
        handleUnignore(args, tab);
    }
    else if (type == "join")
    {
        handleJoin(args, tab);
    }
    else if (type == "list")
    {
        handleListChannels(args, tab);
    }
    else if (type == "clear")
    {
        handleClear(args, tab);
    }
    else if (type == "party")
    {
        handleParty(args, tab);
    }
    else if (type == "me")
    {
        handleMe(args, tab);
    }
    else if (type == "record")
    {
        handleRecord(args, tab);
    }
    else if (type == "toggle")
    {
        handleToggle(args, tab);
    }
    else if (type == "present")
    {
        handlePresent(args, tab);
    }
    else
    {
        tab->chatLog(_("Unknown command."));
    }
}
示例#2
0
FunkytownConfigDialog::FunkytownConfigDialog( QWidget *parent )
: QDialog( parent )
, mpProxyWidget( new ProxyWidget( this ) )
, mpLogList( new QListWidget( this ) )
, mpHelpText( new QTextBrowser( this ) )
, mpGlobalConfigWidget( new GlobalConfigWidget( this ) )
, mpOverwrite( new QCheckBox( tr("Overwrite Files During Download"), this ) )
, mpCoverArt( new QCheckBox( tr("Download Cover-Like Artwork"), this ) )
, mpTollKeep( new QCheckBox( tr("Count Downloaded Files And Bytes"), this ) )
, mpDownloadedFiles( new QLabel( this ) )
, mpDownloadedBytes( new QLabel( this ) )
, mpClearButton( new QPushButton( tr("Clear"), this ) )
{
   setWindowTitle( QApplication::applicationName() + ": " + tr("Settings") );
   setWindowIcon( QIcon( ":/Funkytown/Icon.png" ) );

   mpHelpText->setReadOnly( true );
   mpHelpText->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
   mpHelpText->setOpenExternalLinks( true );
   mpHelpText->setSource( QUrl("qrc:/Usage.html") );

   AboutWidget *about( new AboutWidget( this ) );
   QPushButton *okButton( new QPushButton(tr("OK"), this) );
   QPushButton *cancelButton( new QPushButton(tr("Cancel"), this) );

   QHBoxLayout *buttonLayout = new QHBoxLayout;
   buttonLayout->addWidget( okButton );
   buttonLayout->addWidget( cancelButton );

   QWidget     *settingsTab    = new QWidget( this );
   QGridLayout *settingsLayout = new QGridLayout( settingsTab );
   settingsLayout->addWidget( mpOverwrite, 0, 0, 1, 3 );
   settingsLayout->addWidget( mpCoverArt,  1, 0, 1, 3 );
   settingsLayout->addWidget( mpTollKeep,  2, 0, 1, 3 );
   settingsLayout->addWidget( new QLabel( tr("Downloaded Files:"), this ), 3, 0 );
   settingsLayout->addWidget( mpDownloadedFiles, 3, 1 );
   settingsLayout->addWidget( new QLabel( tr("Downloaded Bytes:"), this ), 4, 0 );
   settingsLayout->addWidget( mpDownloadedBytes, 4, 1 );
   settingsLayout->addWidget( mpClearButton, 3, 2, 2, 1 );
   settingsLayout->setRowStretch( 5, 1 );

   QBoxLayout *mainLayout = new QVBoxLayout( this );
   QTabWidget *tabs       = new QTabWidget( this );
   tabs->addTab( mpHelpText,           tr("Help") );
   tabs->addTab( settingsTab,          tr("Funkytown") );
   tabs->addTab( mpProxyWidget,        tr("Proxy") );
   tabs->addTab( mpGlobalConfigWidget, tr("Global") );
   tabs->addTab( mpLogList,            tr("Log") );

   mainLayout->addWidget( about );
   mainLayout->addWidget( tabs );
   mainLayout->addLayout( buttonLayout );

   setLayout( mainLayout );

   connect( mpClearButton, SIGNAL(clicked()),
            this, SLOT(handleClear()) );
   connect( okButton, SIGNAL(clicked()),
            this, SLOT(accept()) );
   connect( cancelButton, SIGNAL(clicked()),
            this, SLOT(reject()) );
   connect( this, SIGNAL(accepted()),
            this, SLOT(writeSettings()) );
   connect( this, SIGNAL(rejected()),
            this, SLOT(readSettings()) );

   readSettings();
}
示例#3
0
	void RenderTarget::clear() const
	{
		handleClear();
	}