void
ShootingMode::updateList( Camera *camera )
{
    /*
     *  Get the updated list of choices for shooting mode.
     *  For cameras where the shooting mode can only be changed
     *  on the camera itself, n = 0 always and this code has
     *  no effect.
     */
    camera->getShootingMode_List( &n, &v );

    for( int i = 0; i < n; i++ ) {
	setPage( i, v[i] );
    }
    stackedWidget->setCurrentIndex( 0 );
    update();
}
示例#2
0
FirstRunWizard::FirstRunWizard(QWidget *parent) :
    QWizard(parent)
{
    setPage(Page_Intro, new IntroPage);
    setPage(Page_Login, new LoginPage);
    setPage(Page_NewAccount, new NewAccountPage);
    setPage(Page_Activate, new ActivatePage);
    setPage(Page_Welcome, new WelcomePage);
    setPage(Page_KeyboardShortcuts, new ShortcutsPage);
    setPage(Page_OnlineServices, new OnlineServicesPage);
    setPage(Page_Finished, new FinishedPage);

    setStartId(Page_Intro);

    setWindowTitle(tr("ScreenCloud"));
    setOptions(QWizard::CancelButtonOnLeft);
    background = QPixmap(":/images/wizard_background.png");
    setPixmap(QWizard::BackgroundPixmap, background);
}
示例#3
0
HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_HOME)
{
    LTMSidebar *s = new LTMSidebar(context);
    HomeWindow *h = new HomeWindow(context, "home", "Trends");
    controls->addWidget(h->controls());
    controls->setCurrentIndex(0);
    BlankStateHomePage *b = new BlankStateHomePage(context);

    setSidebar(s);
    setPage(h);
    setBlank(b);
    setBottom(new ComparePane(context, this, ComparePane::season));

    connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
    connect(this, SIGNAL(onSelectionChanged()), this, SLOT(justSelected()));
    connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool)));
    connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear()));
}
示例#4
0
static void setupMessagesMode(int allowCancel)
{
    setPage(TAB_MESSAGES);

    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_3DVMODE), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_FULLSCREEN), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_SINGLEPLAYER), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_MULTIPLAYER), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_NUMPLAYERS), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_NUMPLAYERSUD), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_PEERTOPEER), FALSE);
    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC_HOSTSLIST), FALSE);

    EnableWindow(GetDlgItem(startupdlg, IDC_ALWAYSSHOW), FALSE);

    EnableWindow(GetDlgItem(startupdlg, IDCANCEL), allowCancel);
    EnableWindow(GetDlgItem(startupdlg, IDOK), FALSE);
}
示例#5
0
bool VCWidget::loadXMLCommon(const QDomElement *root)
{
    Q_ASSERT(root != NULL);

    /* ID */
    if (root->hasAttribute(KXMLQLCVCWidgetID))
        setID(root->attribute(KXMLQLCVCWidgetID).toUInt());

    /* Caption */
    if (root->hasAttribute(KXMLQLCVCCaption))
        setCaption(root->attribute(KXMLQLCVCCaption));

    /* Page */
    if (root->hasAttribute(KXMLQLCVCWidgetPage))
        setPage(root->attribute(KXMLQLCVCWidgetPage).toInt());

    return true;
}
示例#6
0
void HelpBrowser::setHelpEngine(QHelpEngine* helpEngine)
{
  mpHelpEngine = helpEngine;

  setPage(new HelpPage((QWidget*)parent(), helpEngine, this));

  page()->setNetworkAccessManager(new HelpNetworkAccessManager(helpEngine, this));

  QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
  action->setText(tr("Open Link in New Tab"));
  if (!parent())
    action->setVisible(false);

  pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
  pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
  pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

}
示例#7
0
void QtUserSearchWindow::setFirstPage(QString title) {
    if (page(1) != nullptr) {
        removePage(1);
    }
    if (type_ == AddContact) {
        firstPage_ = new QtUserSearchFirstPage(type_, title.isEmpty() ? firstPage_->title() : title, settings_);
        connect(firstPage_->jid_, SIGNAL(textEdited(QString)), this, SLOT(handleContactSuggestionRequested(QString)));
        connect(firstPage_->jid_, SIGNAL(textEdited(QString)), this, SLOT(handleJIDEditingDone()), Qt::UniqueConnection);
        firstPage_->jid_->onUserSelected.connect(boost::bind(&QtUserSearchWindow::handleOnSearchedJIDSelected, this, _1));
        connect(firstPage_->byJID_, SIGNAL(toggled(bool)), this, SLOT(handleFirstPageRadioChange()));
        connect(firstPage_->byLocalSearch_, SIGNAL(toggled(bool)), this, SLOT(handleFirstPageRadioChange()));
        connect(firstPage_->byRemoteSearch_, SIGNAL(toggled(bool)), this, SLOT(handleFirstPageRadioChange()));
#if QT_VERSION >= 0x040700
        firstPage_->jid_->setPlaceholderText(tr("*****@*****.**"));
#endif
        firstPage_->service_->setEnabled(false);
        setPage(1, firstPage_);
    } else {
示例#8
0
文件: kdvi.cpp 项目: xwizard/kde1
void kdvi::openFile( QString name)
{
    if ( name.isEmpty() )
        return;
    QString oname( name );
    name.detach();
    if ( ! QFileInfo( name ).isReadable() )
        name.append( ".dvi" );
    if ( ! QFileInfo( name ).isReadable() )
    {
        QMessageBox::information( this, i18n("Notice"),
                                  QString(i18n("Can't read file:\n")) +
                                  oname, i18n("OK"));
        return;
    }
    QDir::setCurrent( QFileInfo( name ).dirPath() );
    dviName = name.copy();
    message( i18n("Opening ") + name + " ...");

    makeStatusBar( dviName );
    applyShowStatusbar();
    dviwin->setFile( name );
    dviwin->repaint();
    setCaption( QString()+kapp->getCaption()+": "+name );
    setPage();
    shrinkChanged( dviwin->shrink() );
    if (-1==recent.find(name))
    {
        recent.insert(0,name);
        if (recent.count()>(unsigned)recentmax)
            recent.removeLast();
        config->setGroup("RecentFiles");
        int i=recent.count();
        while ( i-->0 )
            config->writeEntry(QString().setNum(i),
                               recent.at(i));
        config->setGroup( "kdvi" );
        recentmenu->clear();
        for (int n=recent.count(); n-->0;)
            recentmenu->insertItem( recent.at(n), n, 0 );
    }
    updateMarklist();
    message( i18n("Opened ") + name );
}
示例#9
0
BtBookshelfWizard::BtBookshelfWizard(QWidget * parent, Qt::WindowFlags flags)
    : QWizard(parent, flags)
    , m_downloadInProgress(false)
    , m_closeRequested(false)
    , m_closeMessageBox(new QMessageBox(this))
    , m_taskPage(new BtBookshelfTaskPage(this))
    , m_sourcesPage(new BtBookshelfSourcesPage(this))
    , m_sourcesProgressPage(new BtBookshelfSourcesProgressPage(this))
    , m_languagesPage(new BtBookshelfLanguagesPage(this))
    , m_installWorksPage(new BtBookshelfWorksPage(WizardTaskType::installWorks, this))
    , m_updateWorksPage(new BtBookshelfWorksPage(WizardTaskType::updateWorks, this))
    , m_removeWorksPage(new BtBookshelfWorksPage(WizardTaskType::removeWorks, this))
    , m_installFinalPage(new BtBookshelfInstallFinalPage(this))  // For install and update
{
    setPage(WizardPage::taskPage, m_taskPage);
    setPage(WizardPage::sourcesProgressPage,m_sourcesProgressPage);
    setPage(WizardPage::sourcesPage, m_sourcesPage);
    setPage(WizardPage::languagesPage, m_languagesPage);
    setPage(WizardPage::installWorksPage, m_installWorksPage);
    setPage(WizardPage::updateWorksPage, m_updateWorksPage);
    setPage(WizardPage::removeWorksPage, m_removeWorksPage);
    setPage(WizardPage::removeFinalPage, new BtBookshelfRemoveFinalPage(this));
    setPage(WizardPage::installFinalPage, m_installFinalPage);
    setStartId(WizardPage::taskPage);

    QRect rect = geometry();
    rect.setWidth(780);
    rect.setHeight(600);
    setGeometry(rect);
    setOption(QWizard::NoBackButtonOnLastPage);

    retranslateUi();

    // Load wizard geometry:
    restoreGeometry(btConfig().value<QByteArray>(GeometryKey, QByteArray()));
}
示例#10
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_progress(0)
    , m_page(new WebPage(this))
{
    setPage(m_page);
    connect(page(), SIGNAL(statusBarMessage(QString)),
            SLOT(setStatusBarText(QString)));
    connect(this, SIGNAL(loadProgress(int)),
            this, SLOT(setProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)),
            this, SLOT(loadFinished()));
    connect(page(), SIGNAL(loadingUrl(QUrl)),
            this, SIGNAL(urlChanged(QUrl)));
    connect(page(), SIGNAL(downloadRequested(QNetworkRequest)),
            this, SLOT(downloadRequested(QNetworkRequest)));
    page()->setForwardUnsupportedContent(true);

}
示例#11
0
bool MagicSwitchPage::handleEvent(gui_event_t *event) {
  if (BUTTON_DOWN(Buttons.BUTTON4)) {
    if (EVENT_PRESSED(event, Buttons.BUTTON1)) {
      GUI.flash_strings_fill("CLEAR ALL", "");
      for (int i = 0; i < 4; i++) {
        magicPages[i].clearRecording();
      }
      return true;
    }
  }
  if (EVENT_PRESSED(event, Buttons.BUTTON2)) {
    MidiUart.printfString("SELECT PAGE");
    selectPage = true;
    redisplayPage();
    return true;
  }
  if (EVENT_RELEASED(event, Buttons.BUTTON2)) {
    selectPage = false;
    if (currentPage != NULL) {
      redisplayPage();
    }
    return true;
  }
  if (selectPage) {
    for (int i = Buttons.ENCODER1; i <= Buttons.ENCODER4; i++) {
      if (pages[i] != NULL && EVENT_PRESSED(event, i)) {
        setPage(pages[i]);
        return true;
      }
    }
    if (EVENT_PRESSED(event, Buttons.BUTTON1)) {
      setToCurrentTrack();
      return true;
    }
  }

  if (currentPage != NULL) {
    return currentPage->handleEvent(event);
  } 
  else {
    return false;
  }
}
示例#12
0
void TabbedWebView::setWebPage(WebPage* page)
{
    if (m_page == page) {
        return;
    }

    if (m_page) {
        delete m_page;
        m_page = 0;
    }

    m_page = page;
    m_page->setWebView(this);
    m_page->setParent(this);
    setPage(m_page);

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(linkHovered(QString, QString, QString)));
    connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(closeView()));
}
示例#13
0
QmitkHistogramJSWidget::QmitkHistogramJSWidget(QWidget *parent) :
  QWebView(parent)
{
  // set histogram type to barchart in first instance
  m_UseLineGraph = false;
  m_Page = new QmitkJSWebPage(this);
  setPage(m_Page);
  // set html from source
  connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(AddJSObject()));
  QUrl myUrl = QUrl("qrc:///QtWidgetsExt/Histogram.html");
  setUrl(myUrl);

  // set Scrollbars to be always disabled
  page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
  page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);

  m_ParametricPath = ParametricPathType::New();

}
示例#14
0
//void GuidoViewer::export2Image (const File& file, ImageFileFormat* format)
int guido2img::convert (guidosession* const currentSession)
{

  ImageFileFormat *format;
  switch (currentSession->format_) {
    case GUIDO_WEB_API_PNG :
        format = new PNGImageFormat ();
        break;
    case GUIDO_WEB_API_JPEG :
        format = new JPEGImageFormat ();
        break;
    case GUIDO_WEB_API_GIF :
        format = new GIFImageFormat ();
        break;
    case GUIDO_WEB_API_SVG :
        assert (false);
    default :
        format = new PNGImageFormat ();
        break;
  }
  setGMNCode (currentSession->gmn_.c_str());
  setPage (currentSession->page_);
  setResizePageToMusic (currentSession->resizeToPage_);
  GuidoPageFormat pagef;
  currentSession->fillGuidoPageFormatUsingCurrentSettings(&pagef);
  setGuidoPageFormat(pagef);

  Image::PixelFormat pf = Image::RGB;
  if (currentSession->format_ == GUIDO_WEB_API_PNG)
    pf = Image::ARGB;	

  SoftwareImageType type;
  Image img (pf, currentSession->width_, currentSession->height_, true, type);
  Graphics g (img);
  if (pf == Image::RGB) {
    g.setColour (Colours::white);
    g.fillRect (0, 0, currentSession->width_, currentSession->height_);
  }
  GuidoComponent::paint(g);
  format->writeImageToStream (img, fBuffer);
  delete format;
  return 0; // need to fix this...
}
示例#15
0
MyWebView::MyWebView(QWidget *parent):
    QWebView(parent),
    m_page(this)
{
    // Set the page of our own PageView class, MyPageView,
    // because only objects of this class will handle
    // object-tags correctly.

    m_page.setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    QNetworkAccessManager *networkManager = new MyNetworkAccessManager(this);
    m_page.setNetworkAccessManager(networkManager);
    setPage(&m_page);

    //set cookie jar for persistent cookies
    CookieJar* jar = new CookieJar(QString(dataPath + "/cookies.txt"));
    page()->networkAccessManager()->setCookieJar(jar);

    progressBar = 0;
    connect(this, SIGNAL(linkClicked(const QUrl&)), SLOT(link(const QUrl&)));
}
示例#16
0
WebView::WebView(QUrl baseUrl, QWidget *parent) :
    QWebView(parent),
    baseUrl_(baseUrl)
{
#ifdef Q_WS_X11
   if (!core::system::getenv("KDE_FULL_SESSION").empty())
      setStyle(new QPlastiqueStyle());
#endif
   pWebPage_ = new WebPage(baseUrl, this);
   setPage(pWebPage_);

   page()->setForwardUnsupportedContent(true);
   if (desktop::options().webkitDevTools())
      page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

   connect(page(), SIGNAL(downloadRequested(QNetworkRequest)),
           this, SLOT(downloadRequested(QNetworkRequest)));
   connect(page(), SIGNAL(unsupportedContent(QNetworkReply*)),
           this, SLOT(unsupportedContent(QNetworkReply*)));
}
示例#17
0
LClsStartupWizard::LClsStartupWizard(QWidget *parent) :
    QWizard(parent)
{

    setPage(Page_Intro, new LIntroPage);
    setPage(Page_PowerHardwareOn, new LPowerHardwareOnPage);
    setPage(Page_WarmUpCls, new LWarmUpClsPage);
    setPage(Page_TurnInjectorOn, new LTurnInjectorOnPage);
    setPage(Page_BringEbeamToFirstScreen, new LBringEbeamToFirstScreenPage);
    setPage(Page_BringEbeamToThirdScreen, new LBringEbeamToThirdScreenPage);
    setPage(Page_StoreEbeam, new LStoreEbeamPage);
    setPage(Page_Conclusion, new LConclusionPage);
    setStartId(Page_Intro);

    setOption(HaveHelpButton, true);
    connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));

    //setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));
    //setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/background.png"));

    setWindowTitle(tr("Cls Startup Wizard"));
}
示例#18
0
void printImage(uint8_t * image)
{
        int column;
        int row;
        int imageWidth = image[0];
        int imageHeight = image[1];
        
        for(row = 0; row < imageHeight; row++)
        {
                setColumn(0);
                setPage(row);
        
                uint8_t imageRow[imageWidth];
                for(column = 0; column < imageWidth; column++)
                {
                        imageRow[column] = image[2 + imageWidth*row + column];
                }
            LCD_writeData(imageRow,imageWidth);        
        }
}
示例#19
0
TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_TRAIN)
{
    trainTool = new TrainSidebar(context);
    trainTool->hide();

    HomeWindow *t = new HomeWindow(context, "train", "train");
    controls->addWidget(t->controls());
    controls->setCurrentIndex(0);
    BlankStateTrainPage *b = new BlankStateTrainPage(context);

    setSidebar(trainTool->controls());
    setPage(t);
    setBlank(b);

    trainBottom = new TrainBottom(trainTool, this);
    setBottom(trainBottom);
    setHideBottomOnIdle(false);

    connect(this, SIGNAL(onSelectionChanged()), this, SLOT(onSelectionChanged()));
    connect(trainBottom, SIGNAL(autoHideChanged(bool)), this, SLOT(onAutoHideChanged(bool)));
}
示例#20
0
void qPBReaderDocView::InitializeView()
{
   TRSCOPE(view, "qPBReaderDocView::InitializeView");

   setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing |
                  QPainter::SmoothPixmapTransform);
   setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

   _sizeHint = QSize(510, 680);
   _initialPos = 0.;
   _toBottom = false;

   _pDoc = new qPBReaderDoc(this);

   setPage(_pDoc);

   // signal handling

   connect(this, SIGNAL(loadFinished(bool)),
           this, SLOT(LoadFinished(bool)));
}
示例#21
0
void ofxSimpleGuiToo::keyPressed(ofKeyEventArgs &e) {
	if(doDefaultKeys) {
		if(e.key == ' ') {
			toggleDraw();
		} else if(e.key>='0' && e.key<='9') {
			setPage((int)(e.key - '0'));
			setDraw(true);
		} else if(doDraw) {
			switch(e.key) {
				case '[': prevPage(); break;
				case ']': nextPage(); break;
			}
		}
	}
	
	if(doDraw) {
		headerPage->keyPressed(e);
		pages[currentPageIndex]->keyPressed(e);
	}
	
}
示例#22
0
void XimCandidateWindow::setIndex(int index)
{
#if defined(ENABLE_DEBUG)
    qDebug("setIndex : index = %d", index);
#endif
    // validity check
    if (index < 0)
        candidateIndex = nrCandidates - 1;
    else if (index >= nrCandidates)
        candidateIndex = 0;
    else
        candidateIndex = index;

    // set page
    int newpage = 0;
    if (displayLimit)
        newpage = candidateIndex / displayLimit;
    if (pageIndex != newpage)
        setPage(newpage);

    // select item
    if (candidateIndex >= 0 && needHighlight)
    {
        int pos = index;
        if (displayLimit)
            pos = candidateIndex % displayLimit;

        if (cList->item(pos, 0) && !cList->item(pos, 0)->isSelected())
        {
            cList->clearSelection();
            cList->selectRow(pos);
        }
    }
    else
    {
        cList->clearSelection();
    }

    updateLabel();
}
示例#23
0
FormRulesViewer::FormRulesViewer(QWidget* parent, Qt::WindowFlags flags )
	: QWidget(parent, flags)
	, ui(new Ui::FormRulesViewer)
{
	if (Rules::sample()->doc()) {
		close();
	}
	ui->setupUi(this);
	ui->graphicsView->setScene(Rules::sample());
	ui->lineEditPageLimit->setText(QString::number(Rules::sample()->doc()->numPages()));
	ui->spinBoxCurrentPage->setMaximum(Rules::sample()->doc()->numPages());

	setWindowTitle(tr("Competition rules"));
	
	for (int id = 0; id< Rules::sample()->doc()->infoKeys().count(); id++) {
		if (Rules::sample()->doc()->infoKeys().at(id) == "Title") {
			if (Rules::sample()->doc()->info("Title").length() >= 3) setWindowTitle(Rules::sample()->doc()->info("Title"));
		}
	}


	connect(ui->spinBoxCurrentPage, SIGNAL(valueChanged(int)), SLOT(setPage(int)));

	ui->graphicsView->installEventFilter(this);
	ui->graphicsView->adjustSize();
	setPage(current_page);

	ui->lineEditFind->setText(Rules::sample()->searchText());
	if (Rules::sample()->searched()->isEmpty()) {
		ui->widgetItemsInfo->setHidden(true);
		ui->toolButtonNext->setDisabled(true);
		ui->toolButtonPrevious->setDisabled(true);
	} else {
		ui->toolButtonNext->setEnabled(true);
		ui->toolButtonPrevious->setEnabled(true);
		ui->widgetItemsInfo->setShown(true);
		ui->labelCountItem->setText(QString::number(Rules::sample()->searched()->count()));
		ui->labelCurrentItem->setText(QString::number(Rules::sample()->currentResult()+1));
	}
}
示例#24
0
AuthenticationWizard::AuthenticationWizard(
        KTp::ChannelAdapter *chAdapter,
        const QString &contact,
        QWidget *parent,
        bool initiate,
        const QString &question)
    : QWizard(parent),
    chAdapter(chAdapter),
    contact(contact),
    question(question),
    initiate(initiate)
{

	wizardList.append(this);
	setAttribute(Qt::WA_DeleteOnClose);

	setPage(Page_SelectMethod, createIntroPage());
	setPage(Page_QuestionAnswer, createQAPage());
	setPage(Page_SharedSecret, createSSPage());
	setPage(Page_ManualVerification, createMVPage());
	setPage(Page_Wait1, new WaitPage(i18n("Waiting for <b>%1</b>...", contact)));
	setPage(Page_Wait2, new WaitPage(i18n("Checking if answers match...")));
	setPage(Page_Final, createFinalPage());

	if(!initiate) {
		if(question.isEmpty()) {
			setStartId(Page_SharedSecret);
		} else {
			setStartId(Page_QuestionAnswer);
		}
	}

	connect(this, SIGNAL(rejected()), this, SLOT(cancelVerification()));
	connect(rbQA, SIGNAL(clicked()), this, SLOT(updateInfoBox()));
	connect(rbSS, SIGNAL(clicked()), this, SLOT(updateInfoBox()));
	connect(rbMV, SIGNAL(clicked()), this, SLOT(updateInfoBox()));

	updateInfoBox();

	resize(rbMV->width() * 1.05, rbMV->width() * 0.5);
	show();
}
void PdfRenderer::OpenPDF(QString filepath)
{
    /*
    qDebug() << "Url: " << url;
    if (m_doc) {
        delete m_doc;
        m_doc = NULL;
    }
    QString filepath = url.toLocalFile();*/
    m_doc = MuPDF::loadDocument(filepath);
    if (NULL == m_doc) {
        qDebug() << "PDF konnte nicht geöffnet werden";
        return;
    }
    m_title = m_doc->title();
    m_numPages = m_doc->numPages();

    m_index = 0;
    //openPage(0);
    setPage(m_index);

}
示例#26
0
WebView::WebView(KWebKitPart* part, QWidget* parent)
        :KWebView(parent, false),
         m_actionCollection(new KActionCollection(this)),
         m_part(part),
         m_webInspector(0),
         m_autoScrollTimerId(-1),
         m_verticalAutoScrollSpeed(0),
         m_horizontalAutoScrollSpeed(0),
         m_accessKeyActivated(NotActivated)
{
    setAcceptDrops(true);

    // Create the custom page...
    setPage(new WebPage(part, this));

    connect(this, SIGNAL(loadStarted()), this, SLOT(slotStopAutoScroll()));
    connect(this, SIGNAL(loadStarted()), this, SLOT(hideAccessKeys()));
    connect(page(), SIGNAL(scrollRequested(int,int,QRect)), this, SLOT(hideAccessKeys()));
    
    if (WebKitSettings::self()->zoomToDPI())
        setZoomFactor(logicalDpiY() / 96.0f);
}
示例#27
0
void QDeclarativeWebView::init()
{
    d = new QDeclarativeWebViewPrivate(this);

    if (QWebSettings::iconDatabasePath().isNull() &&
        QWebSettings::globalSettings()->localStoragePath().isNull() &&
        QWebSettings::offlineStoragePath().isNull() &&
        QWebSettings::offlineWebApplicationCachePath().isNull())
        QWebSettings::enablePersistentStorage();

    setAcceptedMouseButtons(Qt::LeftButton);
    setFlag(QGraphicsItem::ItemHasNoContents, true);
    setClip(true);

    d->view = new GraphicsWebView(this);
    d->view->setResizesToContents(true);
    QWebPage* wp = new QDeclarativeWebPage(this);
    setPage(wp);
    connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize()));
    connect(d->view, SIGNAL(doubleClick(int, int)), this, SIGNAL(doubleClick(int, int)));
    connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged()));
}
示例#28
0
BookViewPreview::BookViewPreview(QWidget *parent)
    : QWebView(parent),
      c_GetBlock(Utility::ReadUnicodeTextFile(":/javascript/get_block.js")),
      m_isLoadFinished(false),
      m_ContextMenu(new QMenu(this)),
      m_ViewWebPage(new ViewWebPage(this)),
      c_jQuery(Utility::ReadUnicodeTextFile(":/javascript/jquery-1.6.2.min.js")),
      c_jQueryScrollTo(Utility::ReadUnicodeTextFile(":/javascript/jquery.scrollTo-1.4.2-min.js")),
      c_jQueryWrapSelection(Utility::ReadUnicodeTextFile(":/javascript/jquery.wrapSelection.js")),
      c_GetCaretLocation(Utility::ReadUnicodeTextFile(":/javascript/book_view_current_location.js")),
      c_GetRange(Utility::ReadUnicodeTextFile(":/javascript/get_range.js")),
      c_NewSelection(Utility::ReadUnicodeTextFile(":/javascript/new_selection.js")),
      c_GetParentTags(Utility::ReadUnicodeTextFile(":/javascript/get_parent_tags.js")),
      m_CaretLocationUpdate(QString()),
      m_pendingLoadCount(0),
      m_pendingScrollToFragment(QString())
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    // Set the Zoom factor but be sure no signals are set because of this.
    SettingsStore settings;
    SetCurrentZoomFactor(settings.zoomPreview());
    // use our web page that can be used for debugging javascript
    setPage(m_ViewWebPage);
    // Enable our link filter.
    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    page()->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

    // Enable local-storage for epub3
    page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
    QString localStorePath = Utility::DefinePrefsDir() + "/local-storage";
    QDir storageDir(localStorePath);
    if (!storageDir.exists()) {
        storageDir.mkpath(localStorePath);
    }
    page()->settings()->setLocalStoragePath(localStorePath);
    CreateContextMenuActions();
    ConnectSignalsToSlots();
}
示例#29
0
int main(int argc, char *argv[])
{
    print_IP_Address();
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    PdfRenderer myPdfRenderer;

    server pdfServer(1234);

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    engine.addImageProvider(QLatin1String("pdfrenderer"), &myPdfRenderer);

    QObject *root = engine.rootObjects()[0];
    //QObject *main_qml = root->findChild<QObject*>("main");

    QObject::connect(&pdfServer, SIGNAL(pdfReceived(QByteArray)), &myPdfRenderer, SLOT(savePDF(QByteArray)));
    QObject::connect(&pdfServer, SIGNAL(pdfPageChanged(int)), &myPdfRenderer, SLOT(slot_setPage(int)));
    QObject::connect(&myPdfRenderer, SIGNAL(setPage(QVariant)),root, SLOT(qml_setPage(QVariant)));

    qDebug() << "App gestartet";
    return app.exec();
}
示例#30
0
HelpWindowWidget::HelpWindowWidget(QHelpEngine *pHelpEngine,
                                   const QUrl &pHomePage, QWidget *pParent) :
    OpenCOR::WebViewerWidget::WebViewerWidget(pParent),
    Core::CommonWidget(),
    mHelpEngine(pHelpEngine),
    mHomePage(pHomePage),
    mZoomLevel(-1)   // This will ensure that mZoomLevel gets initialised by our
                     // first call to setZoomLevel
{
    // Use our own help page and help network access manager classes

    setPage(new HelpWindowPage(this));

    page()->setNetworkAccessManager(new HelpWindowNetworkAccessManager(pHelpEngine, this));

    // Set our initial zoom level to the default value
    // Note: to set mZoomLevel directly is not good enough since one of the
    //       things setZoomLevel does is to set our zoom factor...

    setZoomLevel(DefaultZoomLevel);

    // Some connections

    connect(this, SIGNAL(urlChanged(const QUrl &)),
            this, SLOT(urlChanged(const QUrl &)));

    connect(page(), SIGNAL(selectionChanged()),
            this, SLOT(selectionChanged()));

    connect(pageAction(QWebPage::Back), SIGNAL(changed()),
            this, SLOT(documentChanged()));
    connect(pageAction(QWebPage::Forward), SIGNAL(changed()),
            this, SLOT(documentChanged()));

    // Go to the home page

    goToHomePage();
}