MToolFlashlight::MToolFlashlight(QGraphicsItem *parent):
    MWidget(parent),
    poskey(new GConfItem("/apps/system-ui-extensions/tools/flashlight/index")),
    statuskey(new GConfItem("/apps/system-ui-extensions/tools/flashlight/working"))
{
    setMaximumSize(64,64);
    setMinimumSize(64,64);

    icon_flash_on =  QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-flashlight-on.png");
    icon_flash_off = QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-flashlight-off.png");

    m_toggleicon = new MImageWidget(&icon_flash_off, this);
    m_toggleicon->setAspectRatioMode(Qt::KeepAspectRatio);
    m_toggleicon->setMaximumSize(64,64);
    m_toggleicon->setMinimumSize(64,64);

    fd = open("/dev/v4l-subdev10", O_RDWR | O_NONBLOCK, 0);

    flash_active = false;

    MFeedback* feedback1 = new MFeedback("priority2_static_press", this);
    connect(this, SIGNAL(pressed()), feedback1, SLOT(play()));
    MFeedback* feedback2 = new MFeedback("priority2_static_release", this);
    connect(this, SIGNAL(released()), feedback2, SLOT(play()));

    connect(poskey,
            SIGNAL(valueChanged()),
            SLOT(onIndexChanged()));
    connect(statuskey,
            SIGNAL(valueChanged()),
            SLOT(onStatusChanged()));
    index = poskey->value().toInt();
    status = statuskey->value().toBool();
}
Esempio n. 2
0
  PluginManagerWidget::PluginManagerWidget(QWidget *parent)
    : QWidget(parent)
    , m_ui(new Ui::PluginManagerWidget)
  {
    m_ui->setupUi(this);
    
    QStandardItemModel *model = new QStandardItemModel(this);
    for (const QString& name : PluginLoader::instance().availablePlugins())
    {
      model->appendRow(new QStandardItem(PluginLoader::instance().plugin(name)->icon(),
                                         name));
    }

    QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(model);
    
    model->sort(0, Qt::AscendingOrder);
    
    m_ui->PluginList->setModel(model);
    m_ui->PluginList->setItemDelegate(new PluginWidgetDelegate(m_ui->PluginList));
    m_ui->PluginList->setSelectionMode(QAbstractItemView::SingleSelection);
    m_ui->PluginList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    connect(m_ui->PluginList,
        SIGNAL(clicked(const QModelIndex&)),
        this,
        SLOT(onIndexChanged(const QModelIndex&)));
    
    const QModelIndex& index =model->index(0, 0);
    m_ui->PluginList->selectionModel()->select(index, QItemSelectionModel::Select);
    onIndexChanged(index);
  }
MToolReboot::MToolReboot(QGraphicsItem *parent):
    MWidget(parent),
    poskey(new GConfItem("/apps/system-ui-extensions/tools/reboot/index")),
    statuskey(new GConfItem("/apps/system-ui-extensions/tools/reboot/working"))
{
    setMaximumSize(64,64);
    setMinimumSize(64,64);

    icon_power_unloaded =  QImage("/usr/share/themes/blanco/meegotouch/icons/c.png");
    icon_power =  QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-power.png");

    m_toggleicon = new MImageWidget(&icon_power_unloaded, this);
    m_toggleicon->setAspectRatioMode(Qt::KeepAspectRatio);
    m_toggleicon->setMaximumSize(64,64);
    m_toggleicon->setMinimumSize(64,64);

    MFeedback* feedback1 = new MFeedback("priority2_static_press", this);
    connect(this, SIGNAL(pressed()), feedback1, SLOT(play()));
    MFeedback* feedback2 = new MFeedback("priority2_static_release", this);
    connect(this, SIGNAL(released()), feedback2, SLOT(play()));

    m_timer = new QTimer(this);
    m_timer->setInterval(500);
    connect(m_timer,
            SIGNAL(timeout()),
            SLOT(onTimer()));

    service = new GConfItem("/apps/system-ui-extensions/daemon/service");
//    connect(service,
//            SIGNAL(valueChanged()),
//            SLOT(onGConf()));
    onGConf();
    connect(poskey,
            SIGNAL(valueChanged()),
            SLOT(onIndexChanged()));
    connect(statuskey,
            SIGNAL(valueChanged()),
            SLOT(onStatusChanged()));
    index = poskey->value().toInt();
    status = statuskey->value().toBool();
}
MToolCellular::MToolCellular(QGraphicsItem *parent):
    MWidget(parent),
    m_radio(new Cellular::RadioAccess(this)),
    poskey(new GConfItem("/apps/system-ui-extensions/tools/cellular/index")),
    statuskey(new GConfItem("/apps/system-ui-extensions/tools/cellular/working"))
{
    setMaximumSize(64,64);
    setMinimumSize(64,64);

    icon_2g =   QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-2g.png");
    icon_3g =   QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-3g.png");
    icon_dual = QImage("/usr/share/themes/blanco/meegotouch/icons/icon-extensions-cellular-dual.png");

    m_toggleicon = new MImageWidget(&icon_2g, this);
    m_toggleicon->setAspectRatioMode(Qt::KeepAspectRatio);
    m_toggleicon->setMaximumSize(64,64);
    m_toggleicon->setMinimumSize(64,64);

    MFeedback* feedback1 = new MFeedback("priority2_static_press", this);
    connect(this, SIGNAL(pressed()), feedback1, SLOT(play()));
    MFeedback* feedback2 = new MFeedback("priority2_static_release", this);
    connect(this, SIGNAL(released()), feedback2, SLOT(play()));


//    connect(m_radio,
//            SIGNAL(modeChanged(int)),
//            SLOT(onModeChanged(int)));

    onModeChanged(m_radio->mode());
    connect(poskey,
            SIGNAL(valueChanged()),
            SLOT(onIndexChanged()));
    connect(statuskey,
            SIGNAL(valueChanged()),
            SLOT(onStatusChanged()));
    index = poskey->value().toInt();
    status = statuskey->value().toBool();
}
Esempio n. 5
0
WidgetMOItemsList::WidgetMOItemsList(QAbstractItemModel *itemsList, QWidget *parent, bool showDescription,bool editable):
    QWidget(parent),
    _ui(new Ui::WidgetMOItemsListClass)
{
    _ui->setupUi(this);
    _itemsList = itemsList;

    _ui->listItems->setModelColumn(0);
    _ui->listItems->setModel(_itemsList);

    _itemView = new MOItemTreeView(this);
    _ui->layoutItemView->addWidget(_itemView);

    _itemModel = new MOItemModel(showDescription,editable);
    _itemView->setModel(_itemModel);
    _itemView->setProperty("frameShape",QFrame::Box);
    connect(_ui->listItems->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(onIndexChanged()));
}
Esempio n. 6
0
bool Prop2D::propPoll(double dt) {
	if( prop2DPoll(dt) == false ) return false;
    if(remote_vel.isZero()==false) { // for cloud syncing
        loc += remote_vel*dt;
    }

	// animation of index
	if(anim_curve){
		int previndex = index;
		bool finished = false;
		index = anim_curve->getIndex( accum_time - anim_start_at, &finished );
		if( index != previndex ){
			onIndexChanged(previndex);
		}
		if(finished) {
			onAnimFinished();
		}
	}
	// animation of scale
	if( seek_scl_time != 0 ){
		double elt = accum_time - seek_scl_started_at;
		if( elt > seek_scl_time ){
			scl = seek_scl_target;
			seek_scl_time = 0;
		} else {
			double rate = elt / seek_scl_time;
			scl.x = seek_scl_orig.x + ( seek_scl_target.x - seek_scl_orig.x ) * rate;
			scl.y = seek_scl_orig.y + ( seek_scl_target.y - seek_scl_orig.y ) * rate;
		}
	}
	// animation of rotation
	if( seek_rot_time != 0 ){
		double elt = accum_time - seek_rot_started_at;
		if( elt > seek_rot_time ){
			rot = seek_rot_target;
			seek_rot_time = 0;
		} else {
			double rate = elt / seek_rot_time;
			rot = seek_rot_orig + ( seek_rot_target - seek_rot_orig ) * rate;
		}
	}
	// animation of color
	if( seek_color_time != 0 ){
		double elt = accum_time - seek_color_started_at;
		if( elt > seek_color_time ){
			color = seek_color_target;
            if(seek_color_time!=0){
                onColorChanged();
            }
			seek_color_time = 0;
		} else {
			double rate = elt / seek_color_time;
			color = Color( seek_color_orig.r + ( seek_color_target.r - seek_color_orig.r ) * rate,
				seek_color_orig.g + ( seek_color_target.g - seek_color_orig.g ) * rate,
				seek_color_orig.b + ( seek_color_target.b - seek_color_orig.b ) * rate,
				seek_color_orig.a + ( seek_color_target.a - seek_color_orig.a ) * rate );
            onColorChanged();
		}
	}

	// children
	for(int i=0;i<children_num;i++){
		Prop2D *p = children[i];
		p->basePoll(dt);
	}

	return true;
}