コード例 #1
0
ファイル: mainwindowimpl.cpp プロジェクト: tieugene/qrdc
void	MainWindowImpl::setSlots(void) {
	connect( actionExit,		SIGNAL( triggered() ),	this, SLOT( onActionExit() ) );
	connect( actionConnections,	SIGNAL( triggered() ),	this, SLOT( onActionConnections() ) );
	connect( actionHosts,		SIGNAL( triggered() ),	this, SLOT( onActionHosts() ) );
	connect( actionVariables,	SIGNAL( triggered() ),	this, SLOT( onActionVariables() ) );
	connect( actionProtocols,	SIGNAL( triggered() ),	this, SLOT( onActionProtocols() ) );
    connect( actionAdd,         SIGNAL( triggered() ),	this, SLOT( onActionAdd() ) );
	connect( actionEdit,		SIGNAL( triggered() ),	this, SLOT( onActionEdit() ) );
    connect( actionDel,         SIGNAL( triggered() ),	this, SLOT( onActionDel() ) );
	connect( actionOpen,		SIGNAL( triggered() ),	this, SLOT( onActionOpen() ) );
	connect( actionSettings,	SIGNAL( triggered() ),	this, SLOT( onActionSettings() ) );
	connect( actionBackupDB,	SIGNAL( triggered() ),	this, SLOT( onActionBackup() ) );
	connect( actionRestoreDB,	SIGNAL( triggered() ),	this, SLOT( onActionRestore() ) );
	connect( actionAbout,		SIGNAL( triggered() ),	this, SLOT( onActionAbout() ) );
	connect( actionAboutQt,		SIGNAL( triggered() ),	this, SLOT( onActionAboutQt() ) );
    connect( tray,              SIGNAL( activated ( QSystemTrayIcon::ActivationReason)), this, SLOT(onTray(QSystemTrayIcon::ActivationReason)));
	connect( actionHideRestore,	SIGNAL( triggered() ),	this, SLOT(onHideRestore()));
}
コード例 #2
0
void	MainWindowImpl::setSlots(void) {
	connect( actionNew,		SIGNAL( triggered() ),	this, SLOT( onActionNew() ) );
	connect( actionOpen,		SIGNAL( triggered() ),	this, SLOT( onActionOpen() ) );
	connect( actionSaveAs,		SIGNAL( triggered() ),	this, SLOT( onActionSaveAs() ) );
	connect( actionProperties,	SIGNAL( triggered() ),	this, SLOT( onActionProperties() ) );
	connect( actionExit,		SIGNAL( triggered() ),	this, SLOT( onActionExit() ) );
	connect( actionCut,		SIGNAL( triggered() ),	this, SLOT( onActionCut() ) );
	connect( actionCopy,		SIGNAL( triggered() ),	this, SLOT( onActionCopy() ) );
	connect( actionPaste,		SIGNAL( triggered() ),	this, SLOT( onActionPaste() ) );
	connect( actionSelectAll,	SIGNAL( triggered() ),	this, SLOT( onActionSelectAll() ) );
	connect( actionDeselect,	SIGNAL( triggered() ),	this, SLOT( onActionDeselect() ) );
	connect( actionAddFile,		SIGNAL( triggered() ),	this, SLOT( onActionAddFile() ) );
	connect( actionAddDirectory,	SIGNAL( triggered() ),	this, SLOT( onActionAddDirectory() ) );
	connect( actionDelete,		SIGNAL( triggered() ),	this, SLOT( onActionDelete() ) );
	connect( actionAbout,		SIGNAL( triggered() ),	this, SLOT( onActionAbout() ) );
	connect( actionAboutQt,		SIGNAL( triggered() ),	this, SLOT( onActionAboutQt() ) );
	connect( treeView->selectionModel(),	SIGNAL( currentChanged(const QModelIndex &, const QModelIndex &) ),	this, SLOT( onItemSelected(const QModelIndex &, const QModelIndex &) ) );
	connect( pbGo,			SIGNAL( clicked() ),	this, SLOT( onGo() ) );
}
コード例 #3
0
ファイル: IrcMainWindow.cpp プロジェクト: NickManley/Qirc
IrcMainWindow::IrcMainWindow(QWidget *parent) :
    QWidget(parent)
{
    ircSessionTreeView = new QTreeWidget(this);
    ircTextView = new QTextBrowser(this);
    ircUserListView = new QListWidget(this);
    ircTextInput = new QLineEdit(this);
    ircMenuBar = new QMenuBar(this);

    ircChatView = new QWidget(this);
    vboxChat = new QVBoxLayout(ircChatView);
    hbox = new QSplitter(this);
    layout = new QBoxLayout(QBoxLayout::TopToBottom, this);

    ircTextInput->setFocus(Qt::ActiveWindowFocusReason);
    ircTextInput->setFocus(Qt::PopupFocusReason);
    ircSessionTreeView->setFont(QFont("", 10));
    ircSessionTreeView->setColumnCount(1);
    ircSessionTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ircSessionTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
    ircSessionTreeView->setHeaderHidden(true);
    ircSessionTreeView->setIndentation(10);
    ircTextView->setReadOnly(true);
    ircUserListView->setSortingEnabled(false);

    QObject::connect(ircUserListView,
		     SIGNAL(itemDoubleClicked(QListWidgetItem*)),
		     this, SLOT(onUserDoubleClicked(QListWidgetItem*)));
    QObject::connect(ircTextInput, SIGNAL(returnPressed()),
		     this, SLOT(onInputTextEntered()));
    QObject::connect(ircSessionTreeView, SIGNAL(itemSelectionChanged()),
		     this, SLOT(onSelectionChanged()));
    QObject::connect(ircTextView, SIGNAL(textChanged()),
		     this, SLOT(onDocumentUpdated()));

    // Setup actions
    actCloseChannel = new QAction(QIcon("closeicon.png"),"Close",this);
	ircSessionTreeView->setContextMenuPolicy(Qt::ActionsContextMenu);
	ircSessionTreeView->addAction(actCloseChannel);
	QObject::connect(actCloseChannel, SIGNAL(triggered()),
		    this, SLOT(onActionCloseChannel()));
    actViewHelp = new QAction("Documentation", this);
	QObject::connect(actViewHelp, SIGNAL(triggered()),
		    this, SLOT(onActionViewHelp()));
    actViewLicense = new QAction("License", this);
	QObject::connect(actViewLicense, SIGNAL(triggered()),
		    this, SLOT(onActionViewLicense()));
    actViewAbout = new QAction("About", this);
	QObject::connect(actViewAbout, SIGNAL(triggered()),
		    this, SLOT(onActionViewAbout()));
    actConnect = new QAction("Connect", this);
	QObject::connect(actConnect, SIGNAL(triggered()),
		     this, SLOT(onActionConnect()));
    actDisconnect = new QAction("Disconnect", this);
	QObject::connect(actDisconnect, SIGNAL(triggered()),
		     this, SLOT(onActionDisconnect()));
    actExit = new QAction("Exit", this);
	QObject::connect(actExit, SIGNAL(triggered()),
		     this, SLOT(onActionExit()));
    actJoinChannel = new QAction("Join Channel", this);
	QObject::connect(actJoinChannel, SIGNAL(triggered()),
		     this, SLOT(onActionJoinChannel()));
    actChangeNick = new QAction("Change Nick", this);
	QObject::connect(actChangeNick, SIGNAL(triggered()),
		     this, SLOT(onActionChangeNick()));
    // Setup menus
    menuServer = new QMenu("Server", this);
	menuServer->addAction(actConnect);
	menuServer->addAction(actJoinChannel);
	menuServer->addAction(actChangeNick);
	menuServer->addAction(actDisconnect);
	menuServer->addAction(actExit);
    menuChannel = new QMenu("Channel", this);
	menuChannel->setEnabled(false);
    menuUser = new QMenu("User", this);
	menuUser->setEnabled(false);
    menuBookmarks = new QMenu("Bookmarks", this);
	menuBookmarks->setEnabled(false);
    menuHelp = new QMenu("Help", this);
	menuHelp->addAction(actViewHelp);
	menuHelp->addAction(actViewLicense);
	menuHelp->addAction(actViewAbout);
    // Setup menu bar
    ircMenuBar->addMenu(menuServer);
    //ircMenuBar->addMenu(menuChannel);
    //ircMenuBar->addMenu(menuUser);
    //ircMenuBar->addMenu(menuBookmarks);
    ircMenuBar->addMenu(menuHelp);

    // Setup ircChatArea
    vboxChat->addWidget(ircTextView);
    vboxChat->addWidget(ircTextInput);
    vboxChat->setMargin(0);
    ircChatView->setLayout(vboxChat);

    // Setup horizontal display for the main window
    hbox->addWidget(ircSessionTreeView);
    hbox->addWidget(ircChatView);
    hbox->addWidget(ircUserListView);
    hbox->setStretchFactor(0, 2);
    hbox->setStretchFactor(1, 10);
    hbox->setStretchFactor(2, 2);

    layout->setDirection(QBoxLayout::TopToBottom);
    layout->setMenuBar(ircMenuBar);
    layout->addWidget(hbox);
    //setupStatusBar();

    layout->setMargin(8);
    this->setMinimumWidth(300);
    this->setLayout(layout);
    this->resize(800, 500);
    this->setWindowTitle("Qirc IRC Client");
    this->setWindowIcon(QIcon("Qirc32.ico"));
}