Exemple #1
0
Bubble::Bubble(QObject *parent, const QVariantList &args)
    :  Plasma::Applet(parent, args),
       m_showText(false),
       m_animated(true),
       m_val(0),
       m_max(0),
       m_speed(1000),
       m_bubbles(20),
       m_bubbleCount(0),
       m_labelTransparency(0),
       m_rebuildClip(true)
{
    m_svg = new Plasma::Svg(this);
    m_svg->setImagePath(Plasma::Theme::defaultTheme()->imagePath("bubblemon/bubble"));

    connect(m_svg, SIGNAL(repaintNeeded()), this, SLOT(repaintNeeded()));

    setAcceptHoverEvents(true);
    setAspectRatioMode(Plasma::Square);
    setBackgroundHints(NoBackground);
    
    m_animation = new QPropertyAnimation(this, "labelTransparency", this);
    m_animation->setDuration(200);
    m_animation->setStartValue(0.0);
    m_animation->setEndValue(1.0);
}
KeyboardApplet::KeyboardApplet(QObject *parent, const QVariantList &args):
    Plasma::Applet(parent, args),
    xEventNotifier(),
    rules(Rules::readRules(Rules::READ_EXTRAS)),
    keyboardConfig(new KeyboardConfig()),
    layoutsMenu(new LayoutsMenu(*keyboardConfig, *rules, flags))
{
    if( ! X11Helper::xkbSupported(NULL) ) {
        setFailedToLaunch(true, i18n("XKB extension failed to initialize"));
        return;
    }

    m_svg = new Plasma::Svg(this);
    m_svg->setImagePath("widgets/labeltexture");
    m_svg->setContainsMultipleImages(true);
    resize(48,48);

    setHasConfigurationInterface(false);

    setAspectRatioMode(Plasma::KeepAspectRatio);
    //setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
    setBackgroundHints(DefaultBackground);
    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(themeChanged()));

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.connect(QString(), KEYBOARD_DBUS_OBJECT_PATH, KEYBOARD_DBUS_SERVICE_NAME, KEYBOARD_DBUS_CONFIG_RELOAD_MESSAGE, this, SLOT(configChanged()));
}
Exemple #3
0
void IconApplet::init()
{
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);

    layout->addItem(m_icon);

    KConfigGroup cg = config();

    if (m_url.isValid()) {
        // we got this in via the ctor, e.g. as a result of a drop
        cg.writeEntry("Url", m_url);
        emit configNeedsSaving();
    } else {
        configChanged();
    }

    setDisplayLines(2);
    registerAsDragHandle(m_icon);
    setAspectRatioMode(Plasma::ConstrainedSquare);

    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
        this, SLOT(iconSizeChanged(int)));
}
void GameConsole::applyPendingPropertyChanges() {
    if( !pendingPropertyChanges.isEmpty() ) {
        qCDebug( phxControl ) << "Applying pending property changes";
    }

    // Call each setter again if a pending change was set
    if( pendingPropertyChanges.contains( "aspectRatioMode" ) ) {
        setAspectRatioMode( pendingPropertyChanges[ "aspectRatioMode" ].toInt() );
    }

    if( pendingPropertyChanges.contains( "playbackSpeed" ) ) {
        setPlaybackSpeed( pendingPropertyChanges[ "playbackSpeed" ].toReal() );
    }

    if( pendingPropertyChanges.contains( "source" ) ) {
        setSource( pendingPropertyChanges[ "source" ].toMap() );
    }

    if( pendingPropertyChanges.contains( "volume" ) ) {
        setVolume( pendingPropertyChanges[ "volume" ].toReal() );
    }

    if( pendingPropertyChanges.contains( "vsync" ) ) {
        setVsync( pendingPropertyChanges[ "vsync" ].toBool() );
    }

    pendingPropertyChanges.clear();
}
Exemple #5
0
Clock::Clock(QObject *parent, const QVariantList &args)
    : ClockApplet(parent, args),
      m_showSecondHand(false),
      m_showTimezoneString(false),
      m_showingTimezone(false),
      m_tzFrame(0),
      m_repaintCache(RepaintAll),
      m_faceCache(QPixmap()),
      m_handsCache(QPixmap()),
      m_glassCache(QPixmap()),
      m_secondHandUpdateTimer(0),
      m_animateSeconds(false)
{
    KGlobal::locale()->insertCatalog("libplasmaclock");
    // this catalog is only used once on the first start of the clock to translate the timezone in the configuration file
    KGlobal::locale()->insertCatalog("timezones4");
    setHasConfigurationInterface(true);
    resize(256, 256);
    setAspectRatioMode(Plasma::Square);
    setBackgroundHints(NoBackground);

    m_theme = new Plasma::Svg(this);
    m_theme->setImagePath("widgets/clock");
    m_theme->setContainsMultipleImages(true);
    m_theme->resize(size());

    connect(m_theme, SIGNAL(repaintNeeded()), this, SLOT(repaintNeeded()));
}
WindowList::WindowList(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args)
{
    setAspectRatioMode(Plasma::ConstrainedSquare);

    const int iconSize = IconSize(KIconLoader::Desktop);
    resize((iconSize * 2), (iconSize * 2));
}
Exemple #7
0
/**
 * Loads a "statewidget" XMI element.
 */
bool StateWidget::loadFromXMI(QDomElement & qElement)
{
    if(!UMLWidget::loadFromXMI(qElement))
        return false;
    m_Text = qElement.attribute(QLatin1String("statename"));
    m_Doc = qElement.attribute(QLatin1String("documentation"));
    QString type = qElement.attribute(QLatin1String("statetype"), QLatin1String("1"));
    m_stateType = (StateType)type.toInt();
    setAspectRatioMode();
    QString drawVertical = qElement.attribute(QLatin1String("drawvertical"), QLatin1String("1"));
    m_drawVertical = (bool)drawVertical.toInt();
    //load states activities
    QDomNode node = qElement.firstChild();
    QDomElement tempElement = node.toElement();
    if(!tempElement.isNull() && tempElement.tagName() == QLatin1String("Activities")) {
        QDomNode node = tempElement.firstChild();
        QDomElement activityElement = node.toElement();
        while(!activityElement.isNull()) {
            if(activityElement.tagName() == QLatin1String("Activity")) {
                QString name = activityElement.attribute(QLatin1String("name"));
                if(!name.isEmpty())
                    m_Activities.append(name);
            }//end if
            node = node.nextSibling();
            activityElement = node.toElement();
        }//end while
    }//end if
    return true;
}
void IGraphicsItem::restoreDefaultSize()
{
    setAspectRatioMode(Qt::KeepAspectRatio);
    setSize(nativeSize());
    update();
    updatePos();
}
Exemple #9
0
ActivityBar::ActivityBar(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
      m_engine(0)
{
    resize(200, 60);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
}
Exemple #10
0
Paste::Paste(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args), m_list(0), m_snippetConfig(0)
{
    setHasConfigurationInterface(true);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    resize(200, 300);
    setPopupIcon("edit-paste");
}
Exemple #11
0
/**
 * Creates a State widget.
 *
 * @param scene       The parent of the widget.
 * @param stateType   The type of state.
 * @param id          The ID to assign (-1 will prompt a new ID.)
 */
StateWidget::StateWidget(UMLScene * scene, StateType stateType, Uml::ID::Type id)
  : UMLWidget(scene, WidgetBase::wt_State, id)
{
    m_stateType = stateType;
    m_drawVertical = true;
    setAspectRatioMode();
    m_Text = QLatin1String("State");
    QSizeF size = minimumSize();
    setSize(size.width(), size.height());
}
Exemple #12
0
void XbmcremoteApplet::constraintsEvent(Plasma::Constraints constraints)
{
    // update the pixmap when a new size from kiconloader fits in, this makes sure the
    // icon is only displayed in sizes provides by KIconLoader, so we don't get blurry
    // icons
    if (constraints & (Plasma::SizeConstraint | Plasma::FormFactorConstraint)) {
        setAspectRatioMode(Plasma::Square);
        update();
    }
}
Exemple #13
0
Luna::Luna(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
      counter(-1),
      m_theme(0)
{
    setHasConfigurationInterface(true);
    setAspectRatioMode(Plasma::Square);
    setBackgroundHints(Plasma::Applet::NoBackground);
    resize(QSize(82, 82));
}
Exemple #14
0
KateSessionApplet::KateSessionApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args), m_listView( 0 ), m_config(0)
{
    KDirWatch *dirwatch = new KDirWatch( this );
    QStringList lst = KGlobal::dirs()->findDirs( "data", "kate/sessions/" );
    for ( int i = 0; i < lst.count(); i++ )
    {
        dirwatch->addDir( lst[i] );
    }
    connect( dirwatch, SIGNAL(dirty(QString)), this, SLOT(slotUpdateSessionMenu()) );
    setPopupIcon( "kate" );
    setHasConfigurationInterface(true);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
}
Exemple #15
0
SpellCheck::SpellCheck(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
       m_textEdit(NULL),
       m_spellingDialog(NULL),
       m_dictionaryComboBox(NULL),
       m_dragTimer(0)
{
    KGlobal::locale()->insertCatalog("spellcheck");
    setAspectRatioMode(Plasma::ConstrainedSquare);
    setAcceptDrops(true);

    const int iconSize = KIconLoader::SizeSmallMedium;
    resize(iconSize, iconSize);
}
Exemple #16
0
TodoApplet::TodoApplet(QObject *parent, const QVariantList &args) :
    Plasma::PopupApplet(parent, args),
    m_engine(0),
    m_types(0),
    m_error(0),
    m_proxyWidget(0),
    m_widget(0),
    m_view(0),
    m_configUi()
{
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(true);

    setPopupIcon("view-pim-tasks");
}
ITmagesApplet::ITmagesApplet(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args)
{
  // load translation
  if (QLocale::system().name().contains(QRegExp("ru"))) {
    QTranslator *translator = new QTranslator;
    translator->load("/usr/share/itmages/itmages-plasma-applet-ru");
    qApp->installTranslator(translator);
  }

  setAcceptDrops(true);
  setAspectRatioMode(Plasma::ConstrainedSquare);
  setBackgroundHints(DefaultBackground);
  resize(150,150);
}
KdeObservatory::KdeObservatory(QObject *parent, const QVariantList &args)
: Plasma::PopupApplet(parent, args),
  m_mainContainer(0),
  m_currentView(0),
  m_viewTransitionTimer(new QTimer(this)),
  m_transitionTimer(new QTimeLine(500, this)),
  m_engine(0),
  m_service(0)
{
    setBackgroundHints(DefaultBackground);
    setHasConfigurationInterface(true);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    resize(300, 200);

    connect(m_transitionTimer, SIGNAL(finished()), this, SLOT(timeLineFinished()));
    connect(m_viewTransitionTimer, SIGNAL(timeout()), this, SLOT(moveViewRight()));
}
ponycountdownplasma::ponycountdownplasma(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
    m_svg(this), 
    m_label_ep(0), m_label_name(0), m_label_season(0),
    m_label_day_est(0), m_label_hour_est(0), m_label_min_est(0), m_label_sec_est(0)
{
    // this will get us the standard applet background, for free!
    setBackgroundHints(DefaultBackground);
    m_svg.setImagePath("widgets/background");
    setHasConfigurationInterface(false);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    
    m_font.setPixelSize(24);
    
    resize(500, 150);
    
}
void NowPlaying::layoutPlanar()
{
    if (m_currentLayout != PlanarLayout)
    {
        setAspectRatioMode(Plasma::IgnoreAspectRatio);
        setMinimumSize(200, 100);

        Plasma::ToolTipManager::self()->unregisterWidget(this);

        QGraphicsGridLayout* layout = new QGraphicsGridLayout();
        m_textPanel->show();
        layout->addItem(m_textPanel, 0, 0);

        setLayout(layout);

        m_currentLayout = PlanarLayout;
    }
}
MToolsWidgetAbstract::MToolsWidgetAbstract(bool using_longtap, QGraphicsObject *parent):
    MImageWidget(parent)
{
    setMaximumSize(64,64);
    setMinimumSize(64,64);
    setAspectRatioMode(Qt::KeepAspectRatio);

    feedback_press = new MFeedback("priority2_static_press", this);
    feedback_release = new MFeedback("priority2_static_release", this);
    feedback_long = new MFeedback("priority2_grab", this);

    GConfItem *theme = new GConfItem("/meegotouch/theme/CurrentMeegoTheme", this);
    currentTheme = theme->value("blanco").toString();
    theme->deleteLater();

    if (using_longtap)
        grabGesture(Qt::TapAndHoldGesture);
}
Exemple #22
0
WicdApplet::WicdApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      m_theme(0),
      m_plotter(0)
{
    KGlobal::locale()->insertCatalog("wicd-kde");
    
    Wicd::locate();
    setHasConfigurationInterface(false);
    setAspectRatioMode(Plasma::ConstrainedSquare);
    setPopupIcon(QIcon());
    setStatus(Plasma::ActiveStatus);
    m_theme = new Plasma::Svg(this);
    m_theme->setImagePath("icons/network");
    m_theme->setContainsMultipleImages(true);
    
    // this will get us the standard applet background, for free!
    setBackgroundHints(DefaultBackground);
}
EmergingPlasmoid::EmergingPlasmoid(QObject * parent, const QVariantList & args)
  : Plasma::Applet(parent, args)
  , gentooLogoLabel(this)
  , currentJobMeter(this)
  , totalJobMeter(this)
  , layout(NULL)
  , currentJobName("Nothing being emerged")
  , targetJobCount(0)
  , currentJobCount(0)
  , secondsUntilGiveUp(0)
  , configDialog(NULL) {
  setBackgroundHints(DefaultBackground);
  gentooLogoLabel.setImage(KStandardDirs::locate("data", "emerging-plasmoid/glogo-small.png"));
  setHasConfigurationInterface(true);
  connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
  updateTimer.start(1000); // every 1sec
  connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(themeChanged()));
  setAspectRatioMode(Plasma::IgnoreAspectRatio);
}
GraphicalTimetableLine::GraphicalTimetableLine(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args), m_stopWidget(0), m_vehicleTypeModel(0),
    m_showTimetableCheckbox(0), m_drawTransportLineCheckbox(0),
    m_zoomInButton(0), m_zoomOutButton(0), m_title(0), m_departureView(0), m_svg(this)
{
    m_animate = true;

    // this will get us the standard applet background, for free!
    setBackgroundHints(DefaultBackground);
    m_svg.setImagePath( KGlobal::dirs()->findResource("data", "plasma_applet_graphicaltimetableline/vehicles.svg") );
    m_svg.setContainsMultipleImages( true );

    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(true);
    resize( 400, 250 );
    setMinimumHeight( 125 );

    QRectF rect = contentsRect();
    m_timelineStart = QPointF( rect.left() + 0.1 * rect.width(), rect.top() + 0.75 * rect.height() );
    m_timelineEnd = QPointF( rect.right() - 0.05 * rect.width(), rect.top() + 0.18 * rect.height() );
}
Exemple #25
0
StackFolder::StackFolder(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      m_graphicsWidget(0),
      m_placesModel(0)
{
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(false);

    m_dirModel = new DirModel(this);

    m_model = new ProxyModel(this);
    m_model->setSourceModel(m_dirModel);
    m_model->setSortLocaleAware(true);
    m_model->setFilterCaseSensitivity(Qt::CaseInsensitive);

    m_selectionModel = new QItemSelectionModel(m_model, this);

    if (args.count() > 0) {
        m_url = KUrl(args.value(0).toString());
    }

    m_icon = KIcon("folder");
    setPopupIcon(m_icon);
}
batteryconsumption::batteryconsumption(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
    m_svg(this),
    m_icon("preferences-system-power-management")
{
  
    qDBusRegisterMetaType<Data>();
    qDBusRegisterMetaType<DataList>();
    qDBusRegisterMetaType<StatsList>();
    qDBusRegisterMetaType<Stats>();
  
    // m_svg.setImagePath( patrh immagine);
    setHasConfigurationInterface(false);
    setAspectRatioMode( Plasma::IgnoreAspectRatio );
    
    resize(250, 50);
    
    //Ti butto tutto quello che ti interessa in var
    upower=new OrgFreedesktopUPowerInterface(UPOWER_SERVICE,UPOWER_PATH,QDBusConnection::systemBus());
    devices=new QList<OrgFreedesktopUPowerDeviceInterface*>;
    QList<QDBusObjectPath> pl= upower->EnumerateDevices();
    foreach (QDBusObjectPath p ,pl){
      devices->append(new OrgFreedesktopUPowerDeviceInterface(UPOWER_SERVICE,p.path(),QDBusConnection::systemBus()));
    }
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
    Plasma::PopupApplet(parent, args),
    m_graphicsWidget(0),
    m_view(0),
    m_delegate(0),
    m_eventFormatConfig(),
    m_todoFormatConfig(),
    m_colorConfigUi(),
    m_timer(0),
    m_agentManager(0),
    m_openEventWatcher(0),
    m_addEventWatcher(0),
    m_addTodoWatcher(0)
{
    KGlobal::locale()->insertCatalog("libkcal");
    KGlobal::locale()->insertCatalog("eventapplet");
    setBackgroundHints(DefaultBackground);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(true);

    setPopupIcon("view-pim-tasks");

    Akonadi::ServerManager::start();
}
ActivityManager::ActivityManager(QObject *parent, const QVariantList &args): Plasma::PopupApplet(parent, args), toggleLockAction(0), m_currentName(""), m_currentIcon("") {
  setPopupIcon("preferences-activities");
  setAspectRatioMode(Plasma::IgnoreAspectRatio);
}
Exemple #29
0
/**
 * Sets the type of state.
 */
void StateWidget::setStateType(StateType stateType)
{
    m_stateType = stateType;
    setAspectRatioMode();
}