Ejemplo n.º 1
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
    , m_isReloading(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    m_zoomLevels = zoomLevels();
    m_currentZoomLevel = m_zoomLevels.indexOf(100);

    installEventFilter(this);

#ifdef Q_OS_MAC
    new MacWebViewScroller(this);
#endif
}
Ejemplo n.º 2
0
TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
    : WebView(webTab)
    , p_QupZilla(mainClass)
    , m_tabWidget(p_QupZilla->tabWidget())
    , m_page(0)
    , m_webTab(webTab)
    , m_menu(new Menu(this))
    , m_mouseTrack(false)
    , m_navigationVisible(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(loadingProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));

    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
    connect(this, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));

    connect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString)));

    connect(mApp->networkManager(), SIGNAL(wantsFocus(QUrl)), this, SLOT(getFocus(QUrl)));

    connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));

    // Tracking mouse also on tabs created in fullscreen
    trackMouse(p_QupZilla->isFullScreen());
}
Ejemplo n.º 3
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
    , m_isReloading(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

#if QTWEBKIT_TO_2_3
    installEventFilter(this);
#endif

#ifdef Q_OS_MAC
    new MacWebViewScroller(this);
#endif
}
Ejemplo n.º 4
0
AMPWebView::AMPWebView( PHIAHistory *history, QWidget *parent )
    : PHIAAbstractWebView( history, parent ), _webPage( 0 ), _webView( 0 ),
    _isLoading( false ), _reply( 0 )
    //_cursorSetByWebCore( false ), _usesWebCoreCursor( true )
{
    qDebug( "AMPWebView::AMPWebView()" );
    _webView=new QWebView( this );
    _webPage=new AMPWebPage( this );
    QVBoxLayout *layout=new QVBoxLayout();
    layout->setContentsMargins( 0, 0, 0 ,0 );
    layout->addWidget( _webView );
    setLayout( layout );

    Q_ASSERT( _networkAccessManager );
    _webPage->setNetworkAccessManager( _networkAccessManager );
    _webPage->setForwardUnsupportedContent( true );
    _webView->setPage( _webPage );
    //_webPage->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );

    QWebFrame *frame=_webPage->mainFrame();
    connect( frame, SIGNAL( titleChanged( const QString& ) ), this, SLOT( slotTitleChanged( const QString& ) ) );
    connect( frame, SIGNAL( iconChanged() ), this, SLOT( slotIconChanged() ) );
    connect( frame, SIGNAL( urlChanged( const QUrl& ) ), this, SLOT( slotUrlChanged( const QUrl& ) ) );
    connect( _webPage, SIGNAL( loadProgress( int ) ), this, SIGNAL( loadProgress( int ) ) );
    connect( _webPage, SIGNAL( statusBarMessage( const QString& ) ), this,
        SLOT( slotStatusBarMessage( const QString& ) ) );
    connect( _webPage, SIGNAL( windowCloseRequested() ), this, SIGNAL( windowCloseRequested() ) );
    connect( _webPage, SIGNAL( unsupportedContent( QNetworkReply* ) ), this,
        SLOT( slotUnsupportedContent( QNetworkReply* ) ) );
    connect( _webPage, SIGNAL( linkHovered( const QString&, const QString&, const QString& ) ), this,
        SLOT( slotLinkHovered( const QString&, const QString&, const QString& ) ) );
    connect( _webPage, SIGNAL( loadFinished( bool ) ), this, SLOT( slotLoadFinished( bool ) ) );
    connect( _webPage, SIGNAL( loadStarted() ), this, SLOT( slotLoadStarted() ) );
    connect( _webPage, SIGNAL( javaScriptMessage( const QString&, int, const QString& ) ), this,
        SIGNAL( javaScriptConsoleMessage( const QString&, int, const QString& ) ) );
    connect( _webPage, SIGNAL( geometryChangeRequested( const QRect& ) ), this,
        SIGNAL( geometryChangeRequested( const QRect& ) ) );
    connect( _webPage, SIGNAL( statusBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( statusBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( menuBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( menuBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( toolBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( toolBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( printRequested( QWebFrame* ) ), this,
        SLOT( slotPrintRequest( QWebFrame* ) ) );
    connect( _networkAccessManager, SIGNAL( finished( QNetworkReply* ) ), this,
        SLOT( slotReplyFinished( QNetworkReply* ) ) );
    update();
}
Ejemplo n.º 5
0
void FeedIconManager::loadIcon(const QString &url)
{
    KURL u(url);

    QString iconFile = iconLocation(u);

    if(iconFile.isNull())
    {
        QByteArray data;
        QDataStream ds(data, IO_WriteOnly);
        ds << u;
        kapp->dcopClient()->send("kded", "favicons", "downloadHostIcon(KURL)",
                                 data);
    }
    else
        slotIconChanged(false, url, iconFile);

}
Ejemplo n.º 6
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_actionsHaveImages(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));

    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

    qApp->installEventFilter(this);
}
Ejemplo n.º 7
0
TagPropWidget::TagPropWidget(QWidget* const parent)
    : QWidget(parent), d(new Private())
{
    QGridLayout* const grid = new QGridLayout(this);
    QLabel* const logo      = new QLabel(this);

    logo->setPixmap(KIcon("tag-properties").pixmap(30,30));
    d->topLabel = new QLabel(this);
    d->topLabel->setText(i18n("Tag Properties"));
    d->topLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    d->topLabel->setWordWrap(false);

    KSeparator* const line = new KSeparator(Qt::Horizontal, this);

    // --------------------------------------------------------

    QLabel* const titleLabel = new QLabel(this);
    titleLabel->setText(i18n("&Title:"));
    titleLabel->setMargin(KDialog::marginHint());
    titleLabel->setIndent(KDialog::spacingHint());

    d->titleEdit = new SearchTextBar(this, "TagEditDlgTitleEdit",
                                     i18n("Enter tag name here"));
    d->titleEdit->setCaseSensitive(false);
    titleLabel->setBuddy(d->titleEdit);

    QLabel* const tipLabel = new QLabel(this);
    tipLabel->setTextFormat(Qt::RichText);
    tipLabel->setWordWrap(true);
    tipLabel->setMargin(KDialog::marginHint());
    tipLabel->setIndent(KDialog::spacingHint());

    QLabel* const iconTextLabel = new QLabel(this);
    iconTextLabel->setText(i18n("&Icon:"));
    iconTextLabel->setMargin(KDialog::marginHint());
    iconTextLabel->setIndent(KDialog::spacingHint());

    d->iconButton         = new QPushButton(this);
    d->iconButton->setFixedSize(40, 40);
    iconTextLabel->setBuddy(d->iconButton);

    d->resetIconButton = new QPushButton(KIcon("view-refresh"), i18n("Reset"), this);

    QLabel* const kscTextLabel = new QLabel(this);
    kscTextLabel->setText(i18n("&Shortcut:"));
    kscTextLabel->setMargin(KDialog::marginHint());
    kscTextLabel->setIndent(KDialog::spacingHint());

    d->keySeqWidget      = new KKeySequenceWidget(this);
    kscTextLabel->setBuddy(d->keySeqWidget);
    d->keySeqWidget->setCheckActionCollections(TagsActionMngr::defaultManager()->actionCollections());

    QLabel* const tipLabel2 = new QLabel(this);
    tipLabel2->setTextFormat(Qt::RichText);
    tipLabel2->setWordWrap(true);
    tipLabel2->setText(i18n("<p><b>Note:</b> <i>This shortcut can be used "
                            "to assign or unassign tag to items.</i></p>"));
    tipLabel2->setMargin(KDialog::marginHint() );
    tipLabel2->setIndent(KDialog::spacingHint());

    d->saveButton = new QPushButton(i18n("Save"));
    d->discardButton = new QPushButton(i18n("Discard"));

    // --------------------------------------------------------

    grid->addWidget(logo,               0, 0, 1, 1);
    grid->addWidget(d->topLabel,        0, 1, 1, 4);
    grid->addWidget(line,               1, 0, 1, 4);
    grid->addWidget(tipLabel,           2, 0, 1, 4);
    grid->addWidget(titleLabel,         3, 0, 1, 1);
    grid->addWidget(d->titleEdit,       3, 1, 1, 3);
    grid->addWidget(iconTextLabel,      4, 0, 1, 1);
    grid->addWidget(d->iconButton,      4, 1, 1, 1);
    grid->addWidget(d->resetIconButton, 4, 2, 1, 1);
    grid->addWidget(kscTextLabel,       5, 0, 1, 1);
    grid->addWidget(d->keySeqWidget,    5, 1, 1, 3);
    grid->addWidget(tipLabel2,          6, 0, 1, 4);
    grid->addWidget(d->saveButton,      7, 0, 1, 1);
    grid->addWidget(d->discardButton,   7, 1, 1, 1);
    grid->setRowStretch(8, 10);
    grid->setColumnStretch(3, 10);
    grid->setMargin(KDialog::marginHint());
    grid->setVerticalSpacing(KDialog::spacingHint());

    adjustSize();

    connect(d->iconButton, SIGNAL(clicked()),
            this, SLOT(slotIconChanged()));

    connect(d->titleEdit, SIGNAL(textEdited(QString)),
            this, SLOT(slotDataChanged()));

    connect(d->resetIconButton, SIGNAL(clicked()),
            this,SLOT(slotIconResetClicked()));

    connect(d->keySeqWidget, SIGNAL(keySequenceChanged(QKeySequence)),
            this, SLOT(slotDataChanged()));

    connect(d->saveButton, SIGNAL(clicked()),
            this, SLOT(slotSaveChanges()));

    connect(d->discardButton, SIGNAL(clicked()),
            this, SLOT(slotDiscardChanges()));

    enableItems(TagPropWidget::DisabledAll);
}
Settings::CategoryPage::CategoryPage( QWidget* parent )
    : QWidget( parent )
{
    QVBoxLayout* lay1 = new QVBoxLayout(this);
    QHBoxLayout* lay2 = new QHBoxLayout;
    lay1->addLayout( lay2 );

    _categories = new QListWidget( this );
    connect( _categories, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(edit(QListWidgetItem*)) );
    lay2->addWidget( _categories );


    QGridLayout* lay3 = new QGridLayout;
    lay2->addLayout( lay3 );

    int row = 0;

    // Text
    _labelLabel = new QLabel( i18n( "Label:" ), this );
    lay3->addWidget( _labelLabel, row, 0 );

    _text = new KLineEdit( this );
    connect( _text, SIGNAL(textChanged(QString)),
             this, SLOT(slotLabelChanged(QString)) );

    lay3->addWidget( _text, row, 1 );

    row++;

    // Positionable

    _positionableLabel = new QLabel(i18n("Positionable tags:"), this);
    lay3->addWidget( _positionableLabel, row, 0 );

    _positionable = new QCheckBox( i18n("Coordinates can be added to tags in this category"), this);
    lay3->addWidget( _positionable, row, 1 );

    connect( _positionable, SIGNAL(clicked(bool)), this, SLOT(positionableChanged(bool)) );

    row++;

    // Icon
    _iconLabel = new QLabel( i18n("Icon:" ), this );
    lay3->addWidget( _iconLabel, row, 0 );

    _icon = new KIconButton(  this );
    lay3->addWidget( _icon, row, 1 );
    _icon->setIconSize(32);
    _icon->setIcon( QString::fromLatin1( "personsIcon" ) );
    connect( _icon, SIGNAL(iconChanged(QString)), this, SLOT(slotIconChanged(QString)) );

    row++;

    // Thumbnail size
    _thumbnailSizeInCategoryLabel = new QLabel( i18n( "Thumbnail Size: " ), this );
    lay3->addWidget( _thumbnailSizeInCategoryLabel, row, 0 );

    _thumbnailSizeInCategory = new QSpinBox;
    _thumbnailSizeInCategory->setRange( 32, 512 );
    _thumbnailSizeInCategory->setSingleStep( 32 );
    lay3->addWidget( _thumbnailSizeInCategory, row, 1 );
    connect( _thumbnailSizeInCategory, SIGNAL(valueChanged(int)), this, SLOT(thumbnailSizeChanged(int)) );

    row++;

    // Preferred View
    _preferredViewLabel = new QLabel( i18n("Preferred view:"), this );
    lay3->addWidget( _preferredViewLabel, row, 0 );

    _preferredView = new KComboBox( this );
    lay3->addWidget( _preferredView, row, 1 );
    QStringList list;
    list << i18n("List View") << i18n("List View with Custom Thumbnails") << i18n("Icon View") << i18n("Icon View with Custom Thumbnails");
    _preferredView->addItems( list );
    connect( _preferredView, SIGNAL(activated(int)), this, SLOT(slotPreferredViewChanged(int)) );

    QHBoxLayout* lay4 = new QHBoxLayout;
    lay1->addLayout( lay4 );

    KPushButton* newItem = new KPushButton( i18n("New"), this );
    connect( newItem, SIGNAL(clicked()), this, SLOT(slotNewItem()) );

    _delItem = new KPushButton( i18n("Delete"), this );
    connect( _delItem, SIGNAL(clicked()), this, SLOT(slotDeleteCurrent()) );

    lay4->addStretch(1);
    lay4->addWidget( newItem );
    lay4->addWidget( _delItem );

    _current = 0;

    // Untagged images
    _untaggedBox = new UntaggedGroupBox(this);
    lay1->addWidget(_untaggedBox);

}
Ejemplo n.º 9
0
void MediaControl::reparseConfig()
{
//	kdDebug(90200) << "reparseConfig();" << endl;
    _configFrontend->reparseConfiguration();

    if (_player != 0L) // make sure there is no player-object
    {
        _player->disconnect(); // disconnect from all things

        time_slider->disconnect();
        prev_button->disconnect();
        playpause_button->disconnect();
        stop_button->disconnect();
        next_button->disconnect();

        delete slider_tooltip; // tooltip depends on _player : delete it before _player gets deleted
        slider_tooltip = 0L;

        delete _player;
        _player = 0L;
    }

    mLastLen = -1;
    mLastTime = -1;
    mLastStatus = -1;

    QString playerString = _configFrontend->player();


#ifdef HAVE_XMMS
    if (playerString == "XMMS")
    {
        _player = new XmmsInterface ();
        time_slider->setSteps((_configFrontend->mouseWheelSpeed()*1000),
                              (_configFrontend->mouseWheelSpeed()*1000));
    }
    else
#endif
        if (playerString == "JuK")
        {
            _player = new JuKInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "Amarok")
        {
            _player = new AmarokInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "KsCD")
        {
            _player = new KsCDInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "mpd")
        {
            _player = new MpdInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else // Fallback is Noatun
        {
            _player = new NoatunInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }

    //  this signal gets emitted by a playerInterface when the player's playtime changed
    connect(_player, SIGNAL(newSliderPosition(int,int)),
            this, SLOT(setSliderPosition(int,int)));

    connect(_player, SIGNAL(playerStarted()), SLOT(enableAll()));
    connect(_player, SIGNAL(playerStopped()), SLOT(disableAll()));
    connect(_player, SIGNAL(playingStatusChanged(int)), SLOT(slotPlayingStatusChanged(int)));

    // do we use our icons or the default ones from KDE?
    if(_configFrontend->useCustomTheme())
    {
        // load theme
        QString skindir = locate("data", "mediacontrol/"+_configFrontend->theme()+"/");

        // the user has to take care if all pixmaps are there, we only check for one of them
        if (QFile(skindir+"play.png").exists())
        {
            prev_button->setIconSet(SmallIconSet(locate("data",skindir+"prev.png")));
            if (_player->playingStatus() == PlayerInterface::Playing)
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"play.png")));
            else
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"pause.png")));
            stop_button->setIconSet(SmallIconSet(locate("data",skindir+"stop.png")));
            next_button->setIconSet(SmallIconSet(locate("data",skindir+"next.png")));
        }
        else // icon-theme is invalid or not there
        {
            KNotifyClient::event(winId(), KNotifyClient::warning,
                                 i18n("There was trouble loading theme %1. Please choose" \
                                      " a different theme.").arg(skindir));

            // default to kde-icons, they have to be installed :)
            slotIconChanged();

            // and open prefs-dialog
            preferences();
        }
    }
    else // KDE default-icons, assuming that these icons exist!
    {
        // sets icons from kde
        slotIconChanged();
    }

    slider_tooltip = new MediaControlToolTip(time_slider, _player);

    connect(prev_button, SIGNAL(clicked()), _player, SLOT(prev()));
    connect(playpause_button, SIGNAL(clicked()), _player, SLOT(playpause()));
    connect(stop_button, SIGNAL(clicked()), _player, SLOT(stop()));
    connect(next_button, SIGNAL(clicked()), _player, SLOT(next()));

    connect(time_slider, SIGNAL(sliderPressed()), _player, SLOT(sliderStartDrag()));
    connect(time_slider, SIGNAL(sliderReleased()), _player, SLOT(sliderStopDrag()));
    connect(time_slider, SIGNAL(valueChanged(int)), this, SLOT(adjustTime(int)));
    connect(time_slider, SIGNAL(volumeUp()), _player, SLOT(volumeUp()));
    connect(time_slider, SIGNAL(volumeDown()), _player, SLOT(volumeDown()));
    connect(this, SIGNAL(newJumpToTime(int)), _player, SLOT(jumpToTime(int)));
}