Esempio n. 1
0
 /// idle actions
 virtual void idle()
 {
     if ( !_stopFlag && getWindowCount()==1 && (main_win->getLastNavigationDirection()==1 || main_win->getLastNavigationDirection()==-1)) {
         CRLog::debug("Last command is page down: preparing next page for fast navigation");
         main_win->prepareNextPageImage( main_win->getLastNavigationDirection() );
         main_win->unsetLastNavigationDirection();
     }
 }
Esempio n. 2
0
gboolean watchCount(gpointer data)
{
	//static gint frame = 1;
	gint watcher = winCount;
	gint curCount = getWindowCount();
	GtkWidget *widget = GTK_WIDGET(data);
	if(curCount != watcher)
	{
		//恢复背景颜色
		update_widget_bg(widget, IMG_BG_FILE);
		//恢复信号阻塞
		g_signal_handler_unblock(GTK_WIDGET(widget), pressSig);
		g_signal_handler_unblock(GTK_WIDGET(widget), releaseSig);
		g_signal_handler_unblock(GTK_WIDGET(widget), motionSig);
		//g_signal_handler_unblock_by_func不行么?
		return FALSE;
	}
	//闪烁画出LOADING......
	//showLoading(widget, "Loading......");
	
	//动态绘制图片
	showLoadingIMG(widget);
	/*switch(frame)
	{
		case 1:
			showLoadingIMG(widget, IMG_LOADING_FILE1);
			++frame;
			break;
		case 2:
			showLoadingIMG(widget, IMG_LOADING_FILE2);
			++frame;
			break;
		case 3:
			showLoadingIMG(widget, IMG_LOADING_FILE3);
			++frame;
			break;
		case 4:
			showLoadingIMG(widget, IMG_LOADING_FILE4);
			++frame;
			break;
		case 5:
			showLoadingIMG(widget, IMG_LOADING_FILE5);
			++frame;
			break;
		case 6:
			showLoadingIMG(widget, IMG_LOADING_FILE6);
			frame = 1;
			break;
		default:
			frame = 1;
	}*/
	return TRUE;
}
Esempio n. 3
0
int startWifi(GtkWidget *widget)
{
	//改变背景为灰暗
	update_widget_bg(widget, IMG_BG_LOADING_FILE);
	//阻塞点击按扭的事件
	g_signal_handler_block(GTK_WIDGET(widget), pressSig);
	g_signal_handler_block(GTK_WIDGET(widget), releaseSig);
	g_signal_handler_block(GTK_WIDGET(widget), motionSig);
	//g_signal_handlers_block_by_func不行么?

	//获取当前窗口数目
	winCount = getWindowCount();//函数现写
	//g_print("count is %d", winCount);
	g_timeout_add(500,watchCount,widget);
	//启动程序
	launchApp_simple("StartWifi.sh");
}
Esempio n. 4
0
    // runs event loop
    virtual int runEventLoop()
    {
        ShowWindow( _hWnd, SW_SHOW );
        // Main message loop:
        MSG msg;
        bool stop = false;
        while (!stop && GetMessage(&msg, NULL, 0, 0))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
			if ( !instance )
				break;
            processPostedEvents();
            if ( !getWindowCount() )
                stop = true;
        }
        return 0;
    }
Esempio n. 5
0
void quit(void) {
    endReached = true;
    if(getWindowCount() == 0)
        gtk_main_quit();
	g_thread_join(gtkThread);
}
Esempio n. 6
0
void WindowsManager::handleWindowClose(Window *window)
{
	const int index = (window ? getWindowIndex(window->getIdentifier()) : -1);

	if (index < 0)
	{
		return;
	}

	if (window && !window->isPrivate())
	{
		const WindowHistoryInformation history = window->getContentsWidget()->getHistory();

		if (!Utils::isUrlEmpty(window->getUrl()) || history.entries.count() > 1)
		{
			Window *nextWindow = getWindowByIndex(index + 1);
			Window *previousWindow = ((index > 0) ? getWindowByIndex(index - 1) : NULL);

			ClosedWindow closedWindow;
			closedWindow.window = window->getSession();
			closedWindow.nextWindow = (nextWindow ? nextWindow->getIdentifier() : 0);
			closedWindow.previousWindow = (previousWindow ? previousWindow->getIdentifier() : 0);

			if (window->getType() != QLatin1String("web"))
			{
				removeStoredUrl(closedWindow.window.getUrl());
			}

			m_closedWindows.prepend(closedWindow);

			emit closedWindowsAvailableChanged(true);
		}
	}

	const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("Interface/LastTabClosingAction")).toString();

	if (m_mainWindow->getTabBar()->count() == 1)
	{
		if (lastTabClosingAction == QLatin1String("closeWindow") || (lastTabClosingAction == QLatin1String("closeWindowIfNotLast") && SessionsManager::getWindows().count() > 1))
		{
			m_mainWindow->triggerAction(ActionsManager::CloseWindowAction);

			return;
		}

		if (lastTabClosingAction == QLatin1String("openTab"))
		{
			window = getWindowByIndex(0);

			if (window)
			{
				window->clear();

				return;
			}
		}
		else
		{
			m_mainWindow->getAction(ActionsManager::CloseTabAction)->setEnabled(false);
			m_mainWindow->setCurrentWindow(NULL);

			emit windowTitleChanged(QString());
		}
	}

	m_mainWindow->getTabBar()->removeTab(index);

	Action *closePrivateTabsAction = m_mainWindow->getAction(ActionsManager::ClosePrivateTabsAction);

	if (closePrivateTabsAction->isEnabled() && getWindowCount(true) == 0)
	{
		closePrivateTabsAction->setEnabled(false);
	}

	emit windowRemoved(window->getIdentifier());

	m_windows.remove(window->getIdentifier());

	if (m_mainWindow->getTabBar()->count() < 1 && lastTabClosingAction == QLatin1String("openTab"))
	{
		open();
	}
}