Ejemplo n.º 1
0
void WaitWidget::setupScene()
{
	// Creamos el objeto efecto
	d->m_effect = new QGraphicsOpacityEffect;
	d->m_effect->setOpacity(0);
	d->m_effect->setEnabled(true);

	// Ahora creamos los proxys para gráficos que nos permita incluirlos en la escena
	QGraphicsProxyWidget *pFrame = d->m_scene.addWidget(d->m_widget);
	pFrame->resize(d->m_widget->width(), d->m_widget->height());

	// Y lo agregamos a un layout gráfico
	QGraphicsLinearLayout *gLayout = new QGraphicsLinearLayout;
	gLayout->setOrientation(Qt::Vertical);
	gLayout->addItem(pFrame);

	// Creamos finalmente un objeto gráfico que lo contiene todo, y lo agregamos a la escena
	QGraphicsWidget *form = new QGraphicsWidget;
	form->setLayout(gLayout);
	form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	d->m_scene.addItem(form);

	// Agregamos el efecto de opacidad al aparecer
	form->setGraphicsEffect(d->m_effect);
	form->resize(d->m_widget->width(), d->m_widget->height());
}
Ejemplo n.º 2
0
FmDriveQuery::FmDriveQuery( QGraphicsItem *parent ) : FmDialog( parent )
{
    setObjectName( "driveQueryDialog" );
	mContentWidget = new QGraphicsWidget();
	mContentWidget->setObjectName( "driveQueryContentWidget" );
	setContentWidget(mContentWidget);

	QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
    vLayout->setOrientation( Qt::Vertical );

    mListView = new HbListView();
    mListView->setObjectName( "driveQueryListView" );
	vLayout->addItem( mListView );

	mListView->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );

	this->setTimeout( NoTimeout );
	mContentWidget->setLayout( vLayout );

	connect( mListView, SIGNAL( activated  ( const QModelIndex& ) ), this, SLOT( activated( const QModelIndex& ) ) );
    this->setDismissPolicy( NoDismiss );

    
    mDriveModel = new FmDriveModel( this, 
            FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume, this );
    mListView->setModel( mDriveModel );
    
    // connect refreshModel signal of viewmanager  for drive insert/remove event.
    connect( FmViewManager::viewManager(), SIGNAL( refreshModel( QString ) ), 
            this, SLOT( refreshModel( QString ) ) );
}
void ponycountdownplasma::show_thirdrow()
{
    QGraphicsLinearLayout *thirdrow = new QGraphicsLinearLayout();
    
    m_label_ep = new Plasma::Label;
    m_label_name = new Plasma::Label;
    m_label_season = new Plasma::Label;
  
    //Setting text for label of third row. 
    m_label_season->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
    m_label_season->setText(i18n("Season №%1", info("season")));
    
    m_label_name->setAlignment(Qt::AlignCenter);
    m_label_name->setText(i18n("Episode Name: %1", info("name")));
    
    m_label_ep->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    m_label_ep->setText(i18n("Episode №%1", info("episode")));
    
    
    layout->addItem(thirdrow, 3, 1, 1, 4);
    layout->setAlignment(thirdrow, Qt::AlignTop);
    //layout->setRowMaximumHeight(3, 12);
    
    thirdrow->setOrientation(Qt::Horizontal);
    thirdrow->addItem(m_label_season);
    thirdrow->addItem(m_label_name);
    thirdrow->addItem(m_label_ep);
}
/*!
    creates the heading wiget elements that include
    a label for showing the current path and a push button for
    going to the parent directory.
*/
void FmFileDialogPrivate::createHeadingWidget()
{
    mHeadingWidget = new HbWidget( mFileDialog );
    mHeadingWidget->setObjectName( "headingWidget" ); 

    QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout;
    headingLayout->setOrientation(Qt::Horizontal);
    mHeadingWidget->setLayout(headingLayout);
    

    QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout;
    titleLayout->setOrientation(Qt::Vertical);    

    mTitleLabel = new HbLabel();
    mTitleLabel->setObjectName( "titleLabel" );
    if( mArgs.mTitle.isEmpty() ){
        mTitleLabel->setPlainText( QString( FmPlaceholderString ) );
    } else {
        mTitleLabel->setPlainText( mArgs.mTitle );
    }

    mCurrentPathLabel = new HbLabel( QString( FmPlaceholderString ) );
    mCurrentPathLabel->setObjectName( "currentPathLabel" );
    mCurrentPathLabel->setElideMode(Qt::ElideRight);

    mUpButton  = new HbPushButton;
    mUpButton->setObjectName( "upButton" );
    mUpButton->setIcon(HbIcon(backButtonIcon));

    titleLayout->addItem( mTitleLabel );
    titleLayout->setAlignment( mTitleLabel, Qt::AlignLeft);

    titleLayout->addItem( mCurrentPathLabel );
    titleLayout->setAlignment( mCurrentPathLabel, Qt::AlignLeft);

    headingLayout->addItem(titleLayout);
    headingLayout->addItem( mUpButton ) ;
    headingLayout->setAlignment(mUpButton,Qt::AlignRight);

    mFileDialog->setHeadingWidget( mHeadingWidget );
}
void FmRestoreWigdet::init()
{
    QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
    vLayout->setOrientation( Qt::Vertical );

    mListView = new HbListView( this );
    connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
             this, SLOT( on_list_activated( const QModelIndex & ) ) );

    mListView->setSelectionMode( HbAbstractItemView::MultiSelection );

    vLayout->addItem( mListView );

    mModel = new QStringListModel();
    mListView->setModel( mModel );    
    mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL();
    mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader();
    
    // load backup settings to refresh default target drive
    FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL()->load();
    mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() );

    int index = 0;

    QList< FmRestoreEntry* > retoreEntryList = mRestoreSettings->restoreEntryList();
    mModel->insertRows( 0, retoreEntryList.count() );

    for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); 
         it != retoreEntryList.end(); ++it ){
             QString string = ( *it )->text();
             QDateTime datetime = ( *it )->restoreInfo().dateTime();
             string.append( '\t' );
             string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") );
             QString drive = ( *it )->restoreInfo().drive();             
             string.append( '\t' );
             string.append( drive );
             QVariant variant( string );

             mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );

             ++index;
    }

    mListView->setItemPrototype( new FmRestoreViewItem(this) );
}
Ejemplo n.º 6
0
FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent )
{
    setObjectName( "timeQueryDialog" );
    mContentWidget = new QGraphicsWidget();
	setContentWidget(mContentWidget);
	mContentWidget->setObjectName( "timeQueryContentWidget" );
	QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
    vLayout->setOrientation( Qt::Vertical );

    mTimeWidget = new HbDateTimePicker();
    mTimeWidget->setObjectName( "timeQueryTimeWidget" );
	vLayout->addItem( mTimeWidget );

    mTimeWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
    mTimeWidget->setDisplayFormat( "hh:mm" );
    mTimeWidget->setDateTime( QDateTime::currentDateTime() );

	this->setTimeout( NoTimeout );
	mContentWidget->setLayout( vLayout );
}
Ejemplo n.º 7
0
void ActivityManager::initExtenderItem(Plasma::ExtenderItem *item) {
  // create the widget
  QGraphicsWidget *widget = new QGraphicsWidget(this);
  // TODO: use the size of the longest activity name
  widget->setPreferredWidth(350);
  // create the layout
  QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget);
  layout->setOrientation(Qt::Vertical);
  widget->setLayout(layout);
  // set up the widget
  item->setWidget(widget);
  // create a lock/unlock action
  toggleLockAction = new QAction(item);
  toggleLockAction->setIcon(KIcon("object-locked"));
  toggleLockAction->setEnabled(true);
  toggleLockAction->setVisible(true);
  toggleLockAction->setToolTip(i18n("Activities are unlocked. Click to lock."));
  item->addAction("toggleLock", toggleLockAction);
  connect(toggleLockAction, SIGNAL(triggered()), this, SLOT(toggleLock()));
}
void FmDeleteBackupWidget::init()
{    
    QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
    vLayout->setOrientation( Qt::Vertical );

    mListView = new HbListView( this );
    connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
             this, SLOT( on_list_activated( const QModelIndex & ) ) );

    mListView->setSelectionMode( HbAbstractItemView::MultiSelection );

    vLayout->addItem( mListView );

    loadData();
    mListView->setModel( mModel );

    mListView->setItemPrototype( new FmRestoreViewItem( this ) );
   

}
void FmFileDialogPrivate::createBottomWidget()
{
    if( mArgs.mDialogMode == GetDirMode ) {
        return;
    }
    HbWidget *bottomWidget = new HbWidget( mContentWidget );
    bottomWidget->setObjectName( "bottomWidget" );
    mContentLayout->addItem( bottomWidget );

    QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout;
    bottomLayout->setOrientation( Qt::Horizontal );

    mFileNameTitleLabel = new HbLabel( mFileDialog->tr( "file name:" ), bottomWidget );
    mFileNameTitleLabel->setObjectName( "fileNameTitleLabel" );
    bottomLayout->addItem( mFileNameTitleLabel );

    mFileNameLineEdit = new HbLineEdit( bottomWidget );
    mFileNameLineEdit->setObjectName( "fileNameLineEdit" );
    bottomLayout->addItem( mFileNameLineEdit );    

    bottomWidget->setLayout( bottomLayout );

}
Ejemplo n.º 10
0
void FmFileView::initMainWidget()
{
	QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
	vLayout->setOrientation( Qt::Vertical );

	mWidget = new FmFileBrowseWidget( this );
	mWidget->setObjectName( "mainWidget" );
	setStyle( FmFileBrowseWidget::ListStyle );
	setSelectable( false );

	vLayout->addItem( mWidget );
	//set stretch factor to file browser widget, so that it could fully cover the client area.
	vLayout->setStretchFactor( mWidget, 1 );

	setLayout( vLayout );
	
    connect( mWidget, SIGNAL( startSearch( QString ) ),
             this, SLOT( startSearch( QString ) ) );
    connect( mWidget, SIGNAL( setEmptyMenu( bool ) ),
             this, SLOT( on_mainWidget_setEmptyMenu( bool ) ) );
    connect( mWidget, SIGNAL( setTitle( QString ) ),
             this, SLOT( on_mainWidget_setTitle( QString ) ) );
}
static PyObject *meth_QGraphicsLinearLayout_setOrientation(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        Qt::Orientation a0;
        QGraphicsLinearLayout *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BE", &sipSelf, sipType_QGraphicsLinearLayout, &sipCpp, sipType_Qt_Orientation, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp->setOrientation(a0);
            Py_END_ALLOW_THREADS

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QGraphicsLinearLayout, sipName_setOrientation, NULL);

    return NULL;
}
void FmSingleTextQuery::init()
{
    setObjectName( "SingleTextQuery " );
    setDismissPolicy( HbPopup::NoDismiss );
    mContentWidget = new HbWidget();
    mContentWidget->setObjectName( "SingleTextContentWidget" );
    setContentWidget( mContentWidget );
	

    QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
    vLayout->setOrientation( Qt::Vertical );

    mTextEdit = new HbLineEdit();
    mTextEdit->setEchoMode( mEchoMode );
    mTextEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
    mTextEdit->setObjectName( "textLineEdit" );
	vLayout->addItem( mTextEdit );

    mContentWidget->setLayout( vLayout );

    setTimeout( NoTimeout );

    connect( mTextEdit, SIGNAL(contentsChanged()), this, SLOT(checkActions()) );
}
Ejemplo n.º 13
0
Archivo: options.cpp Proyecto: f0x/kcd
Options::Options(QGraphicsWidget *parent)
    : QGraphicsWidget(parent),
     // m_volume(new Plasma::IconWidget(this)),
      //m_meter(new KcdMeter(this)),
      //m_tracklist(new Plasma::IconWidget(this)),
      m_albumText(new Plasma::Label(this)),
      m_random(new Plasma::IconWidget(this)),
      m_loop(new Plasma::IconWidget(this))
{
 
   //m_volume->setIcon("audio-volume-high");
   //connect (m_volume, SIGNAL(clicked()), this, SLOT(handleVolume()));
   //m_volume->setMinimumSize(m_random->sizeFromIconSize(10));

   //m_meter->setMinimum(0);
   //m_meter->setMaximum(10);
   //m_meter->setMeterType(Plasma::Meter::BarMeterHorizontal);
   //connect (m_meter, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int)));

   //m_tracklist->setIcon("format-list-unordered");
   //m_tracklist->setMinimumSize(m_random->sizeFromIconSize(10));
   //connect(m_tracklist, SIGNAL(clicked()), this, SIGNAL(showTrackList()));

   Plasma::ToolTipContent data;
   //data.setMainText(i18n("Tracklist"));
   //data.setSubText(i18n("View the tracklist"));
   //data.setImage(KIcon("format-list-unordered").pixmap(IconSize(KIconLoader::Desktop)));
   //Plasma::ToolTipManager::self()->setContent(m_tracklist, data);

   m_random->setIcon("roll");
   connect(m_random, SIGNAL(clicked()), this, SLOT(randomTrack()));
   
   data.setMainText(i18n("Random - off"));
   data.setSubText(i18n("Play random track"));
   data.setImage(KIcon("roll").pixmap(IconSize(KIconLoader::Desktop)));
   Plasma::ToolTipManager::self()->setContent(m_random, data);

   m_loop->setIcon("object-rotate-right");
   connect(m_loop, SIGNAL(clicked()), this, SLOT(loopList()));

   data.setMainText(i18n("Repeat - off"));
   data.setSubText(i18n("Play again the tracklist"));
   data.setImage(KIcon("object-rotate-right").pixmap(IconSize(KIconLoader::Desktop)));
   Plasma::ToolTipManager::self()->setContent(m_loop, data);

   QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
   layout->setOrientation(Qt::Horizontal);
   //layout->addItem(m_volume);
   //layout->addItem(m_meter);
   layout->addItem(m_albumText);
   layout->addItem(m_random);
   layout->addItem(m_loop);
   layout->setAlignment(m_albumText, Qt::AlignLeft);
   layout->setAlignment(m_random, Qt::AlignRight);
   layout->setAlignment(m_loop, Qt::AlignRight);
   layout->setStretchFactor(m_random, 0);
   layout->setStretchFactor(m_loop, 0);
   setPreferredHeight(35);
   
   //layout->setItemSpacing(0, 50);
  
  
   //layout->addItem(m_tracklist);
   //layout->setStretchFactor(m_meter, 20);
   //layout->setSpacing(0);
   //layout->setAlignment(m_random, Qt::AlignRight);
   //layout->setAlignment(m_loop, Qt::AlignRight);
   //layout->setAlignment(m_tracklist, Qt::AlignRight);
   //layout->setItemSpacing(1, 10);
   setLayout(layout);

   randomFlag = false;
   loopFlag = false;
   //volumeFlag = true;

   
}
Ejemplo n.º 14
0
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
    : QGraphicsWidget(parent),
      d(new Private(this))
{
    setAcceptHoverEvents(true);

//     d->model = new Kickoff::ApplicationModel(this);
//     d->model->init();
    if (!Nepomuk::ResourceManager::instance()->init()) {
        kDebug() << "f*****g nepomuk never dies";
        d->model = new Raptor::NepomukModel(this);
    } else {
        KNotification::event(KNotification::Error, i18n("Nepomuk is not running. Falling back to useless mode!!!"));
        d->model = new Kickoff::ApplicationModel(this);
        qobject_cast<Kickoff::ApplicationModel*>(d->model)->init();
    }
    d->searchModel = new Kickoff::SearchModel();
    d->favoritesModel = new Kickoff::FavoritesModel(this);

    d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
    d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->view->setModel(d->model);

//     d->view = new RaptorItemsView();
//     RaptorItemDelegate *delegate = new RaptorItemDelegate();

    d->breadCrumb = new Breadcrumb(d->view, this);
    d->searchLine = new Plasma::LineEdit(this);
    d->favoritesIcon = new Plasma::IconWidget(this);
    d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->favoritesIcon->setIcon(KIcon("rating"));
    //d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    d->appletConfig = appletconfig;

    QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
    horizontalLayout->addItem(d->breadCrumb);
    horizontalLayout->addStretch();
    horizontalLayout->addItem(d->favoritesIcon);
    horizontalLayout->addItem(d->searchLine);
    
    horizontalLayout->setMaximumHeight(Plasma::Theme::defaultTheme()->fontMetrics().height() + 2 * 2);//Set height to font height + some more spaces

    verticalLayout->addItem(horizontalLayout);
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
    layout->setOrientation(Qt::Horizontal);

    layout->addItem(d->view);

    verticalLayout->addItem(layout);

    setLayout(verticalLayout);
// 
//     delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
// 
//     // let's make the view nicer in the applet
//     d->view->setAttribute(Qt::WA_NoSystemBackground);
//     d->view->viewport()->setAutoFillBackground(true);
//     QPalette p = d->view->viewport()->palette();
//     p.setColor(QPalette::Base, Qt::transparent);
//     d->view->viewport()->setPalette(p);
// 
//     d->view->setModel(d->model);
//     d->view->setItemDelegate(delegate);
// 
//     d->view->hideScrollBars();
// 

    KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
    KConfigGroup conf(&config, "Plugins");

    conf.writeEntry("servicesEnabled", true);

    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");

    foreach (const KService::Ptr &service, offers) {
        KPluginInfo description(service);
        QString runnerName = description.pluginName();

        if (runnerName != "services")
        {
            conf.writeEntry(QString(runnerName + "Enabled"), false);
        }
    }
Ejemplo n.º 15
0
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
    : QGraphicsWidget(parent),
      d(new Private(this))
{
    setAcceptHoverEvents(true);

    d->model = new Kickoff::ApplicationModel(this);
    d->model->init();
    d->searchModel = new Kickoff::SearchModel();
    d->favoritesModel = new Kickoff::FavoritesModel(this);

    d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
    d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->view->setModel(d->model);

    d->leftScrollButton = new RaptorScrollButton(RaptorScrollButton::Left, this);
//     d->view = new RaptorItemsView();
//     RaptorItemDelegate *delegate = new RaptorItemDelegate();

    d->breadCrumb = new Breadcrumb(d->view, this);
    d->searchLine = new Plasma::LineEdit(this);
    d->favoritesIcon = new Plasma::IconWidget(this);
    d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->favoritesIcon->setIcon(KIcon("rating"));
    //d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    d->rightScrollButton = new RaptorScrollButton(RaptorScrollButton::Right, this);
    d->appletConfig = appletconfig;

    QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);

    QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
    horizontalLayout->addItem(d->breadCrumb);
    horizontalLayout->addStretch();
    horizontalLayout->addItem(d->favoritesIcon);
    horizontalLayout->addItem(d->searchLine);

    verticalLayout->addItem(horizontalLayout);
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
    layout->setOrientation(Qt::Horizontal);

    connect(d->leftScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollLeft()));
    layout->addItem(d->leftScrollButton);

    layout->addItem(d->view);

    connect(d->rightScrollButton, SIGNAL(clicked()), d->view, SLOT(scrollRight()));
    layout->addItem(d->rightScrollButton);

    verticalLayout->addItem(layout);

    setLayout(verticalLayout);
// 
//     delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
// 
//     // let's make the view nicer in the applet
//     d->view->setAttribute(Qt::WA_NoSystemBackground);
//     d->view->viewport()->setAutoFillBackground(true);
//     QPalette p = d->view->viewport()->palette();
//     p.setColor(QPalette::Base, Qt::transparent);
//     d->view->viewport()->setPalette(p);
// 
//     d->view->setModel(d->model);
//     d->view->setItemDelegate(delegate);
// 
//     d->view->hideScrollBars();
// 
//     d->proxy = new QGraphicsProxyWidget(this);
//    d->proxy->setWidget(d->view);

    KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
    KConfigGroup conf(&config, "Plugins");

    conf.writeEntry("servicesEnabled", true);

    KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");

    foreach (const KService::Ptr &service, offers) {
        KPluginInfo description(service);
        QString runnerName = description.pluginName();

        if (runnerName != "services")
        {
            conf.writeEntry(QString(runnerName + "Enabled"), false);
        }
    }