Пример #1
0
   void DesktopView::loadIcons()
   {
       QDir desktop(QDir::homePath()+"/Desktop");
       desktop.setFilter(QDir::Files | QDir::NoDotAndDotDot);
       desktop.setSorting(QDir::Size | QDir::Reversed);
       QFileInfoList list = desktop.entryInfoList();

     //  d->iconWatcher->setFuture(QtConcurrent::mapped(list, LoadIcon(d->iconprovider, d->row, d->column)));

       for (int i = 0; i < list.size(); i++) {
         QFileInfo fileInfo = list.at(i);
         QPixmap iconpixmap (DesktopWidget::applicationDirPath() +
            "/share/plexy/skins/widgets/widget01/Icon.png");
         //TODO
         //Shared pointer please

         Icon * icon = new Icon(d->iconprovider, QRect(0,0,iconpixmap.width(),iconpixmap.height()));
         icon->setContent(fileInfo.absoluteFilePath());
         if(icon->isValid()) {
         scene()->addItem(icon);
         icon->setPos(d->row,d->column);
         icon->show();
         d->icons.append(icon);
         } else {
             delete icon;
         }
       }

   }
Пример #2
0
int create_new_dnd_icon(int x, int y, char *filename) //create icon from dnd data
{
    if (filename) 
    {
        char config[FL_PATH_MAX];
	const char *name = fl_file_filename(filename);
	snprintf(config, sizeof(config)-1, "%s/.ede/desktop/%s.desktop", getenv("HOME"), name);
	
        if (!fl_file_exists((char*)config))
        {
	    char val[FL_PATH_MAX];
	    Fl_Config checkconf(filename, true, false);
	
	    if(!checkconf.get("Desktop Entry", "Exec", val, 0, sizeof(val))) 
	    {	
    	        Fl_Config cfg(config);
		cfg.set_section("Desktop Entry");
		
		checkconf.get("Desktop Entry", "Icon", val, "no icon", sizeof(val)); 
        	cfg.write("Icon", val);
        	cfg.write("X", x);
        	cfg.write("Y", y);
        	cfg.write(get_localized_string(), get_localized_name(checkconf));

                checkconf.get("Desktop Entry", "Exec", val, filename, sizeof(val));
        	cfg.write("Exec", val);
        	cfg.flush();
	    }
	    else
	    {
	        Fl_Config cfg(config);
    	        cfg.set_section("Desktop Entry");
        	cfg.write("Icon", "no icon");
        	cfg.write("X", x);
        	cfg.write("Y", y);
        	cfg.write(get_localized_string(), name);
                cfg.write("Exec", filename);
        	cfg.flush();
	    }	
	    desktop->begin();
            Icon *icon = new Icon((char*)config);
    	    icon->show();
    	    desktop->end();
    	    desktop->redraw();
	}
	else 
	{
	    fl_alert(_("The icon with the same name already exists."));
	}  
    }  
    return 0;
}
Пример #3
0
void scanIcons(char *path)
{
    Fl_Directory_DS dds;
    dds.directory(path);
    dds.open();

    while(!dds.eof())
    {
        Fl_String name(dds["Name"].get_string());
        Fl_String filename(dds.directory() + name);

        dds.next();

        if(access(filename, R_OK)!=0) continue;

        if(fl_file_match(name, "*.desktop")) {
            Icon *desktopIcon = new Icon(filename);
            desktopIcon->show();
        }
    }
}
Пример #4
0
void test_hover2 (void *data, Evas_Object *obj, void *event_info)
{
  Box *bx = NULL;
  Button *bt = NULL;

  Window *win = Window::factory ("hover2", ELM_WIN_BASIC);
  win->setTitle ("Hover 2");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addObjectResize (*bg);
  bg->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  bx = Box::factory (*win);
  bx->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  win->addObjectResize (*bx);
  bx->show ();

  Hover *hv = Hover::factory (*win);
  hv->setStyle ("popout");

  bt = Button::factory (*win);
  bt->setText ("Button");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_hover_bt), hv));
  bx->packEnd (*bt);
  bt->show ();
  hv->setParent (*win);
  hv->setTarget (*bt);

  bt = Button::factory (*win);
  bt->setText ("Popup");
  hv->setContent ("middle", *bt);
  bt->show ();

  bx = Box::factory (*win);

  Icon *ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  bx->packEnd (*ic);
  ic->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 1");
  bx->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 2");
  bx->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 3");
  bx->packEnd (*bt);
  bt->show ();

  bx->show ();

  hv->setContent ("top", *bx);

  bt = Button::factory (*win);
  bt->setText ("Bot");
  hv->setContent ("bottom", *bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Left");
  hv->setContent ("left", *bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Right");
  hv->setContent ("right", *bt);
  bt->show ();

  bg->setMinHintSize (size160x160);
  bg->setMaxHintSize (size640x640);
  win->resize (size320x320);
  win->show ();
}
Пример #5
0
void test_check (void *data, Evas_Object *obj, void *event_info)
{
  Icon *ic = NULL;
  Check *ck = NULL;

  Window *win = Window::factory ("check", ELM_WIN_BASIC);
  win->setTitle ("Checks");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addObjectResize (*bg);
  bg->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  Box *bx = Box::factory (*win);
  win->addObjectResize (*bx);
  bx->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bx->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setAspectHintSize (EVAS_ASPECT_CONTROL_VERTICAL, Size (1, 1));
  ck = Check::factory (*win);
  ck->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  ck->setAlignHintSize (EVAS_HINT_FILL, 0.5);
  ck->setText ("Icon sized to check");
  ck->setContent (*ic);
  ck->setState (true);
  bx->packEnd (*ck);
  ck->show ();
  ic->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  ck = Check::factory (*win);
  ck->setText ("Icon no scale");
  ck->setContent (*ic);
  bx->packEnd (*ck);
  ck->show ();
  ic->show ();

  ck = Check::factory (*win);
  ck->setText ("Label Only");
  bx->packEnd (*ck);
  ck->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setAspectHintSize (EVAS_ASPECT_CONTROL_VERTICAL, Size (1, 1));
  ck = Check::factory (*win);
  ck->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  ck->setAlignHintSize (EVAS_HINT_FILL, 0.5);
  ck->setText ("Disabled check");
  ck->setContent (*ic);
  ck->setState (true);
  bx->packEnd (*ck);
  ck->setDisabled (true);
  ck->show ();
  ic->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  ck = Check::factory (*win);
  ck->setContent (*ic);
  bx->packEnd (*ck);
  ck->show ();
  ic->show ();

  win->show ();
}
void test_button (void *data, Evas_Object *obj, void *event_info)
{
  Icon *ic = NULL;
  Button *bt = NULL;

  Window *win = Window::factory ("buttons", ELM_WIN_BASIC);
  win->setTitle ("Buttons");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addResizeObject (*bg);
  bg->setSizeHintWeight (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  Box *bx = Box::factory (*win);
  win->addResizeObject (*bx);
  bx->setSizeHintWeight (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bx->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setSizeHintAspect (EVAS_ASPECT_CONTROL_VERTICAL, Size (1, 1));
  bt = Button::factory (*win);
  bt->setText ("Icon sized to button");
  bt->setContent (*ic);
  bx->packEnd (*bt);
  bt->show ();
  ic->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setSizeHintAspect (EVAS_ASPECT_CONTROL_VERTICAL, Size (1, 1));
  bt = Button::factory (*win);
  bt->setText ("Disabled Button");
  bt->setContent (*ic);
  bt->setDisabled (true);
  bx->packEnd (*bt);
  bt->show ();
  ic->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  bt = Button::factory (*win);
  bt->setText ("Icon no scale");
  bt->setContent (*ic);
  bx->packEnd (*bt);
  bt->show ();
  ic->show ();

  bt = Button::factory (*win);
  bt->setText ("Label Only");
  bx->packEnd (*bt);
  bt->show ();

  ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  bt = Button::factory (*win);
  bt->setText ("Icon no scale");
  bt->setContent (*ic);
  bx->packEnd (*bt);
  bt->show ();
  ic->show ();

  win->show ();
}