TITANIUM_FUNCTION(WebView, stopLoading)
		{
			if (arguments.size() < 1) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsBoolean());
				const bool hardStop = static_cast<bool>(_0);
				stopLoading(hardStop);
			}
			stopLoading(false);
			return get_context().CreateUndefined();
		}
Beispiel #2
0
void IconLoader::notifyFinished(CachedResource* resource)
{
    ASSERT(resource == m_resource);

    // If we got a status code indicating an invalid response, then lets
    // ignore the data and not try to decode the error page as an icon.
    RefPtr<ResourceBuffer> data = resource->resourceBuffer();
    int status = resource->response().httpStatusCode();
    if (status && (status < 200 || status > 299))
        data = 0;

    static const char pdfMagicNumber[] = "%PDF";
    static unsigned pdfMagicNumberLength = sizeof(pdfMagicNumber) - 1;
    if (data && data->size() >= pdfMagicNumberLength && !memcmp(data->data(), pdfMagicNumber, pdfMagicNumberLength)) {
        LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", resource->url().string().ascii().data());
        data = 0;
    }

    LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", resource->url().string().ascii().data());
    m_frame->loader().icon().commitToDatabase(resource->url());
    // Setting the icon data only after committing to the database ensures that the data is
    // kept in memory (so it does not have to be read from the database asynchronously), since
    // there is a page URL referencing it.
    iconDatabase().setIconDataForIconURL(data ? data->sharedBuffer() : 0, resource->url().string());
    m_frame->loader().client().dispatchDidReceiveIcon();
    stopLoading();
}
void ApplicationCacheGroup::manifestNotFound()
{
    makeObsolete();

    postListenerTask(ApplicationCacheHost::OBSOLETE_EVENT, m_associatedDocumentLoaders);
    postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_pendingMasterResourceLoaders);

    stopLoading();

    ASSERT(m_pendingEntries.isEmpty());
    m_manifestResource = 0;

    while (!m_pendingMasterResourceLoaders.isEmpty()) {
        HashSet<DocumentLoader*>::iterator it = m_pendingMasterResourceLoaders.begin();

        ASSERT((*it)->applicationCacheHost()->candidateApplicationCacheGroup() == this);
        ASSERT(!(*it)->applicationCacheHost()->applicationCache());
        (*it)->applicationCacheHost()->setCandidateApplicationCacheGroup(0);
        m_pendingMasterResourceLoaders.remove(it);
    }

    m_downloadingPendingMasterResourceLoadersCount = 0;
    setUpdateStatus(Idle);
    m_frame = 0;

    if (m_caches.isEmpty()) {
        ASSERT(m_associatedDocumentLoaders.isEmpty());
        ASSERT(!m_cacheBeingUpdated);
        delete this;
    }
}
Beispiel #4
0
void Notification::didReceiveResponse(const ResourceResponse& response)
{
    int status = response.httpStatusCode();
    if (status && (status < 200 || status > 299)) {
        stopLoading();
        return;
    }
    m_iconData = SharedBuffer::create();
}
void ApplicationCacheGroup::cacheUpdateFailed()
{
    stopLoading();
    m_manifestResource = 0;

    // Wait for master resource loads to finish.
    m_completionType = Failure;
    deliverDelayedMainResources();
}
Beispiel #6
0
ApplicationCacheGroup::~ApplicationCacheGroup()
{
    ASSERT(!m_newestCache);
    ASSERT(m_caches.isEmpty());
    
    stopLoading();

    m_storage->cacheGroupDestroyed(this);
}
Beispiel #7
0
void ProgressFrame::addToButtonBox(QDialogButtonBox *button_box, QObject *main_window)
{
    // We have a ProgressFrame in the main status bar which is controlled
    // from the capture file and other parts of the application via
    // create_progress_dlg and delayed_create_progress_dlg.
    // Create a new ProgressFrame and pair it with the main instance.
    ProgressFrame *main_progress_frame = main_window->findChild<ProgressFrame *>();
    if (!button_box || !main_progress_frame) return;

    QBoxLayout *layout = qobject_cast<QBoxLayout *>(button_box->layout());
    if (!layout) return;

    ProgressFrame *progress_frame = new ProgressFrame(button_box);

    // Insert ourselves after the first spacer we find, otherwise the
    // far right of the button box.
    int idx = layout->count();
    for (int i = 0; i < layout->count(); i++) {
        if (layout->itemAt(i)->spacerItem()) {
            idx = i + 1;
            break;
        }
    }
    layout->insertWidget(idx, progress_frame);

    int one_em = progress_frame->fontMetrics().height();
    progress_frame->setMaximumWidth(one_em * 8);
    connect(main_progress_frame, SIGNAL(showRequested(bool,bool,gboolean*)),
            progress_frame, SLOT(show(bool,bool,gboolean*)));
    connect(main_progress_frame, SIGNAL(maximumValueChanged(int)),
            progress_frame, SLOT(setMaximumValue(int)));
    connect(main_progress_frame, SIGNAL(valueChanged(int)),
            progress_frame, SLOT(setValue(int)));
    connect(main_progress_frame, SIGNAL(setHidden()),
            progress_frame, SLOT(hide()));

    connect(progress_frame, SIGNAL(stopLoading()),
            main_progress_frame, SIGNAL(stopLoading()));
}
Beispiel #8
0
void DocumentLoader::detachFromFrame()
{
    ASSERT(m_frame);
    RefPtr<Frame> protectFrame(m_frame);
    RefPtr<DocumentLoader> protectLoader(this);

    // It never makes sense to have a document loader that is detached from its
    // frame have any loads active, so go ahead and kill all the loads.
    stopLoading();

    m_applicationCacheHost->setDOMApplicationCache(0);
    InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this);
    m_frame = 0;
}
Beispiel #9
0
void Notification::cancel() 
{
    switch (m_state) {
    case Idle:
        break;
    case Loading:
        m_state = Cancelled;
        stopLoading();
        break;
    case Showing:
        if (m_notificationCenter->presenter())
            m_notificationCenter->presenter()->cancel(this);
        break;
    case Cancelled:
        break;
    }
}
Beispiel #10
0
void IconLoader::notifyFinished(CachedResource* resource)
{
    ASSERT(resource == m_resource);

    // If we got a status code indicating an invalid response, then lets
    // ignore the data and not try to decode the error page as an icon.
    RefPtr<ResourceBuffer> data = resource->resourceBuffer();
    int status = resource->response().httpStatusCode();
    if (status && (status < 200 || status > 299))
        data = 0;

    LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", resource->url().string().ascii().data());
    m_frame->loader()->icon()->commitToDatabase(resource->url());
    // Setting the icon data only after committing to the database ensures that the data is
    // kept in memory (so it does not have to be read from the database asynchronously), since
    // there is a page URL referencing it.
    iconDatabase().setIconDataForIconURL(data ? data->sharedBuffer() : 0, resource->url().string());
    m_frame->loader()->client()->dispatchDidReceiveIcon();
    stopLoading();
}
Beispiel #11
0
ApplicationCacheGroup::~ApplicationCacheGroup()
{
    if (m_isCopy) {
        ASSERT(m_newestCache);
        ASSERT(m_caches.size() == 1);
        ASSERT(m_caches.contains(m_newestCache.get()));
        ASSERT(!m_cacheBeingUpdated);
        ASSERT(m_associatedDocumentLoaders.isEmpty());
        ASSERT(m_cacheCandidates.isEmpty());
        ASSERT(m_newestCache->group() == this);
        
        return;
    }
               
    ASSERT(!m_newestCache);
    ASSERT(m_caches.isEmpty());
    
    stopLoading();
    
    cacheStorage().cacheGroupDestroyed(this);
}
Beispiel #12
0
void ApplicationCacheGroup::cacheUpdateFailed()
{
    stopLoading();
        
    callListenersOnAssociatedDocuments(&DOMApplicationCache::callErrorListener);

    m_pendingEntries.clear();
    m_manifestResource = 0;

    while (!m_cacheCandidates.isEmpty()) {
        HashSet<DocumentLoader*>::iterator it = m_cacheCandidates.begin();
        
        ASSERT((*it)->candidateApplicationCacheGroup() == this);
        (*it)->setCandidateApplicationCacheGroup(0);
        m_cacheCandidates.remove(it);
    }
    
    m_status = Idle;    
    m_frame = 0;
    
    // If there are no associated caches, delete ourselves
    if (m_associatedDocumentLoaders.isEmpty())
        delete this;
}
Beispiel #13
0
MainStatusBar::MainStatusBar(QWidget *parent) :
    QStatusBar(parent),
    cap_file_(NULL),
    edit_action_(NULL),
    delete_action_(NULL)
{
    QSplitter *splitter = new QSplitter(this);
    #ifdef HAVE_LIBPCAP
    QString ready_msg(tr("Ready to load or capture"));
    #else
    QString ready_msg(tr("Ready to load file"));
    #endif
    QWidget *info_progress = new QWidget(this);
    QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress);
    QAction *action;

#if defined(Q_OS_WIN)
    // Handles are the same color as widgets, at least on Windows 7.
    splitter->setHandleWidth(3);
    splitter->setStyleSheet(QString(
                                "QSplitter::handle {"
                                "  border-left: 1px solid palette(mid);"
                                "  border-right: 1px solid palette(mid);"
                                "}"
                                ));
#endif

    QString button_ss =
            "QToolButton {"
            "  border: none;"
            "  background: transparent;" // Disables platform style on Windows.
            "  padding: 0px;"
            "  margin: 0px;"
            "}";

    expert_button_ = new QToolButton(this);
    expert_button_->setIconSize(QSize(icon_size, icon_size));
    expert_button_->setStyleSheet(button_ss);
    expert_button_->hide();

    // We just want a clickable image. Using a QPushButton or QToolButton would require
    // a lot of adjustment.
    StockIcon comment_icon("x-capture-comment-update");
    comment_button_ = new QToolButton(this);
    comment_button_->setIcon(comment_icon);
    comment_button_->setIconSize(QSize(icon_size, icon_size));
    comment_button_->setStyleSheet(button_ss);

    comment_button_->setToolTip(tr("Open the Capture File Properties dialog"));
    comment_button_->setEnabled(false);
    connect(expert_button_, SIGNAL(clicked(bool)), this, SIGNAL(showExpertInfo()));
    connect(comment_button_, SIGNAL(clicked(bool)), this, SIGNAL(editCaptureComment()));

    info_progress_hb->setContentsMargins(icon_size / 2, 0, 0, 0);

    info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY);
    info_status_.setShrinkable(true);

    info_progress_hb->addWidget(expert_button_);
    info_progress_hb->addWidget(comment_button_);
    info_progress_hb->addWidget(&info_status_);
    info_progress_hb->addWidget(&progress_frame_);
    info_progress_hb->addStretch(10);

    splitter->addWidget(info_progress);
    splitter->addWidget(&packet_status_);
    splitter->addWidget(&profile_status_);

    splitter->setStretchFactor(0, 3);
    splitter->setStretchFactor(1, 3);
    splitter->setStretchFactor(2, 1);

    addWidget(splitter, 1);

    cur_main_status_bar_ = this;

    splitter->hide();
    info_status_.pushText(ready_msg, STATUS_CTX_MAIN);
    packets_bar_update();

    action = ctx_menu_.addAction(tr("Manage Profiles" UTF8_HORIZONTAL_ELLIPSIS));
    action->setData(ProfileDialog::ShowProfiles);
    connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
    ctx_menu_.addSeparator();
    action = ctx_menu_.addAction(tr("New" UTF8_HORIZONTAL_ELLIPSIS));
    action->setData(ProfileDialog::NewProfile);
    connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
    edit_action_ = ctx_menu_.addAction(tr("Edit" UTF8_HORIZONTAL_ELLIPSIS));
    edit_action_->setData(ProfileDialog::EditCurrentProfile);
    connect(edit_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
    delete_action_ = ctx_menu_.addAction(tr("Delete"));
    delete_action_->setData(ProfileDialog::DeleteCurrentProfile);
    connect(delete_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
    ctx_menu_.addSeparator();
    profile_menu_.setTitle(tr("Switch to"));
    ctx_menu_.addMenu(&profile_menu_);

#ifdef QWINTASKBARPROGRESS_H
    progress_frame_.enableTaskbarUpdates(true);
#endif

    connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show()));
    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName()));
    connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)),
            this, SLOT(toggleBackground(bool)));
    connect(wsApp, SIGNAL(profileNameChanged(const gchar *)),
            this, SLOT(pushProfileName()));
    connect(&profile_status_, SIGNAL(mousePressedAt(QPoint,Qt::MouseButton)),
            this, SLOT(showProfileMenu(QPoint,Qt::MouseButton)));

    connect(&progress_frame_, SIGNAL(stopLoading()),
            this, SIGNAL(stopLoading()));
}
Beispiel #14
0
void ViewWorkerThread::prepareImage(QList<QGraphicsItem*> items)
{
	stopLoading();

	QVector<CustomItem*> itemsNotLoaded;

	QVector<CustomItem*> itemsBeingProcessed;

	//Find all items whose images are not loaded.
	for (int index = 0; index < items.count(); index++)
	{
		CustomItem* item = dynamic_cast<CustomItem*> (items[index]);

		if ((true == item->pixmap().isNull())
						||
			((nItemWidth > (item->pixmap().width() + CustomItem::getItemMargin()))
						&&
			 (nItemHeight > (item->pixmap().height() + CustomItem::getItemMargin()))))
		{
			if (EProcessingState::eNone == item->processingState())
			{
				itemsNotLoaded.push_front(item);
			}
			else if (EProcessingState::eProcessed == item->processingState())
			{
				item->updateItem();

				item->setProcessing(EProcessingState::eRenderred);
			}
		}
		else if ((EProcessingState::eNone != item->processingState()) 
									&&
				(EProcessingState::eRenderred != item->processingState()))
		{
			item->updateItem();

			item->setProcessing(EProcessingState::eRenderred);
		}
	}

	CustomGraphicsView* parentView = dynamic_cast<CustomGraphicsView*> (parent());

	QList<QGraphicsItem *> viewItems = parentView->items();

	//Clear images from items that are not currently viewed. 
	//(To optimize memory consumption)
	for (int index = 0; index < viewItems.count(); index++)
	{
		if (!items.contains(viewItems[index]))
		{
			CustomItem* item = dynamic_cast<CustomItem*> (viewItems[index]);

			item->setPixmap(0);

			item->setProcessing(EProcessingState::eNone);
		}
	}

	if (itemsNotLoaded.isEmpty())
	{
		return;
	}

	m_ItemsNotLoaded.clear();

	m_ItemsNotLoaded = itemsNotLoaded;

	//Load images.
	m_pImageLoadThreadWatcher->setFuture(QtConcurrent::mapped(m_ItemsNotLoaded, readEmf));
}
Beispiel #15
0
void ProgressFrame::on_stopButton_clicked()
{
    emit stopLoading();
}
Beispiel #16
0
void ActionWidget::stopLoad()
{
	ui->isLoadedCheckBox->setChecked(false);

	emit stopLoading();
}
Beispiel #17
0
IconLoader::~IconLoader()
{
    stopLoading();
}
Beispiel #18
0
void MainWindow::initMainWindow()
{
    setWindowTitle("Grabber Remote GUI");

    video_mode_labels <<
        "160x120 YUV444" <<
        "320x240 YUV422" <<
        "640x480 YUV411" <<
        "640x480 YUV422" <<
        "640x480 RGB8" <<
        "640x480 MONO8" <<
        "640x480 MONO16" <<
        "800x600 YUV422" <<
        "800x600 RGB8" <<
        "800x600_MONO8" <<
        "1024x768 YUV422" <<
        "1024x768 RGB8" <<
        "1024x768 MONO8" <<
        "800x600 MONO16" <<
        "1024x768 MONO16" <<
        "1280x960 YUV422" <<
        "1280x960 RGB8" <<
        "1280x960_MONO8" <<
        "1600x1200 YUV422" <<
        "1600x1200 RGB8" <<
        "1600x1200 MONO8" <<
        "1280x960 MONO16" <<
        "1600x1200_MONO16" <<
        "EXIF" <<
        "FORMAT7 0" <<
        "FORMAT7 1" <<
        "FORMAT7 2" <<
        "FORMAT7 3" <<
        "FORMAT7 4" <<
        "FORMAT7 5" <<
        "FORMAT7 6" <<
        "FORMAT7 7";

    video_rate_labels << "1.875 fps" << "3.75 fps" << "7.5 fps" << "15 fps" << "30 fps" << "60 fps" << "120 fps" <<"240 fps";
    color_coding_labels << "MONO8" << "YUV411" << "YUV422" << "YUV444" << "RGB8" << "MONO16" << "RGB16" << "MONO16S" << "RGB16S" << "RAW8" << "RAW16";
    iso_speed_labels << "100 Mbps" << "200 Mbps" << "400 Mbps" << "800 Mbps" << "1600 Mbps" << "3200 Mbps";
    op_mode_labels << "LEGACY" << "1394b";

    connect(ui->btnRefresh1,SIGNAL(clicked()),this,SLOT(onReloadClicked()));
    connect(ui->btnRefresh2,SIGNAL(clicked()),this,SLOT(onReloadClicked()));


    connect(&dc1394Thread,SIGNAL(initFormatTabDone(uint,uint,uint)),
            this,SLOT(initFormatTab(uint,uint,uint)),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(initDone(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)),
            this,SLOT(Init(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(reloadDone(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)),
            this,SLOT(Reload(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(loadDefaultDone(uint,uint,bool)),
            this,SLOT(loadDefault(uint,uint,bool)),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(resetDone(uint,uint,bool)),
            this,SLOT(reset(uint,uint,bool)),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setTransmissionDC1394Done()),
            this,SLOT(onTransmissionOnoffDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setPowerDC1394Done()),
            this,SLOT(onPowerOnoffDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setFormat7WindowDC1394Done()),
            this,SLOT(onFormat7WindowDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setVideoModeDC1394Done()),
            this,SLOT(onVideoFormatCurrentDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setColorCodingDC1394Done()),
            this,SLOT(onColorCodingDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setFPSDC1394Done()),
            this,SLOT(onFramerateDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setISOSpeedDC1394Done()),
            this,SLOT(onISOSpeedDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setBytesPerPacketDC1394Done()),
            this,SLOT(onSizeByteDone()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(setOperationModeDC1394Done()),
            this,SLOT(onOpModeDone()),Qt::QueuedConnection);

    connect(&dc1394Thread,SIGNAL(startLoading()),
            this,SLOT(onStartLoading()),Qt::QueuedConnection);
    connect(&dc1394Thread,SIGNAL(stopLoading()),
            this,SLOT(onStopLoading()),Qt::QueuedConnection);

    dc1394Thread.start();

    m_pSli.append(ui->sliderSharpness);
    m_pSli.append(ui->sliderHue);
    m_pSli.append(ui->sliderSaturation);
    m_pSli.append(ui->sliderGamma);
    m_pSli.append(ui->sliderIris);
    m_pSli.append(ui->sliderFocus);
    m_pSli.append(ui->sliderShutter);
    m_pSli.append(ui->sliderBrightness);
    m_pSli.append(ui->sliderGain);
    m_pSli.append(ui->sliderExposure);
    m_pSli.append(ui->sliderWB);

    for(int i=0;i<m_pSli.count();i++){
        connect(((DC1394SliderBase*)m_pSli.at(i)),SIGNAL(featureDisabled(QObject*)),
                this,SLOT(onSliderDisabled(QObject *)),Qt::QueuedConnection);
    }
}
DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
    QWidget(parent),
    m_topLayout(0),
    m_urlNavigator(0),
    m_searchBox(0),
    m_view(0),
    m_filterBar(0),
    m_statusBar(0),
    m_statusBarTimer(0),
    m_statusBarTimestamp()
{
    hide();

    m_topLayout = new QVBoxLayout(this);
    m_topLayout->setSpacing(0);
    m_topLayout->setMargin(0);

    m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this);
    connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl&, QDropEvent*)),
            this, SLOT(dropUrls(const KUrl&, QDropEvent*)));
    connect(m_urlNavigator, SIGNAL(activated()),
            this, SLOT(activate()));
    connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
            this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));

    const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
    m_urlNavigator->setUrlEditable(settings->editableUrl());
    m_urlNavigator->setShowFullPath(settings->showFullPath());
    m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl()));
    KUrlComboBox* editor = m_urlNavigator->editor();
    editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));

    m_searchBox = new DolphinSearchBox(this);
    m_searchBox->hide();
    connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox()));
    connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(startSearching(QString)));
    connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));

    m_view = new DolphinView(url, this);
    connect(m_view, SIGNAL(urlChanged(const KUrl&)),      m_urlNavigator, SLOT(setUrl(const KUrl&)));
    connect(m_view, SIGNAL(writeStateChanged(bool)),      this, SIGNAL(writeStateChanged(bool)));
    connect(m_view, SIGNAL(requestItemInfo(KFileItem)),   this, SLOT(showItemInfo(KFileItem)));
    connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&)));
    connect(m_view, SIGNAL(infoMessage(const QString&)),  this, SLOT(showInfoMessage(const QString&)));
    connect(m_view, SIGNAL(itemTriggered(KFileItem)),     this, SLOT(slotItemTriggered(KFileItem)));
    connect(m_view, SIGNAL(redirection(KUrl, KUrl)),      this, SLOT(redirect(KUrl, KUrl)));
    connect(m_view, SIGNAL(startedPathLoading(KUrl)),     this, SLOT(slotStartedPathLoading()));
    connect(m_view, SIGNAL(finishedPathLoading(KUrl)),    this, SLOT(slotFinishedPathLoading()));
    connect(m_view, SIGNAL(itemCountChanged()),           this, SLOT(delayedStatusBarUpdate()));
    connect(m_view, SIGNAL(pathLoadingProgress(int)),     this, SLOT(updateProgress(int)));
    connect(m_view, SIGNAL(infoMessage(const QString&)),  this, SLOT(showInfoMessage(const QString&)));
    connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&)));
    connect(m_view, SIGNAL(urlIsFileError(const KUrl&)),  this, SLOT(openFile(const KUrl&)));
    connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)),    this, SLOT(delayedStatusBarUpdate()));
    connect(m_view, SIGNAL(operationCompletedMessage(const QString&)), this, SLOT(showOperationCompletedMessage(const QString&)));

    connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
            this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&)));
    connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(const KUrl&)),
            this, SLOT(saveViewState()));
    connect(m_urlNavigator, SIGNAL(historyChanged()),
            this, SLOT(slotHistoryChanged()));

    // initialize status bar
    m_statusBar = new DolphinStatusBar(this, m_view);
    connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopLoading()));

    m_statusBarTimer = new QTimer(this);
    m_statusBarTimer->setSingleShot(true);
    m_statusBarTimer->setInterval(300);
    connect(m_statusBarTimer, SIGNAL(timeout()),
            this, SLOT(updateStatusBar()));

    KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
    connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
            this, SLOT(delayedStatusBarUpdate()));

    // initialize filter bar
    m_filterBar = new FilterBar(this);
    m_filterBar->setVisible(settings->filterBar());
    connect(m_filterBar, SIGNAL(filterChanged(const QString&)),
            this, SLOT(setNameFilter(const QString&)));
    connect(m_filterBar, SIGNAL(closeRequest()),
            this, SLOT(closeFilterBar()));
    connect(m_view, SIGNAL(urlChanged(const KUrl&)),
            m_filterBar, SLOT(clear()));

    m_topLayout->addWidget(m_urlNavigator);
    m_topLayout->addWidget(m_searchBox);
    m_topLayout->addWidget(m_view);
    m_topLayout->addWidget(m_filterBar);
    m_topLayout->addWidget(m_statusBar);

    setSearchModeEnabled(isSearchUrl(url));
}
Beispiel #20
0
/* Replay the append log file. On error REDIS_OK is returned. On non fatal
 * error (the append only file is zero-length) REDIS_ERR is returned. On
 * fatal error an error message is logged and the program exists. */
int loadAppendOnlyFile(char *filename) {
    struct redisClient *fakeClient;
    FILE *fp = fopen(filename,"r");
    struct redis_stat sb;
    int old_aof_state = server.aof_state;
    long loops = 0;

    if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) {
        server.aof_current_size = 0;
        fclose(fp);
        return REDIS_ERR;
    }

    if (fp == NULL) {
        redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno));
        exit(1);
    }

    /* Temporarily disable AOF, to prevent EXEC from feeding a MULTI
     * to the same file we're about to read. */
    server.aof_state = REDIS_AOF_OFF;

    fakeClient = createFakeClient();
    startLoading(fp);

    while(1) {
        int argc, j;
        unsigned long len;
        robj **argv;
        char buf[128];
        sds argsds;
        struct redisCommand *cmd;

        /* Serve the clients from time to time */
        if (!(loops++ % 1000)) {
            loadingProgress(ftello(fp));
            aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
        }

        if (fgets(buf,sizeof(buf),fp) == NULL) {
            if (feof(fp))
                break;
            else
                goto readerr;
        }
        if (buf[0] != '*') goto fmterr;
        argc = atoi(buf+1);
        if (argc < 1) goto fmterr;

        argv = zmalloc(sizeof(robj*)*argc);
        for (j = 0; j < argc; j++) {
            if (fgets(buf,sizeof(buf),fp) == NULL) goto readerr;
            if (buf[0] != '$') goto fmterr;
            len = strtol(buf+1,NULL,10);
            argsds = sdsnewlen(NULL,len);
            if (len && fread(argsds,len,1,fp) == 0) goto fmterr;
            argv[j] = createObject(REDIS_STRING,argsds);
            if (fread(buf,2,1,fp) == 0) goto fmterr; /* discard CRLF */
        }

        /* Command lookup */
        cmd = lookupCommand(argv[0]->ptr);
        if (!cmd) {
            redisLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", argv[0]->ptr);
            exit(1);
        }
        /* Run the command in the context of a fake client */
        fakeClient->argc = argc;
        fakeClient->argv = argv;
        cmd->proc(fakeClient);

        /* The fake client should not have a reply */
        redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0);
        /* The fake client should never get blocked */
        redisAssert((fakeClient->flags & REDIS_BLOCKED) == 0);

        /* Clean up. Command code may have changed argv/argc so we use the
         * argv/argc of the client instead of the local variables. */
        for (j = 0; j < fakeClient->argc; j++)
            decrRefCount(fakeClient->argv[j]);
        zfree(fakeClient->argv);
    }

    /* This point can only be reached when EOF is reached without errors.
     * If the client is in the middle of a MULTI/EXEC, log error and quit. */
    if (fakeClient->flags & REDIS_MULTI) goto readerr;

    fclose(fp);
    freeFakeClient(fakeClient);
    server.aof_state = old_aof_state;
    stopLoading();
    aofUpdateCurrentSize();
    server.aof_rewrite_base_size = server.aof_current_size;
    return REDIS_OK;

readerr:
    if (feof(fp)) {
        redisLog(REDIS_WARNING,"Unexpected end of file reading the append only file");
    } else {
        redisLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
    }
    exit(1);
fmterr:
    redisLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
    exit(1);
}
Beispiel #21
0
void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
{
    if (messageID.is<CoreIPC::MessageClassDrawingArea>()) {
        ASSERT(m_drawingArea);
        m_drawingArea->didReceiveMessage(connection, messageID, arguments);
        return;
    }

    switch (messageID.get<WebPageMessage::Kind>()) {
        case WebPageMessage::SetActive: {
            bool active;
            if (!arguments.decode(active))
                return;
         
            setActive(active);
            break;
        }
        case WebPageMessage::SetFocused: {
            bool focused;
            if (!arguments.decode(focused))
                return;
            
            setFocused(focused);
            break;
        }
        case WebPageMessage::MouseEvent: {
            WebMouseEvent event;
            if (!arguments.decode(event))
                return;
            connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
            PlatformMouseEvent platformEvent = platform(event);
            mouseEvent(platformEvent);
            break;
        }
        case WebPageMessage::WheelEvent: {
            WebWheelEvent event;
            if (!arguments.decode(event))
                return;
            connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
            PlatformWheelEvent platformEvent = platform(event);
            wheelEvent(platformEvent);
            break;
        }
        case WebPageMessage::KeyEvent: {
            WebKeyboardEvent event;
            if (!arguments.decode(event))
                return;
            connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
            PlatformKeyboardEvent platformEvent = platform(event);
            keyEvent(platformEvent);
            break;
        }
        case WebPageMessage::LoadURL: {
            String url;
            if (!arguments.decode(url))
                return;
            
            loadURL(url);
            break;
        }
        case WebPageMessage::StopLoading:
            stopLoading();
            break;
        case WebPageMessage::Reload:
            bool reloadFromOrigin;
            if (!arguments.decode(CoreIPC::Out(reloadFromOrigin)))
                return;

            reload(reloadFromOrigin);
            break;
        case WebPageMessage::GoForward:
            goForward();
            break;
        case WebPageMessage::GoBack:
            goBack();
            break;
        case WebPageMessage::DidReceivePolicyDecision: {
            uint64_t frameID;
            uint64_t listenerID;
            uint32_t policyAction;
            if (!arguments.decode(CoreIPC::Out(frameID, listenerID, policyAction)))
                return;
            didReceivePolicyDecision(webFrame(frameID), listenerID, (WebCore::PolicyAction)policyAction);
            break;
        }
        case WebPageMessage::RunJavaScriptInMainFrame: {
            String script;
            uint64_t callbackID;
            if (!arguments.decode(CoreIPC::Out(script, callbackID)))
                return;
            runJavaScriptInMainFrame(script, callbackID);
            break;
        }
        case WebPageMessage::GetRenderTreeExternalRepresentation: {
            uint64_t callbackID;
            if (!arguments.decode(callbackID))
                return;
            getRenderTreeExternalRepresentation(callbackID);
            break;
        }
        case WebPageMessage::Close: {
            close();
            break;
        }
        case WebPageMessage::TryClose: {
            tryClose();
            break;
        }
        default:
            ASSERT_NOT_REACHED();
            break;
    }
}
Beispiel #22
0
/* Replay the append log file. On error REDIS_OK is returned. On non fatal
 * error (the append only file is zero-length) REDIS_ERR is returned. On
 * fatal error an error message is logged and the program exists. */
int loadAppendOnlyFile(char *filename) {
    struct redisClient *fakeClient;
    FILE *fp = fopen(filename,"r");
    struct redis_stat sb;
    int old_aof_state = server.aof_state;
    long loops = 0;

    if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) {
        server.aof_current_size = 0;
        fclose(fp);
        return REDIS_ERR;
    }

    if (fp == NULL) {
        redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno));
        exit(1);
    }

    /* Temporarily disable AOF, to prevent EXEC from feeding a MULTI
     * to the same file we're about to read. */
    server.aof_state = REDIS_AOF_OFF;

    fakeClient = createFakeClient();
    startLoading(fp);

    while(1) {
        int argc, j;
        unsigned long len;
        robj **argv;
        char buf[128];
        sds argsds;
        struct redisCommand *cmd;

        /* Serve the clients from time to time */
        if (!(loops++ % 1000)) {
            loadingProgress(ftello(fp));
            processEventsWhileBlocked();
        }

        if (fgets(buf,sizeof(buf),fp) == NULL) {
            if (feof(fp))
                break;
            else
                goto readerr;
        }
        if (buf[0] != '*') goto fmterr;
        if (buf[1] == '\0') goto readerr;
        argc = atoi(buf+1);
        if (argc < 1) goto fmterr;

        argv = zmalloc(sizeof(robj*)*argc);
        fakeClient->argc = argc;
        fakeClient->argv = argv;

        for (j = 0; j < argc; j++) {
            if (fgets(buf,sizeof(buf),fp) == NULL) {
                fakeClient->argc = j; /* Free up to j-1. */
                freeFakeClientArgv(fakeClient);
                goto readerr;
            }
            if (buf[0] != '$') goto fmterr;
            len = strtol(buf+1,NULL,10);
            argsds = sdsnewlen(NULL,len);
            if (len && fread(argsds,len,1,fp) == 0) {
                sdsfree(argsds);
                fakeClient->argc = j; /* Free up to j-1. */
                freeFakeClientArgv(fakeClient);
                goto readerr;
            }
            argv[j] = createObject(REDIS_STRING,argsds);
            if (fread(buf,2,1,fp) == 0) {
                fakeClient->argc = j+1; /* Free up to j. */
                freeFakeClientArgv(fakeClient);
                goto readerr; /* discard CRLF */
            }
        }

        /* Command lookup */
        cmd = lookupCommand(argv[0]->ptr);
        if (!cmd) {
            redisLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", (char*)argv[0]->ptr);
            exit(1);
        }

        /* Run the command in the context of a fake client */
        cmd->proc(fakeClient);

        /* The fake client should not have a reply */
        redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0);
        /* The fake client should never get blocked */
        redisAssert((fakeClient->flags & REDIS_BLOCKED) == 0);

        /* Clean up. Command code may have changed argv/argc so we use the
         * argv/argc of the client instead of the local variables. */
        freeFakeClientArgv(fakeClient);
    }

    /* This point can only be reached when EOF is reached without errors.
     * If the client is in the middle of a MULTI/EXEC, log error and quit. */
    if (fakeClient->flags & REDIS_MULTI) goto uxeof;

loaded_ok: /* DB loaded, cleanup and return REDIS_OK to the caller. */
    fclose(fp);
    freeFakeClient(fakeClient);
    server.aof_state = old_aof_state;
    stopLoading();
    aofUpdateCurrentSize();
    server.aof_rewrite_base_size = server.aof_current_size;
    return REDIS_OK;

readerr: /* Read error. If feof(fp) is true, fall through to unexpected EOF. */
    if (!feof(fp)) {
        redisLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
        exit(1);
    }

uxeof: /* Unexpected AOF end of file. */
    if (server.aof_load_truncated) {
        redisLog(REDIS_WARNING,"!!! Warning: short read while loading the AOF file !!!");
        redisLog(REDIS_WARNING,
            "AOF loaded anyway because aof-load-truncated is enabled");
        goto loaded_ok;
    }
    redisLog(REDIS_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.");
    exit(1);

fmterr: /* Format error. */
    redisLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
    exit(1);
}