Ejemplo n.º 1
0
void Window::joinedChannel(const IrcClient::Channel& channel)
{
    ChannelPage* channelPage;

    if (channelPages.contains(channel.getName())) {
        channelPage = channelPages[channel.getName()];
        channelPage->enable();
    } else {
        channelPage = createChannelPage(channel.getName());
    }

    connect(&channel, &IrcClient::Channel::topicTextResponse,  channelPage, &ChannelPage::topicTextResponse);
    connect(&channel, &IrcClient::Channel::topicInfoResponse,  channelPage, &ChannelPage::topicInfoResponse);
    connect(&channel, &IrcClient::Channel::nicksReady,         channelPage, &ChannelPage::nicksReady);
    connect(&channel, &IrcClient::Channel::channelMessage,     channelPage, &ChannelPage::channelMessage);
    connect(&channel, &IrcClient::Channel::action,             channelPage, &ChannelPage::action);
    connect(&channel, &IrcClient::Channel::join,               channelPage, &ChannelPage::join);
    connect(&channel, &IrcClient::Channel::nickChange,         channelPage, &ChannelPage::nickChange);
    connect(&channel, &IrcClient::Channel::notice,             channelPage, &ChannelPage::notice);
    connect(&channel, &IrcClient::Channel::part,               channelPage, &ChannelPage::part);
    connect(&channel, &IrcClient::Channel::quit,               channelPage, &ChannelPage::quit);
    connect(&channel, &IrcClient::Channel::topicChanged,       channelPage, &ChannelPage::topicChanged);
    connect(&channel, &IrcClient::Channel::modeChanged,        channelPage, &ChannelPage::modeChanged);
    connect(&channel, &IrcClient::Channel::kick,               channelPage, &ChannelPage::kick);
    connect(&channel, &IrcClient::Channel::topicChanged,       this,        &Window::changeTopic);
    connect(&channel, &IrcClient::Channel::topicTextResponse,  this,        &Window::changeTopic);
    connect(&channelPage->getUserTreeModel(), &UserTreeModel::branchAdded, userTree, &UserTree::expand);

    switchToTab(channelPage->getTab());
}
Ejemplo n.º 2
0
void TabWidget::addUnityBrowserWithSR( QString sr, int id )
{
    if ( sr == QString::Null() )
    {
        sr = Kueue::getClipboard();
    }

    if ( Kueue::isSrNr( sr ) )
    {
        UnityWidget* w = new UnityWidget( this, sr );

        int tab;

        if ( id == 0 )
        {
            tab = addTab( w, QIcon( ":/icons/menus/siebel.png" ), "Unity" );
        }
        else
        {
            tab = id;
            insertTab( id, w, QIcon( ":/icons/menus/siebel.png" ), "Unity" );
        }

        qDebug() << "[TABWIDGET] Adding Unity Tab with ID " << QString::number( tab );

        w->setTabId( tab );

        mUnityWidgetList.append( w );
        mUnityBrowserMap[ tab ] = w->browser();

        switchToTab( tab );
    }
}
Ejemplo n.º 3
0
TeamMenu::TeamMenu(TeamBuilder *tb, QAbstractItemModel *pokeModel, TeamHolder *team, int index) :
    ui(new _ui()), m_team(team), lastGen(team->team().gen())
{
    setMainWindow(tb);
    setTeambuilder(tb);
    PokeEdit::hackMons = team->team().hackMons() == "true";
    ui->pokemonModel = pokeModel;
    setupUi();
    updateTabs();

    if (0) {
        addDock(PokeEdit::EVDock, Qt::RightDockWidgetArea, new QDockWidget(tr("EVs"), this));
        addDock(PokeEdit::LevelDock, Qt::RightDockWidgetArea, new QDockWidget(tr("Level && Gender"), this));
        addDock(PokeEdit::MoveDock, Qt::BottomDockWidgetArea, new QDockWidget(tr("Moves"), this));
        addDock(PokeEdit::IVDock, Qt::BottomDockWidgetArea, new QDockWidget(tr("IVs, Ability && Hidden Power"), this));

        window->splitDockWidget(getDock(PokeEdit::EVDock), getDock(PokeEdit::LevelDock), Qt::Horizontal);

//        getDock(PokeEdit::MoveDock)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
//        getDock(PokeEdit::EVDock)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);
//        getDock(PokeEdit::IVDock)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    }

    switchToTab(index);
}
Ejemplo n.º 4
0
void TabWidget::rebuildMaps()
{
    int tab;

    if ( mUnityWidgetList.isEmpty() )
    {
        tab = addUnityBrowser();
        switchToTab( tab );
    }
    else
    {
        mUnityBrowserMap.clear();

        for ( int i = 0; i < mUnityWidgetList.count(); ++i )
        {
            UnityWidget* tw = mUnityWidgetList.at( i );

            mUnityWidgetList.at( i )->setTabId( indexOf( tw ) );
            mUnityBrowserMap[ indexOf( tw ) ] = mUnityWidgetList.at( i )->browser();
        }

        mUnityTab = mUnityWidgetList.at( 0 );
        mUnityBrowser = mUnityTab->browser();
    }
}
Ejemplo n.º 5
0
int TabWidget::addUnityBrowser( int id )
{
    // create a new unitywidget and add it as a tab
    UnityWidget* w = new UnityWidget( this );

    int tab;

    if ( id == 0 )
    {
        tab = addTab( w, QIcon( ":/icons/menus/siebel.png" ), "Unity" );
    }
    else
    {
        tab = id;
        insertTab( id, w, QIcon( ":/icons/menus/siebel.png" ), "Unity" );
        switchToTab( tab );
    }

    qDebug() << "[TABWIDGET] Adding Unity Tab with ID " << QString::number( tab );

    // set the tabId for the widget for tab handling

    w->setTabId( tab );

    // append the widget to a list to build the map from when a tab is closed
    // and set the id + browser in the map for identification

    mUnityWidgetList.append( w );
    mUnityBrowserMap[ tab ] = w->browser();

    rebuildMaps();
    return tab;
}
Ejemplo n.º 6
0
void TabWidget::openClipboardInUnity( int browser )
{
    if ( Kueue::isSrNr( Kueue::getClipboard() ) )
    {
        showSrInUnityBrowser( browser, Kueue::getClipboard().trimmed() );
        switchToTab( browser );
    }
}
Ejemplo n.º 7
0
void SideBar::showPage(QWidget *widget)
{
	KILE_DEBUG() << "===SideBar::showPage(" << widget << ")";
	int i = m_tabStack->indexOf(widget);
	KILE_DEBUG() << "i is " << i;
	if(i >= 0) {
		switchToTab(i);
	}
}
Ejemplo n.º 8
0
int SideBar::addPage(QWidget *widget, const QPixmap &pic, const QString &text /* = QString()*/)
{
	int index = m_tabStack->addWidget(widget);
	m_tabBar->appendTab(pic, index, text);
	connect(m_tabBar->tab(index), SIGNAL(clicked(int)), this, SLOT(tabClicked(int)));

	switchToTab(index);

	return index;
}
Ejemplo n.º 9
0
void SideBar::tabClicked(int i)
{
	int currentIndex = currentTab();

	if(i == currentIndex && !isMinimized()) {
		shrink();
	}
	else {
		switchToTab(i);
	}
}
Ejemplo n.º 10
0
TabBar::TabBar(QWidget *parent) :
    QTabBar(parent)
{    
    setTabsClosable(true);    
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(handleChanged(int)));

    v_activeIcons = QVector<QIcon>(10);
    v_normalIcons = QVector<QIcon>(10);
    v_actions = QVector<QAction*>(10);

#ifndef Q_OS_MAC
    for (int i=0; i<10; i++) {
        const QString text = i>0? QString::number(i) : "~";
        QFont f(font());
        f.setPixelSize(10);
        f.setBold(true);
        int w = QFontMetrics(f).width(text);
        QImage numberImageActive(16,16,QImage::Format_ARGB32);
        numberImageActive.fill(0);
        QPainter p(&numberImageActive);
        p.setPen(palette().brush(QPalette::HighlightedText).color());
        p.setBrush(palette().brush(QPalette::Highlight));
        p.drawRect(2,2,12,12);
        p.setFont(f);
        p.drawText(3+(12-w)/2, 12, text);
        p.end();
        QImage numberImage(16,16,QImage::Format_ARGB32);
        numberImage.fill(0);
        QPainter pp(&numberImage);
        pp.setPen(palette().brush(QPalette::WindowText).color());
        pp.setBrush(Qt::NoBrush);
        pp.drawRect(2,2,12,12);
        pp.setFont(f);
        pp.drawText(3+(12-w)/2, 12, text);
        pp.end();
        v_normalIcons[i] = QIcon(QPixmap::fromImage(numberImage));
        v_activeIcons[i] = v_normalIcons[i];
        QAction * toggleView = new QAction(this);

        if (i==0) {
            toggleView->setShortcut(QKeySequence("Ctrl+`"));
        }
        else {
            toggleView->setShortcut(QKeySequence(QString("Ctrl+%1").arg(i)));
        }
        toggleView->setShortcutContext(Qt::ApplicationShortcut);
        toggleView->setProperty("tabIndex", i);
        connect(toggleView, SIGNAL(triggered()), this, SLOT(switchToTab()));
        addAction(toggleView);
        v_actions[i] = toggleView;
    }
#endif
    setIconSize(QSize(16,16));
}
Ejemplo n.º 11
0
void SideBar::setPageVisible(QWidget *w, bool b)
{
	int nTabs = m_tabStack->count();
	int index = m_tabStack->indexOf(w);
	int currentIndex = currentTab();

	KMultiTabBarTab *tab = m_tabBar->tab(index);
	tab->setVisible(b);
	if(!b && index == currentIndex && nTabs >= 2) {
		switchToTab(findNextShownTab(index));
	}
}
Ejemplo n.º 12
0
void PEditor::newFile() {
    tabWidget->addTab(new TextEditWidget(tabWidget), "");
    switchToTab(tabWidget->count() - 1);

    textEdit->getFont()->setPointSize(textSize);
    textEdit->getFont()->setFamily(textFont);
    textEdit->updateFont();
    textEdit->setLineNumbering(lineNumbering);

    connect(tabWidget->currentWidget(), SIGNAL(highlighting(bool)), this, SLOT(setSyntaxHighlightingMenuItem(bool)));
    setCurrentFile("");
}
Ejemplo n.º 13
0
void SideBar::removePage(QWidget *w)
{
	int nTabs = m_tabStack->count();
	int index = m_tabStack->indexOf(w);
	int currentIndex = currentTab();
	m_tabStack->removeWidget(w);
	disconnect(m_tabBar->tab(index), SIGNAL(clicked(int)), this, SLOT(showTab(int)));
	m_tabBar->removeTab(index);
	if(index == currentIndex && nTabs >= 2) {
		switchToTab(findNextShownTab(index));
	}
}
Ejemplo n.º 14
0
bool PEditor::switchToFile(const QString &fileName) {
//   qWarning("Switching to %s", fileName.toStdString().c_str());

    int i(0);
    while ((i < tabWidget->count()) && (((TextEditWidget*)tabWidget->widget(i))->getShownName() != fileName))
        ++i;

    if (i == tabWidget->count())
        return false;

    switchToTab(i);

    return true;
}
Ejemplo n.º 15
0
void PEditor::open(QString fileName) {
    if (fileName.isEmpty())
        fileName = QFileDialog::getOpenFileName(this, "PEditor", progName);

    if (!fileName.isEmpty() && (env->isReadableFile(fileName))) {
        if (curFile != "") {
            tabWidget->addTab(new TextEditWidget(tabWidget), "");
            switchToTab(tabWidget->count() - 1);

            textEdit->getFont()->setPointSize(textSize);
            textEdit->getFont()->setFamily(textFont);
            textEdit->updateFont();
            textEdit->setLineNumbering(lineNumbering);

            connect(tabWidget->currentWidget(), SIGNAL(highlighting(bool)), this, SLOT(setSyntaxHighlightingMenuItem(bool)));
        }
        loadFile(fileName);
    }
Ejemplo n.º 16
0
void TabManager::cycleTab(pp_int32 offset)
{
#ifndef __LOWRES__
	TabHeaderControl* tabHeader = getTabHeaderControl();
	ASSERT(tabHeader);
	pp_int32 index = tabHeader->getSelectedTabIndex();
	index+=offset;
	if (index >= (signed)tabHeader->getNumTabs())
		index = tabHeader->getNumTabs()-1;
	if (index < 0)
		index = 0;
	
	if (index != tabHeader->getSelectedTabIndex())
	{
		tabHeader->setSelectedTab(index);
		tracker.screen->paintControl(tabHeader);
		switchToTab(index);
	}
#endif
}
Ejemplo n.º 17
0
void LocationCompleter::indexActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    bool ok;
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt(&ok);

    // Switch to tab with simple index activation
    if (ok && tabPos > -1) {
        BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
        Q_ASSERT(window);
        switchToTab(window, tabPos);
        return;
    }

    loadRequest(createLoadRequest(index));
}
Ejemplo n.º 18
0
void LocationCompleter::indexActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();

    // Switch to tab with simple index activation
    if (tabPos > -1) {
        BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
        Q_ASSERT(window);
        switchToTab(window, tabPos);
        return;
    }

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    loadUrl(url);
}
Ejemplo n.º 19
0
void Window::startPrivate(const QString &nick)
{
    PrivatePage* privatePage = getPrivatePage(nick);
    switchToTab(privatePage->getTab());
}
Ejemplo n.º 20
0
void TabManager::closeTab(pp_int32 index/* = -1*/)
{
#ifndef __LOWRES__
	TabHeaderControl* tabHeader = getTabHeaderControl();

	// when there is only a single tab open
	// we zap the module if it has changed or is not empty
	if (tabHeader->getNumTabs() <= 1)
	{
		if (tracker.moduleEditor->hasChanged() ||
			!tracker.moduleEditor->isEmpty())
		{
			Zapper zapper(tracker);
			zapper.zapAll();
			tracker.updateSongInfo(false);
			tracker.screen->paint();
		}
		return;
	}

	if (index == -1)
		index = tabHeader->getSelectedTabIndex();

	pp_int32 moduleIndex = tabHeader->getTab(index)->ID;

	bool res = tracker.checkForChanges(documents->get(moduleIndex)->moduleEditor);
	if (!res)
		return;

	TabHeaderControl::TabHeader* tabs = new TabHeaderControl::TabHeader[tabHeader->getNumTabs()];

	pp_int32 j = 0;
	pp_int32 i;
	for (i = 0; i < (signed)tabHeader->getNumTabs(); i++)
	{
		if (i != index)
		{
			tabs[j] = *tabHeader->getTab(i);
			j++;
		}
	}
	
	tabHeader->clear();

	for (i = 0; i < j; i++)
	{
		if ((signed)tabs[i].ID > moduleIndex)	
			tabs[i].ID--;
	}
	
	Document* doc = documents->removeNoDestroy(moduleIndex);
	
	if (index >= documents->size())
		index = documents->size()-1;
	
	for (i = 0; i < j; i++)
	{
		tabHeader->addTab(tabs[i]);
	}
	
	delete[] tabs;

	tabHeader->setSelectedTab(index);

	switchToTab(tabHeader->getTab(index)->ID);
	
	if (doc->moduleEditor != tracker.moduleEditor)
	{
		tracker.playerMaster->destroyPlayerController(doc->playerController);
		delete doc;
	}
#endif
}