void
MyApplication::init()
{
	time(&starttime);
	endtime = starttime + 5;
	done = false;

	qMainWindow = new QMainWindow();

	qButton = new QPushButton();
	qButton->setMinimumWidth(180);
	qButton->setMinimumHeight(35);
	QObject::connect(qButton, SIGNAL(clicked()), this, SLOT(myQuit()));
	update_button(*qButton);

	qMainWindow->setCentralWidget(qButton);
	QRect r = qMainWindow->frameGeometry();
	r.moveCenter(desktop()->availableGeometry().center());
	qMainWindow->move(r.topLeft());
	qMainWindow->show();

	timer = new QTimer(qMainWindow);
	QObject::connect(timer, SIGNAL(timeout()), this, SLOT(tick()));
	timer->start(334);
}
Esempio n. 2
0
void tpMainWindow::createActions()
{

    //tray
    open = new QAction(tr("&Open"), this);
    connect(open, SIGNAL(triggered()), this, SLOT(show()));


    close = new QAction(tr("&Quit"), this);
    connect(close, SIGNAL(triggered()), this, SLOT(myQuit()));

    open_in_browser = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser, SIGNAL(triggered()), this, SLOT(openStreamBrowser()));


    open_in_hexchat = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat, SIGNAL(triggered()), this, SLOT(openChatHexChat()));

    open_in_hexchat_bookmark = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat_bookmark, SIGNAL(triggered()), this, SLOT(openChatHexChatBookmark()));


    open_in_browser_bookmark = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser_bookmark, SIGNAL(triggered()), this, SLOT(openStreamBrowserBookmark()));

    add_hosted_bookmark = new QAction(tr("&Add Hosted to Bookmarks"), this);
    connect(add_hosted_bookmark, SIGNAL(triggered()), this, SLOT(addBookmarkHosted()));

    delete_bookmark = new QAction(tr("&Remove"), this);
    connect(delete_bookmark, SIGNAL(triggered()), this, SLOT(deleteBookmark()));

    add_bookmark = new QAction(tr("&Add"), this);
    connect(add_bookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));

    add_follow = new QAction(tr("&Follow Channel..."), this);
    connect(add_follow, SIGNAL(triggered()), this, SLOT(addFollow()));

    add_follower_bookmark = new QAction(tr("Follow Channel"), this);
    connect(add_follower_bookmark, SIGNAL(triggered()), this, SLOT(addFollowerBookmark()));

    delete_follower = new QAction(tr("Unfollow Channel"), this);
    connect(delete_follower, SIGNAL(triggered()), this, SLOT(deleteFollower()));

    copy_streamurl = new QAction(tr("Copy URL"), this);
    copy_streamurl->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    connect(copy_streamurl, SIGNAL(triggered()), this, SLOT(copyUrl()));

}