コード例 #1
0
ファイル: window.cpp プロジェクト: agateau/switcha
void Window::showAgain() {
	mLineEdit->clear();
	mView->clear();

	updateWindowInfoList();

	WindowInfoList::ConstIterator
		it = mWindowInfoList.begin(),
		end = mWindowInfoList.end();
	
	for (; it!=end; ++it) {
		KWin::WindowInfo info = *it;
		QListViewItem* item = new QListViewItem(mView, info.visibleName());
		QPixmap pix = KWin::icon(info.win(), 16, 16, true);
		item->setPixmap(0, pix);
	}

	if (!mWindowInfoList.empty()) {
		mView->setSelected(mView->firstChild(), true);
	}

	QRect rect = QApplication::desktop()->availableGeometry();
	int width = mView->columnWidth(0) + 30;
	int height = 300;
	move(
		rect.left() + (rect.width() - width) / 2,
		rect.top() + (rect.height() - height) / 2
		);
	resize(width, height);
	show();
	KWin::forceActiveWindow(winId());
}
コード例 #2
0
ファイル: window.cpp プロジェクト: agateau/switcha
void Window::switchToWindow(QListViewItem* item) {
	QString itemName = item->text(0);

	WindowInfoList::ConstIterator
		it = mWindowInfoList.begin(),
		end = mWindowInfoList.end();
	
	for (; it!=end; ++it) {
		KWin::WindowInfo info = *it;
		if (info.visibleName() == itemName) {
			hide();
			KWin::forceActiveWindow(info.win());
			return;
		}
	}
}