예제 #1
0
WeatherPlugin::WeatherPlugin(unsigned base, bool bInit, const char *config)
        : Plugin(base)
{
    load_data(weatherData, &data, config);
    memset(&m_handler, 0, sizeof(m_handler));
    m_handler.startElement = p_element_start;
    m_handler.endElement   = p_element_end;
    m_handler.characters   = p_char_data;
    BarWeather = registerType();
    CmdWeather = registerType();
    EventWeather = registerType();
    Event eBar(EventToolbarCreate, (void*)BarWeather);
    eBar.process();
    IconDef icon;
    icon.name = "weather";
    icon.xpm  = na;
    Event eIcon(EventAddIcon, &icon);
    eIcon.process();
    Command cmd;
    cmd->id = CmdWeather;
    cmd->text = I18N_NOOP("Not connected");
    cmd->icon = "weather";
    cmd->bar_id = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags = BTN_PICT;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    m_bar = NULL;
    m_fetch_id = 0;
    if (!bInit){
        showBar();
        if (m_bar)
            m_bar->show();
    }
}
예제 #2
0
WeatherPlugin::WeatherPlugin(unsigned base, bool bInit, Buffer *config)
        : Plugin(base)
{
    load_data(weatherData, &data, config);
    BarWeather = registerType();
    CmdWeather = registerType();
    EventWeather = registerType();
    m_icons = getIcons()->addIconSet("icons/weather.jisp", true);
    Event eBar(EventToolbarCreate, (void*)BarWeather);
    eBar.process();
    Command cmd;
    cmd->id = CmdWeather;
    cmd->text = I18N_NOOP("Not connected");
    cmd->icon = "weather";
    cmd->bar_id = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags = BTN_PICT | BTN_DIV;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    m_bar = NULL;
    if (!bInit){
        showBar();
        if (m_bar)
            m_bar->show();
    }
}
예제 #3
0
void EffectsMenuBar::setAutoHideEnabled(bool enabled)
{
    autoHideEnabled = enabled;

    if (autoHideEnabled)
        hideBar();
    else
        showBar();
}
예제 #4
0
Container::Container(unsigned id, const char *cfg)
{
    m_bInit   = false;
    m_bInSize = false;
    m_bStatusSize = false;
    m_bBarChanged = false;
    m_bReceived = false;
    m_bNoSwitch = false;

    SET_WNDPROC("container")
    setWFlags(WDestructiveClose);
    QFrame *frm = new QFrame(this);
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);

    load_data(containerData, &data, cfg);

    if (cfg == NULL){
        setId(id);
        memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState));
        data.geometry[2] = CorePlugin::m_plugin->data.containerSize[0];
        data.geometry[3] = CorePlugin::m_plugin->data.containerSize[1];
        setStatusSize(CorePlugin::m_plugin->getContainerStatusSize());
        showBar();
        m_bInit = true;
    }
    m_bInSize = true;
    restoreGeometry(this, data.geometry, cfg != NULL, (cfg != NULL) || m_bInit);
    m_bInSize = false;
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));

    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
}
예제 #5
0
void *WeatherPlugin::processEvent(Event *e)
{
    if (e->type() == EventLanguageChanged)
        updateButton();
    if (e->type() == EventInit)
        showBar();
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdWeather) && *getID()){
            string url = "http://www.weather.com/outlook/travel/pastweather/";
            url += getID();
            Event eGo(EventGoURL, (void*)url.c_str());
            eGo.process();
            return e->param();
        }
    }
    if (e->type() == EventFetchDone){
        fetchData *d = (fetchData*)(e->param());
        if (d->req_id != m_fetch_id)
            return NULL;
        m_fetch_id = 0;
        if (d->result != 200)
            return NULL;
        m_data  = "";
		m_day   = 0;
        m_bBar  = false;
        m_bWind = false;
        m_bUv	= false;
		m_bCC	= false;
        m_context = xmlCreatePushParserCtxt(&m_handler, this, "", 0, "");
        if (xmlParseChunk(m_context, d->data->data(), d->data->size(), 0)){
            log(L_WARN, "XML parse error");
            xmlFreeParserCtxt(m_context);
            return NULL;
        }
        xmlFreeParserCtxt(m_context);
        time_t now;
        time(&now);
        setTime(now);
        updateButton();
        Event eUpdate(EventWeather);
        eUpdate.process();
    }
    return NULL;
}
예제 #6
0
void *WeatherPlugin::processEvent(Event *e)
{
    if (e->type() == EventLanguageChanged)
        updateButton();
    if (e->type() == EventInit)
        showBar();
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdWeather) && *getID()){
            string url = "http://www.weather.com/outlook/travel/pastweather/";
            url += getID();
            Event eGo(EventGoURL, (void*)url.c_str());
            eGo.process();
            return e->param();
        }
    }
    return NULL;
}
예제 #7
0
void Container::init()
{
    if (m_bInit)
        return;
    m_bInit = true;

    showBar();
    string windows = getWindows();
    while (!windows.empty()){
        unsigned long id = strtoul(getToken(windows, ',').c_str(), NULL, 10);
        Contact *contact = getContacts()->contact(id);
        if (contact == NULL)
            continue;
        addUserWnd(new UserWnd(id, getWndConfig(id), false));
    }
    if (m_tabBar->count() == 0)
        QTimer::singleShot(0, this, SLOT(close()));
    setWindows(NULL);
    clearWndConfig();
    m_tabBar->raiseTab(getActiveWindow());

    show();
}
예제 #8
0
Container::Container(unsigned id, const char *cfg)
{
    m_bInit   = false;
    m_bInSize = false;
    m_bStatusSize = false;
    m_bBarChanged = false;
    m_bReceived = false;
    m_bNoSwitch = false;

    SET_WNDPROC("container")
    setWFlags(WDestructiveClose);
    QFrame *frm = new QFrame(this);
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);

    load_data(containerData, &data, cfg);

	bool bPos = true;
    if (cfg == NULL){
        setId(id);
        memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState));
		memcpy(data.geometry, CorePlugin::m_plugin->data.containerGeo, sizeof(data.geometry));
		if ((data.geometry[WIDTH] == -1) || (data.geometry[HEIGHT] == -1)){
			QWidget *desktop = QApplication::desktop();
			data.geometry[WIDTH] = desktop->width() / 3;
			data.geometry[HEIGHT] = desktop->height() / 3;
		}
		bPos = false;
		if ((data.geometry[TOP] != -1) || (data.geometry[LEFT] != -1)){
			bPos = true;
            QWidgetList  *list = QApplication::topLevelWidgets();
			for (;;) {
				bool bOK = true;
				QWidgetListIt it(*list);
				QWidget * w;
				while ((w = it.current()) != NULL){
					 if (w->inherits("Container")){
						int dw = w->width()  - data.geometry[WIDTH];
						int dh = w->height() - data.geometry[HEIGHT];
						if (dw < 0) dw = -dw;
						if (dh < 0) dh = -dh;
						if ((dw < 3) && (dh < 3)){
							int nl = data.geometry[LEFT];
							int nt = data.geometry[TOP];
							nl += 11;
							nt += 10;
							QWidget *desktop = QApplication::desktop();
							if (nl + data.geometry[WIDTH] > desktop->width())
								nl = 0;
							if (nt + data.geometry[WIDTH] > desktop->width())
								nt = 0;
							if ((nl != data.geometry[LEFT]) && (nt != data.geometry[TOP])){
								data.geometry[LEFT] = nl;
								data.geometry[TOP]  = nt;
								bOK = false;
								break;
							}
						}
					}
					++it;
				}
				if (bOK)
					break;
            }
            delete list;			
		}
        setStatusSize(CorePlugin::m_plugin->getContainerStatusSize());
        showBar();
        m_bInit = true;
    }
    m_bInSize = true;
    restoreGeometry(this, data.geometry, bPos, true);
    m_bInSize = false;
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));

    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
}
예제 #9
0
static void
update(EventRecord *ev)
{
	int progress=0;
	int i;
	int uid = 0,qid = 0;

	/* handle a ping event, keep the current instruction in focus */
	if (ev->state >= MDB_PING ) {
		// All state events are ignored
		return;
	}

	if (debug)
		fprintf(stderr, "Update %s input %s stmt %s time %" PRId64"\n",(ev->state>=0?statenames[ev->state]:"unknown"),(ev->fcn?ev->fcn:"(null)"),(currentfunction?currentfunction:""),ev->clkticks -starttime);

	if (starttime == 0) {
		if (ev->fcn == 0 ) {
			if (debug)
				fprintf(stderr, "Skip %s input %s\n",(ev->state>=0?statenames[ev->state]:"unknown"),ev->fcn);
			return;
		}
		if (debug)
			fprintf(stderr, "Start capturing updates %s\n",ev->fcn);
	}
	if (ev->clkticks < 0) {
		/* HACK: *TRY TO* compensate for the fact that the MAL
		 * profiler chops-off day information, and assume that
		 * clkticks is < starttime because the tomograph run
		 * crossed a day boundary (midnight);
		 * we simply add 1 day (24 hours) worth of microseconds.
		 * NOTE: this surely does NOT work correctly if the
		 * tomograph run takes 24 hours or more ...
		 */
		ev->clkticks += US_DD;
	}

	/* monitor top level function brackets, we restrict ourselves to SQL queries */
	if (ev->state == MDB_START && ev->fcn && strncmp(ev->fcn, "function", 8) == 0) {
		if( capturing){
			//fprintf(stderr,"Input garbled or we lost some events\n");
			resetTachograph();
			capturing = 0;
		}
		if( (i = sscanf(ev->fcn + 9,"user.s%d_%d",&uid,&qid)) != 2){
			if( debug)
				fprintf(stderr,"Skip parsing %d, uid %d qid %d\n",i,uid,qid);
			return;
		}
		if (capturing++ == 0){
			starttime = ev->clkticks;
			finishtime = ev->clkticks + ev->ticks;
			duration = ev->ticks;
		}
		if (currentfunction == 0){
			currentfunction = strdup(ev->fcn+9);
			currenttag = ev->tag;
		}
		if (debug)
			fprintf(stderr, "Enter function %s capture %d\n", currentfunction, capturing);
		initFiles();
		return;
	}
	ev->clkticks -= starttime;

	if ( !capturing)
		return;

	if( ev->pc > lastpc)
		lastpc = ev->pc;

	/* start of instruction box */
	if (ev->state == MDB_START ) {
		if(ev->fcn && strstr(ev->fcn,"querylog.define") ){
			// extract a string argument from a known MAL signature
			maxevents = malsize;
			events = calloc(maxevents, sizeof(Event));
			// use the truncated query text, beware that the \ is already escaped in the call argument.
			if(currentquery) {
				if( prevquery && strcmp(currentquery,prevquery)){
					printf("%s\n",currentquery);
					free(prevquery);
					prevquery = strdup(currentquery);
				} else
				if( prevquery == 0){
					printf("%s\n",currentquery);
					prevquery = strdup(currentquery);
				}
			}
		}
		if( ev->tag != currenttag)
			return;	// forget all except one query
		assert(ev->pc < maxevents);
		events[ev->pc].state = RUNNING;
		events[ev->pc].stmt = strdup(ev->beauty? ev->beauty:"");
		events[ev->pc].etc = ev->ticks;
		events[ev->pc].clkticks = ev->clkticks;
		showonbar = ev->pc;
		return;
	}
	/* end the instruction box */
	if (ev->state == MDB_DONE ){
			
		events[ev->pc].state= FINISHED;
		if( ev->tag != currenttag)
			return;	// forget all except one query

		progress = (int)(pccount++ / (malsize/100.0));
		for(i = lastpc; i > 0; i--)
			if( events[i].state == RUNNING )
				break;

		if( showonbar == ev->pc)
			showonbar = i < 0  ?-1 : i;
		showBar((progress>100.0?(int)100:progress), ev->clkticks, (showonbar >= 0 ? events[showonbar].stmt:NULL));
		events[ev->pc].actual= ev->ticks;
	}
	if (ev->state == MDB_DONE && ev->fcn && strncmp(ev->fcn, "function", 8) == 0) {
		if (currentfunction && strcmp(currentfunction, ev->fcn+9) == 0) {
			if( capturing == 0){
				free(currentfunction);
				currentfunction = 0;
			}
			
			showBar(100,ev->clkticks, "\n");
			if(debug)
				fprintf(stderr, "Leave function %s capture %d\n", currentfunction, capturing);
			resetTachograph();
			initFiles();
		}
	}
}
예제 #10
0
void EffectsMenuBar::onAboutToShow()
{
    menuActivated = true;
    showBar();
}
예제 #11
0
void EffectsMenuBar::enterEvent(QEvent* event)
{
    mouseIsHovering = true;
    showBar();
    QMenuBar::enterEvent(event);
}
예제 #12
0
void Container::init()
{
	if (m_bInit)
		return;

    QFrame *frm = new QFrame(this, "container");
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_bInit = true;

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));
    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
    showBar();

	for (list<UserWnd*>::iterator it = m_childs.begin(); it != m_childs.end(); ++it)
		addUserWnd((*it), false);
	m_childs.clear();

    string windows = getWindows();
    while (!windows.empty()){
        unsigned long id = strtoul(getToken(windows, ',').c_str(), NULL, 10);
        Contact *contact = getContacts()->contact(id);
        if (contact == NULL)
            continue;
        Buffer config;
        const char *cfg = getWndConfig(id);
        if (cfg && *cfg){
            config << "[Title]\n" << cfg;
            config.setWritePos(0);
            config.getSection();
        }
        addUserWnd(new UserWnd(id, &config, false, true), true);
    }

    if (m_tabBar->count() == 0)
        QTimer::singleShot(0, this, SLOT(close()));
    setWindows(NULL);
    clearWndConfig();
    m_tabBar->raiseTab(getActiveWindow());

    show();
}
예제 #13
0
int webPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loading((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: isLoading((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 2: titleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: pageChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 4: showSources((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: speedDial(); break;
        case 6: needPrint((*reinterpret_cast< QPrinter*(*)>(_a[1]))); break;
        case 7: openTab((*reinterpret_cast< webPage*(*)>(_a[1]))); break;
        case 8: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: startLoading(); break;
        case 10: finishLoading((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: changeTitle((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 12: changeUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 13: goToHome(); break;
        case 14: loadUrl(); break;
        case 15: loadUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 16: loadUrl((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 17: addToBookMark(); break;
        case 18: downloadFile((*reinterpret_cast< const QNetworkRequest(*)>(_a[1]))); break;
        case 19: downloadFile((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 20: loadBookMark(); break;
        case 21: showBookMark(); break;
        case 22: sources(); break;
        case 23: defineHome(); break;
        case 24: findNext(); break;
        case 25: findPrevious(); break;
        case 26: print(); break;
        case 27: createNewPage((*reinterpret_cast< WebView*(*)>(_a[1]))); break;
        case 28: createNewPage(); break;
        case 29: updateIcon(); break;
        case 30: copy(); break;
        case 31: authentification((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break;
        case 32: inspectPage(); break;
        case 33: goToDial(); break;
        case 34: updateUrlIcon((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 35: updateBookMark(); break;
        case 36: updateOptions(); break;
        case 37: showBar(); break;
        case 38: showPage(); break;
        case 39: showDial(); break;
        case 40: inCache(); break;
        case 41: showConsole(); break;
        case 42: zoomIn(); break;
        case 43: zoomOut(); break;
        case 44: restoreZoom(); break;
        case 45: savePage(); break;
        case 46: back(); break;
        case 47: forward(); break;
        default: ;
        }
        _id -= 48;
    }
    return _id;
}
예제 #14
0
void *WeatherPlugin::processEvent(Event *e)
{
	if (e->type() == EventLanguageChanged)
		updateButton();
    if (e->type() == EventInit)
        showBar();
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdWeather) && *getURL()){
            Event eGo(EventGoURL, (void*)getURL());
            eGo.process();
            return e->param();
        }
    }
    if (e->type() == EventFetchDone){
        fetchData *d = (fetchData*)(e->param());
        if (d->req_id != m_fetch_id)
            return NULL;
        m_fetch_id = 0;
        if (d->result != 200)
            return NULL;
        WeatherParser p(*d->data);
        setStr(p.m_updated.c_str(), data.Updated);
        setStr(p.m_location.c_str(), data.Location);
        setLong(p.m_temperature_f.c_str(), data.Temperature_f);
        setLong(p.m_temperature_c.c_str(), data.Temperature_c);
        setLong(p.m_humidity.c_str(), data.Humidity);
        setLong(p.m_pressure_in.c_str(), data.Pressure_in);
        setLong(p.m_pressure_hpa.c_str(), data.Pressure_hpa);
        setStr(p.m_conditions.c_str(), data.Conditions);
        setStr(p.m_wind.c_str(), data.Wind);
        setLong(p.m_wind_speed_mph.c_str(), data.Wind_speed_mph);
        setLong(p.m_wind_speed_km.c_str(), data.Wind_speed_km);
        setStr(p.m_sun_raise.c_str(), data.Sun_raise);
        setStr(p.m_sun_set.c_str(), data.Sun_set);
        QString condition = getConditions();
        condition = condition.lower();
        if (condition.find("fog") >= 0)
            condition = "Fog";
        if (condition.find("overcast") >= 0)
            condition = "Overcast";
        if (condition.find("mist") >= 0)
            condition = "Fog";
        if (condition.find("storm") >= 0)
            condition = "Storm";
        if (condition.find("rain") >= 0)
            condition = "Rain";
        if (condition.find("snow") >= 0)
            condition = "Snow";
        if (condition.find("clear") >= 0)
            condition = "Clear";
        if (condition.find("cloudy") >= 0){
            if (condition.find("part") >= 0){
                condition = "Partial cloudy";
            }else{
                condition = "Cloudy";
            }
        }
        if (condition.find("clouds") >= 0)
            condition = "Partial cloudy";
        setConditions(condition.latin1());
        time_t now;
        time(&now);
        setTime(now);
        updateButton();
        Event eUpdate(EventWeather);
        eUpdate.process();
    }
    return NULL;
}
예제 #15
0
MainWindow::MainWindow(QString file_adress, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    process = new QProcess(this);

    pfad = QCoreApplication::applicationDirPath();

    QString buffer = QCoreApplication::applicationDirPath();
    buffer.append("\\update.exe");

    if(QFile::exists(buffer) == true)
    {
        QDesktopServices::openUrl(QUrl::fromLocalFile(buffer));

        process->terminate();

    }

    QSplashScreen *splash = new QSplashScreen(QPixmap(":/tbicons/img/logo.png"), Qt::WindowStaysOnTopHint);
    splash->show();
    splash->showMessage("Laden...", Qt::AlignBottom | Qt::AlignCenter);

    ui->setupUi(this);
    this->hide();

    set = new settings(this);
    icon = new favicon(this);
    search_result = new gsuggests(ui->lineEdit);
    versionspruefung = new update_vers(this);
    versionspruefung->run_request_for_for_update();
    cookie = new cookiejar(this, set->en_cookies);
    bok = new bookmarks(this, ui->tree_bookmarks, ui->but_hinzu, ui->but_edit, ui->but_addFolder);
    download = new DownloadManager(this, qnam);

    m_faviconTimer = new QTimer(this);
    m_editorTimer = new QTimer(this);


    qnam = new QNetworkAccessManager(this);
    page = new QWebPage(this);

    ui->webView->setPage(page);
    ui->webView->page()->setNetworkAccessManager(qnam);
    QWebSettings::setIconDatabasePath(pfad);
    QWebSettings::setOfflineStoragePath((pfad + tr("\\offline_cache")));

    QString cache_path = pfad;
    cache_path.append("\\cache");
    cache = new QNetworkDiskCache(qnam);
    cache->setCacheDirectory(cache_path);
    qnam->setCache(cache);

    qnam->setCookieJar(cookie);


    // Bei klick auf Hme Button oder F6 funktion home aufrufen
    connect(ui->home_button, SIGNAL(clicked()), this, SLOT(home()));
    //Bei einem ändern der URl die neu_address auf rufen
    connect(ui->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(neu_adresse(QUrl)));

    connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(neu_adresse_ein()));

    connect(ui->webView, SIGNAL(loadStarted()), this, SLOT(load_in_progress()));

    connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool)));

    connect(ui->reload_button, SIGNAL(clicked()), this, SLOT(reload_button()));

    connect(ui->webView, SIGNAL(iconChanged()), this, SLOT(icon_changed()));

    connect(ui->webView, SIGNAL(titleChanged(QString)), this, SLOT(titelChanged(QString)));

    connect(ui->but_book, SIGNAL(clicked()), this, SLOT(showBar()));

    connect(ui->webView, SIGNAL(loadProgress(int)), ui->barLoadProgress, SLOT(setValue(int)));

    connect(ui->sliderrSiteZoom, SIGNAL(valueChanged(int)), this, SLOT(sliderSliding(int)));
    connect(ui->butSetZoomToNorm, SIGNAL(clicked()), this, SLOT(sliderSliding()));

    //für bookmarks
    connect(ui->tree_bookmarks, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openBookmark(QTreeWidgetItem*, int)));

    //connections für favicons
    connect(icon, SIGNAL(neuer_icon()), this, SLOT(neuer_icon()));
    connect(icon, SIGNAL(standart_icon()), this, SLOT(set_standart_icon()));
    connect(m_faviconTimer, SIGNAL(timeout()), this, SLOT(lookForNewFavicon()));

    //connections für settings
    connect(ui->but_settings, SIGNAL(clicked()), set, SLOT(show()));
    connect(set, SIGNAL(requestForValues()), this, SLOT(returnRequestedValues()));
    connect(set, SIGNAL(settingsChagned()), this, SLOT(settingsChanged()));
    connect(set, SIGNAL(requestForCurrentPage()), this, SLOT(requestForCurrentPage()));
    connect(set->ui->but_cl_cache, SIGNAL(clicked()), this, SLOT(requestForCacheClearing()));
    //für qnam
    connect(qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentification_requied(QNetworkReply*,QAuthenticator*)));

    //für downloads
    connect(page, SIGNAL(downloadRequested(QNetworkRequest)), download, SLOT(Download(QNetworkRequest)));
    connect(ui->butDownloadManager, SIGNAL(clicked()), download, SLOT(show()));

    ui->lineEdit->installEventFilter(this);

    if(file_adress != NULL)
        ui->webView->load(QUrl(file_adress));
    else
    {
        if(!set->en_homePage)
            ui->webView->load(QUrl(set->lastUrl));
        else
            ui->webView->load(QUrl(set->path_cur_home));
    }

    this->resize(set->size);
    this->move(set->point);
    if(set->en_max)
        this->showMaximized();

    if(!set->en_treeBar)
        ui->tabWidget->hide();


    splash->finish(this);
    this->show();

    m_faviconTimer->start(3000);
    shutted = true;


}