Exemplo n.º 1
0
/*!
    Displays a prompt informing the user that the \a content cannot be rendered due to invalid rights and that
    a preview will be rendered instead.
*/
void BSciPrompts::notifyUseEmbeddedPreview( const QContent &content ) const
{
    QString title   = tr( "Preview" );
    QString message = tr( "'%1' is inaccessible, a preview version will be opened instead.", "%1 = name of content" )
            .arg( content.name() );

    message = QString( "<qt>%1</qt>" ).arg( message );

    information( title, message );
}
Exemplo n.º 2
0
/*!
    Displays a prompt informing the user that \a permission render rights for \a content are installed but they
    will not become valid until after a future \a date.
*/
void BSciPrompts::notifyFutureRights( const QContent &content, const QDateTime &date, QDrmRights::Permission permission ) const
{
    QString title   = tr( "Content Unavailable" );
    QString message = tr( "The %1 for '%2' does not allow it to be accessed before %3.",
                          "%1 = play|display|execute|print|export license, "
                          "%2 = name of content, %3 = access date/time" )
            .arg( permissionString( permission ) )
            .arg( content.name() )
            .arg( date.toString() );

    message = QString( "<qt>%1</qt>" ).arg( message );

    information( title, message );
}
Exemplo n.º 3
0
void DocumentListSelectionPage::cleanup()
{
    connect(documentsCleanupDialog->pushButton, SIGNAL(clicked()), this, SLOT(stopCleanup()));

    documentsCleanupDialog->progressBar->setRange(0, selectedSize);

    if (largeModel->rowCount() == 0)
        return;

    qLog(CleanupWizard) << "Deleting Documents...";
    for (int i = 0; i < largeModel->rowCount(); i++) {
        if (cleanupStopped)
            break;

        QModelIndex index = largeModel->index(i, 0);

        if (largeModel->data(index, Qt::CheckStateRole) == Qt::Checked) {
            QContent content = largeModel->content(index);

            documentsCleanupDialog->label->setText(tr("Deleting %1").arg(content.name()));

            qApp->processEvents();

            int contentSize = content.size();

            content.removeFiles();

            if (!content.isValid()) {
                documentsCleanupDialog->progressBar->setValue(
                    documentsCleanupDialog->progressBar->value() + contentSize);

                docDeleted++;
            }
        }
    }

    documentsCleanupDialog->pushButton->hide();
    if (cleanupStopped) {
        documentsCleanupDialog->label->setText(tr("Aborted"));
    } else {
        documentsCleanupDialog->progressBar->setValue(
            documentsCleanupDialog->progressBar->maximum());
        documentsCleanupDialog->label->setText(tr("Done"));
        documents->clear();
    }

    QTimer::singleShot(1000, documentsCleanupDialog, SLOT(close()));
    emit documentsDeleted(docDeleted, cleanupStopped);
}
Exemplo n.º 4
0
/*
 * Respond to the documentSelected signal from the appSelector, by displaying
 * information about the selected application.
 */
void AppViewer::documentSelected( const QContent &appContent )
{
    appSelector->hide();
    if ( appContent.isValid() )
    {
        textArea->setHtml( getInformation( appContent ));
    }
    else
    {
        textArea->setHtml(
                tr( "<font color=\"#CC0000\">Could not find information about %1</font>" )
                .arg( appContent.name() ));
        qWarning() << "Application " << appContent.file() << " not found";
    }
}
Exemplo n.º 5
0
/*!
    Notifies the user that the given \a content does not have valid rights to render with the given \a permission
    and that the content cannot be reactivated.  If \a permission is \c{QDrmRights::Unrestricted)} the user will
    be informed that the content must be opened in an application that support DRM content.  The message displayed
    will differ based on the \a reason the user was prompted to acquire new rights.
*/
void BSciPrompts::notifyCannotActivate( const QContent &content, QDrmRights::Permission permission, ActivationReason reason ) const
{
    QString title;
    QString message;

    if( permission == QDrmRights::Unrestricted )
    {
        title   = tr( "Content Unsupported" );
        message = tr( "'%1' cannot be opened in an application that doesn't support licensed content.",
                      "%1 = name of content" );
    }
    else
    {
        title   = tr( "Cannot activate" );

        switch( reason )
        {
        case Open:
            message = tr( "'%2' has no %1 and cannot be reactivated.",
                        "%1 = play|display|execute|print|export license, %2 = name of content" )
                    .arg( permissionString( permission ) );
            break;
        case Expired:
            message = tr( "The %1 for '%2' has expired and cannot be reactivated.",
                          "%1 = play|display|execute|print|export license, %2 = name of content" )
                    .arg( permissionString( permission ) );
            break;
        default:
            return;
        }
    }

    message = QString( "<qt>%1</qt>" ).arg( message.arg( content.name() ) );

    information( title, message );
}
Exemplo n.º 6
0
void E2TaskManager::doUpdate()
{
    if(isVisible()) {
        m_taskList->clear();
        while(m_items.count()) {
            QPair<QTreeWidgetItem*,QContent*> p = m_items.takeFirst();
            delete p.second;
        }
        QStringList apps = m_appMonitor.runningApplications();

        QContentSet set(QContent::Application);
        for (int ii=0; ii < apps.count(); ii++) {
            QContent app = set.findExecutable(apps.at(ii));
            if(app.isValid()) {
                QStringList labels;
                labels << QString("") << app.name() << QString("");
                QTreeWidgetItem* item = new QTreeWidgetItem(labels);
                item->setCheckState(0,Qt::Unchecked);
                m_taskList->addTopLevelItem(item);
                m_items.append(qMakePair(item, new QContent(app)));
            }
        }
    }
}
Exemplo n.º 7
0
/*!
    Constructs a new WheelBrowserScreen instance with the given \a parent and
    widget \a flags.
*/
WheelBrowserScreen::WheelBrowserScreen(QWidget *parent, Qt::WFlags flags)
: QAbstractBrowserScreen(parent, flags),
  m_fillAlpha(0), m_hiding(false), m_wheel(0), m_fillTimeline(0)
{
    QPalette pal = palette();
    pal.setColor(QPalette::Window, QColor(100, 100, 100, 0));
    setPalette(pal);

    QVBoxLayout * layout = new QVBoxLayout(this);
    setLayout(layout);

    m_wheel = new QPixmapWheel(this);
    QFont f = font();
    f.setBold(true);
    m_wheel->setFont(f);
    m_wheel->setMaximumVisibleIcons(7);

    QObject::connect(m_wheel, SIGNAL(moveToCompleted()),
                     this, SLOT(moveToCompleted()));
    QObject::connect(m_wheel, SIGNAL(itemSelected(QString)),
                     this, SLOT(clicked(QString)));
    setFocusProxy(m_wheel);

    layout->addStretch(1);
    layout->addWidget(m_wheel, 5);
    layout->addStretch(1);

    m_data = new QPixmapWheelData;

    // Load apps
    QSettings cfg(Qtopia::defaultButtonsFile(), QSettings::IniFormat);
    cfg.beginGroup("Menu"); // No tr
    const int menur = cfg.value("Rows",3).toInt();
    const int menuc = cfg.value("Columns",3).toInt();
    QString menuKeyMap = cfg.value("Map","123456789").toString();

    for (int i = 0; i < menur*menuc; i++) {
        QChar key = menuKeyMap[i];
        QStringList entries = cfg.value(QString(key)).toStringList();

        if(!entries.isEmpty()) {
            QContent *app = readLauncherMenuItem(entries.first());

            if(app) {
                QString file = app->fileName();
                QString name = app->name();
                if(app->type().startsWith("Folder/") )
                    file = app->type();
                QPixmap pix = app->icon().pixmap(QSize(48, 48));
                if(file.isEmpty())
                    file = app->type();

                if(!file.isEmpty() && !name.isEmpty() && !pix.isNull()) {
                    m_data->appendItem(file, pix, name);
                }
                delete app;
            }
        }
    }

    m_fillTimeline = new QTimeLine(2000, this);
    QObject::connect(m_fillTimeline, SIGNAL(valueChanged(qreal)),
                     this, SLOT(timelineStep(qreal)));
}
Exemplo n.º 8
0
void CameraMainWindow::delayedInit()
{
    settingsDialog = new QDialog( this );
    settingsDialog->setModal( true );
    settings = new Ui::CameraSettings();
    settings->setupUi( settingsDialog );
    settingsDialog->setObjectName( "settings" );    // To pick up correct help.
    connect( settings->photo_quality, SIGNAL(valueChanged(int)),
             settings->photo_quality_n, SLOT(setNum(int)) );
    QFileSystemFilter *fsf = new QFileSystemFilter;
    fsf->documents = QFileSystemFilter::Set;
    settings->location->setFilter(fsf);
    // load settings from config
    QSettings cfg("Trolltech","Camera");
    cfg.beginGroup("General");
    QString l = cfg.value("location").toString();
    if ( !l.isEmpty() )
        settings->location->setLocation(l);
    else
        settings->location->setLocation(QFileSystem::documentsFileSystem().documentsPath());
    storagepath = settings->location->documentPath();
    cfg.endGroup();
    cfg.beginGroup("Photo");
    int w;
    w = cfg.value("width",camera->videocaptureview->recommendedPhotoSize().width()).toInt();
    for (psize=0; psize<(int)photo_size.count()-1 && photo_size[psize].width() > w;)
        psize++;
    pquality = cfg.value("quality",settings->photo_quality->value()).toInt();
    cfg.endGroup();
    cfg.beginGroup("Video");
    w = cfg.value("width",camera->videocaptureview->recommendedVideoSize().width()).toInt();
    for (vsize=0; vsize<(int)video_size.count()-1 && video_size[vsize].width() > w;)
        vsize++;
    vquality = cfg.value("quality",settings->video_quality->value()).toInt();
    vframerate = cfg.value("framerate",settings->video_framerate->value()).toInt();

    for (int i=0; i<(int)photo_size.count(); i++) {
        settings->photo_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(photo_size[i].width()).arg(photo_size[i].height()));
    }
    for (int i=0; i<(int)video_size.count(); i++) {
        settings->video_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(video_size[i].width()).arg(video_size[i].height()));
    }

    QMimeType m( QLatin1String( "image/jpeg" ));
    QContent a = m.application();
    QIcon picViewIcon = a.icon();
    if ( picViewIcon.isNull() )
        picViewIcon = QIcon( QLatin1String( ":icon/view" ));

    if ( video_supported ) {
        // If video_supported is ever not a constant false then ensure
        // an application is available to handle it
        if ( a.isValid() )
        {
            a_vview = new QAction( QIcon(":image/"+a.iconName()), QString("%1...").arg(a.name()), this );
            connect( a_vview, SIGNAL(triggered()), this, SLOT(viewVideos()) );
        }
    } else {
        a_vview = 0;
    }

    a_pview = new QAction( QIcon(), tr( "View pictures" ), this );
    a_pview->setIcon(picViewIcon);
    connect( a_pview, SIGNAL(triggered()), this, SLOT(viewPictures()) );

    a_timer = new QAction( QIcon( ":icon/wait" ) , tr("Timer"), this );
    connect( a_timer, SIGNAL(triggered()), this, SLOT(takePhotoTimer()) );

    if(camera->videocaptureview->available())
    {
        a_settings = new QAction( QIcon( ":icon/settings" ) , tr("Settings..."), this );
        connect( a_settings, SIGNAL(triggered()), this, SLOT(doSettings()) );
    }

    a_th_edit = new QAction( QIcon(":icon/edit"), tr("Edit"), this );
    connect( a_th_edit, SIGNAL(triggered()), this, SLOT(editThumb()) );
    a_th_del = new QAction( QIcon(":icon/trash"), tr("Delete"), this );
    connect( a_th_del, SIGNAL(triggered()), this, SLOT(delThumb()) );
    a_th_add = new QAction( QIcon(":image/addressbook/AddressBook"), tr("Save to Contact..."), this );
    connect( a_th_add, SIGNAL(triggered()), this, SLOT(moveToContact()) );
    a_send = new QAction( QIcon( ":icon/beam" ), tr("Send to Contact..."), this );
    connect( a_send, SIGNAL(triggered()), this, SLOT(sendFile()) );

    a_zoom = new QAction( QIcon( ), tr("Zoom"), this);
    connect(a_zoom, SIGNAL(triggered()), this, SLOT(showZoom()));
    m_zoom = new QSlider(this);
    m_zoom->setSliderPosition(50);
    m_zoom->setOrientation(Qt::Horizontal);

    m_zoom->setRange(camera->videocaptureview->minZoom(),camera->videocaptureview->maxZoom());
    m_zoom->setValue(0);
    m_zoom->setGeometry(width()*1/5, height()*2/3, 60*width()/100, 40*height()/100);
    m_zoom->hide();

    connect(m_zoom, SIGNAL(valueChanged(int)), this, SLOT(zoomChanged(int)));

    QMenu *contextMenu = QSoftMenuBar::menuFor(this);
    if(camera->videocaptureview->available())
    {
        contextMenu->addAction( a_pview );
        if ( video_supported )
            contextMenu->addAction( a_vview );
        contextMenu->addAction( a_th_edit );
        contextMenu->addAction( a_th_del );
        contextMenu->addAction( a_th_add );
        contextMenu->addAction( a_timer );
        contextMenu->addAction( a_send );
        contextMenu->addAction( a_settings );
        contextMenu->addAction( a_zoom );
    }

    connect(contextMenu, SIGNAL(aboutToHide()),
            this, SLOT(contextMenuAboutToHide()));
    connect(contextMenu, SIGNAL(aboutToShow()),
            this, SLOT(contextMenuAboutToShow()));

    QSignalMapper* sm = new QSignalMapper(this);
    for (int i=0; i<nthumb; i++) {
        sm->setMapping(thumb[i],i);
        connect(thumb[i],SIGNAL(clicked()),sm,SLOT(map()));
        thumb[i]->installEventFilter(this);
    }
    connect(sm,SIGNAL(mapped(int)),this,SLOT(thumbClicked(int)));

    installEventFilter(camera->photo);
    installEventFilter(camera->video);
    camera->photo->installEventFilter(this);
    camera->video->installEventFilter(this);

    loadThumbs();
    preview();
}