Exemplo n.º 1
0
void browser::create( browser_instance& w, const mm::uvec2& screen, bool managed )
{
  //set managed or not
  w.managed = managed;

  //we actually create the texture
  glGenTextures( 1, &w.browser_texture );
  glBindTexture( GL_TEXTURE_2D, w.browser_texture );
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

  w.screen = screen;
  w.scroll_buffer = new char[screen.x * ( screen.y + 1 ) * 4];

  Berkelium::Context* browser_context = 0;

#ifdef BROWSER_USE_EXCEPTIONS
  try
#endif
  {
    Berkelium::Context* browser_context = Berkelium::Context::create();
    w.browser_window = Berkelium::Window::create( browser_context );
  }
#ifdef BROWSER_USE_EXCEPTIONS
  catch( std::exception e )
  {
    std::cerr << "Error creating Berkelium context: " << e.what() << std::endl;
    return;
  }
#endif

  delete browser_context;

  instances[w.browser_window] = &w;

  //the browser class will be the delegate
  w.browser_window->setDelegate( this );
  w.browser_window->resize( screen.x, screen.y );
  w.browser_window->setTransparent( true );
  w.browser_window->focus();

  navigate( w, default_page );
}
Exemplo n.º 2
0
bool ObxTreeView::pageDown()
{
    int new_pos = first_visible_ + items_per_page_;
    if (new_pos >= all_items_.size())
    {
        emit exceed(false);
        if (selected_ < all_items_.size() - 1)
        {
            navigate(all_items_.size() - 1 - selected_);
        }
        return false;
    }

    first_visible_ = new_pos;
    selected_ = first_visible_;
    updateTreeWidget();
    reportPosition();
    return true;
}
Exemplo n.º 3
0
void ObxTreeView::onItemMoved(ObxTreeViewItem *item)
{
    if (item->data() == 0 || hovering_ == false)
    {
        return;
    }

    ViewItemPtrIter iter;
    for(iter = views_.begin(); iter != views_.end(); ++iter)
    {
        if (iter->get() == item)
        {
            int offset = (iter - views_.begin() + first_visible_) - selected();
            if (offset)
            {
                navigate(offset);
            }
        }
    }
}
Exemplo n.º 4
0
void ViewpointFileNavigationTool::frame(void)
	{
	/* Animate the navigation transformation if the tool is active: */
	if(isActive())
		{
		/* Get the next curve parameter: */
		Scalar newParameter=parameter+Scalar(getFrameTime())*speed;
		
		/* Check if a pause was scheduled between the last frame and this one: */
		bool passedPause=false;
		for(std::vector<Scalar>::const_iterator pIt=pauses.begin();pIt!=pauses.end();++pIt)
			if(parameter<*pIt&&*pIt<=newParameter)
				{
				passedPause=true;
				newParameter=*pIt;
				break;
				}
		
		/* Navigate to the new curve parameter: */
		if(!navigate(newParameter))
			{
			/* Stop animating, curve is over: */
			deactivate();
			}
		else if(passedPause)
			{
			paused=true;
			deactivate();
			}
		else
			{
			/* Request another frame: */
			scheduleUpdate(getApplicationTime()+1.0/125.0);
			}
		
		/* Update the curve parameter and the GUI: */
		parameter=newParameter;
		if(positionSlider!=0)
			positionSlider->setValue(parameter);
		}
	}
Exemplo n.º 5
0
BrowserWindow::BrowserWindow()
    : m_slidingSurface(new QWidget(this))
    , m_homeView(new HomeView(m_slidingSurface))
    , m_browserView(new BrowserView(m_slidingSurface))
    , m_animation(new QPropertyAnimation(this, "slideValue"))
{
    m_slidingSurface->setAutoFillBackground(true);

    m_homeView->resize(size());

    m_browserView->resize(size());

    connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString)));
    connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl)));

    connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView()));

    m_animation->setDuration(200);
    connect(m_animation, SIGNAL(finished()), SLOT(animationFinished()));

    setSlideValue(0.0f);
}
Exemplo n.º 6
0
QList<CommandSuggestion*> CommandExecutionEngine::autoComplete(Visualization::Item *originator, const QString& textSoFar)
{
	QList<CommandSuggestion*> result;

	QString trimmed = textSoFar.trimmed();
	QString navigation = extractNavigationString(trimmed);

	if (!trimmed.isEmpty())
	{
		// This is the node where we begin trying to process the command
		Visualization::Item* source = originator;
		// Alter the source node according to the requested navigation location.
		if (!navigation.isEmpty()) source = navigate(originator, navigation);
		// This is the node (source or one of its ancestors) where we manage to process the command.
		Visualization::Item* target = source;

		// Get suggestion from item and parents
		while(target != nullptr)
		{
			GenericHandler* handler = dynamic_cast<GenericHandler*> (target->handler());
			if (handler)
				for(int i = 0; i< handler->commands().size(); ++i)
					result.append( handler->commands().at(i)->suggest(source, target, trimmed) );

			target = target->parent();
		}

		// Get suggestions from the scene handler item
		if (originator != originator->scene()->sceneHandlerItem())
		{
			GenericHandler* handler = dynamic_cast<GenericHandler*> (source->scene()->sceneHandlerItem()->handler());
			if ( handler )
				for (int i = 0; i < handler->commands().size(); ++i)
					result.append( handler->commands().at(i)->suggest(source, target, trimmed) );
		}
	}

	return result;
}
Exemplo n.º 7
0
bool ObxTreeView::pageUp()
{
    if (first_visible_ <= 0)
    {
        emit exceed(true);
        if (selected_ > 0)
        {
            navigate(-selected_);
        }
        return false;
    }

    first_visible_ -= items_per_page_;
    if (first_visible_ < 0)
    {
        first_visible_ = 0;
    }
    selected_ = first_visible_;
    updateTreeWidget();
    reportPosition();
    return true;
}
Exemplo n.º 8
0
Explorer::Explorer(QWidget *parent_) : QWidget(parent_) {
	setupUi(this);
	setObjectName("Explorer");

	layout()->setMargin(1);

	_model = new QFileSystemModel(this);
	_model->setRootPath("");
	_model->setNameFilterDisables(false);

	//_model->setFilter(QDir::AllDirs | QDir::Files | QDir::Drives);

	lvDirs->setModel(_model);
	lvDirs->setMouseTracking(true);
	lvDirs->installEventFilter(this);

	connect(tbSynchReq, SIGNAL(clicked()), this, SIGNAL(synchFileRequest()));
	connect(cbDir->lineEdit(), SIGNAL(returnPressed()), this, SLOT(validate()));

	QCompleter *comp = new QCompleter(this);
	comp->setCompletionMode(QCompleter::InlineCompletion);
	cbFilter->setCompleter(comp);

	QCompleter *comp2 = new QCompleter(this);
	comp2->setCompletionMode(QCompleter::InlineCompletion);
	cbDir->setCompleter(comp2);

	lvDirs->addAction(actionOpen);
	QAction *sep = new QAction(this); 
	sep->setSeparator(true);
	lvDirs->addAction(sep);
	lvDirs->addAction(actionCopyPath);
	lvDirs->addAction(actionCopyName);
	
	navigate(QDir::rootPath());
}
Exemplo n.º 9
0
void BrowserWindow::initialize()
{
    m_homeView = new HomeView(this);
    m_browserView = new BrowserView(this);

    m_homeView->hide();
    m_homeView->resize(size());
    m_homeView->move(0, 0);

    m_browserView->hide();
    m_browserView->resize(size());
    m_browserView->move(0, 0);

    connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString)));
    connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl)));

    connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView()));

    m_homeView->setVisible(false);
    m_browserView->setVisible(false);
    slide(0);

    connect(m_timeLine, SIGNAL(frameChanged(int)), SLOT(slide(int)));
}
Exemplo n.º 10
0
void RemoteFrame::navigate(const FrameLoadRequest& passedRequest)
{
    UserGestureStatus gesture = UserGestureIndicator::processingUserGesture() ? UserGestureStatus::Active : UserGestureStatus::None;
    navigate(*passedRequest.originDocument(), passedRequest.resourceRequest().url(), passedRequest.replacesCurrentItem(), gesture);
}
Exemplo n.º 11
0
static void on_option_selected(  BOOL              made_selection,
                                 ssd_cm_item_ptr   item,
                                 void*             context)
{
   contextmenu_items selection = cm__invalid;
   BOOL              close     = FALSE;
   BOOL              do_nav    = FALSE;

   s_menu = FALSE;

   if( !made_selection)
      return;

   selection = item->id;

   switch( selection)
   {
      case cm_navigate:
         do_nav = TRUE;
         // Roll down...
      case cm_show:
         close = navigate( do_nav);
         break;

      case cm_add_to_favorites:
      {
         int                        selected_list_item   = get_selected_list_item();
         const address_candidate*   selection            = generic_search_result( selected_list_item);
         RoadMapPosition position;
         position.latitude = (int)(selection->latitude*1000000);
         position.longitude= (int)(selection->longtitude*1000000);
         generic_search_add_address_to_history( ADDRESS_FAVORITE_CATEGORY,
                                                selection->city,
                                                selection->street,
                                                get_house_number__str( selection->house),
                                                selection->state,
                                                NULL,
                                                &position);
         break;
      }

      case cm_cancel:
         close = FALSE;
         break;

      case cm_add_geo_reminder:
      {
         int                        selected_list_item   = get_selected_list_item();
         const address_candidate*   selection            = generic_search_result( selected_list_item);
         RoadMapPosition position;
         position.latitude = (int)(selection->latitude*1000000);
         position.longitude= (int)(selection->longtitude*1000000);
         roadmap_reminder_add_at_position(&position, TRUE, TRUE);
         break;
      }
      case cm_send:
         send_error_report();
         generic_search_dlg_switch_gui();
         break;

      default:
         assert(0);
         break;
   }

   if( close)
   {
      ssd_dialog_hide_all( dec_close);

      if (!roadmap_screen_refresh ())
           roadmap_screen_redraw();
   }
}
Exemplo n.º 12
0
int ProcessControls(event *e,int n)
{
   int retval = 0;
   int X = e->CursorX;
   int Y = e->CursorY;
   int i;
   int last_item = current_main_item;
   int keyword = 0;
   int button = (e->State & 0x700) >> 8;

   if (n)
   {
      if (e->ASCII && e->ASCII != 0xe0)
         keyword = e->ASCII;
      else if (e->ScanCode != 0xff)
         keyword = e->ScanCode << 8;

    
      if (keyword)
      {
         int z = sizeof(ourthings)/sizeof(int);
         for(i=0;i<z;i++)
         {
            if (keyword == ourthings[i])
               break;
         }
         if (i == z)   
            return keyword;
      }

      if (button == swLeft || button == swRight)
      {
         keyword = 0x0d;
         incsize = (button == swRight);
      }

      if ((keyword == XLARROW || keyword == XHOME || keyword == XEND)
         && current_main_item == -1)
      {
         current_main_item = closest_left(Y);
         move_to_corner(mainR[current_main_item]);
      }
      else if (keyword == XRARROW || keyword == XPGUP || keyword == XPGDN)
      {
         switch(current_main_item)
         {
         case 5:
         case 6:
         case 8:
         case 9:
         case 11:
         case 12:
         case 14:
         case 15:
         case 17:
         case 18:
         case 20:
         case 21:
         case 25:
         case 26:
            current_main_item++;
            move_to_corner(mainR[current_main_item]);
            break;
         default:
            current_main_item = -1;
            HideCursor();
            CursorShowing = false;
            clubx = 16;
            MoveCursor(minx+clubx,cluby);
            if (clubflag == BALLBOX && !stopped)
               showball(ballx,bally,maxcolor);
            showclub(clubx,cluby,maxcolor-1);
            SelectNothing();
         }
      }
    

   }
   else
   {
      current_main_item = -1;
      for(i=0;i<main_items;i++)
      {
         /* something special for charges */
         if (i >= 5 && i <= 7 && !samecharges)
         {
            if (XYInRect(X,Y,&chargeR))
            {
               current_main_item = i;
               break;
            }
         }

         else if (XYInRect(X,Y,mainR[i]))
         {
            current_main_item = i;
            break;
         }
      }
   }

   if (keyword == 0x0d)
   {
      if (current_main_item >= 0)
      {
         int col,row;
         
         if (current_main_item <= 4)
            return mainkeys[current_main_item];

         else if (current_main_item <= 4 + 6*3)
         {
            i = current_main_item - 5;
            row = i / 3;
            col = i % 3;

            if (row == 0 && !samecharges)
               return XF5;

            if (col)
               return pk[row][col-1];
            else
            {
               /* Eeep, We have to process one of the
                  number fuckers. */
               numbertool *t = tools[row].t;

               double d = t->value;
               if (GetNumberBase(&t->TB,&d,t->type,t->lo,t->hi,t->p1,t->p2))
               {
                  t->value = d;
                  switch(row)
                  {
                  case 0:
                     {
               		   magnetstructure tM = M;
                        chargeunit = d;
                        loadcharges();
               		   updateallmagnets(&tM);
                     }
                     break;
                  case 1:
                     xsection = d;
                     break;
                  case 2:
                     magnetradius = d;
			            magrad2 = magnetradius * magnetradius;
			            magrad3 = magrad2 * magnetradius;
                     break;
                  case 3:
                     centerpull = d;
                     break;
                  case 4:
                     freq = d;
                     break;
                  case 5:
                     friction = d;
                     if (friction < 0.0001)
                     {
                        friction = 0;
                        frictiontype = 0;
                     }
                     break;
                  }
               }
               push(current_main_item,true);
            }
         }
         else if (current_main_item == 4 + 6*3 + 1)
            return 'h';
         else if (current_main_item == 4 + 6*3 + 2)
            return 'i';
         else if (current_main_item == 4 + 6*3 + 3)
         {
            if (stopped)
            {
               stopped = false;
               SetStopSign();
            }
         }
         else if (current_main_item == 4 + 6*3 + 4)
         {
            if (!stopped)
            {
               stopped = true;
               SetStopSign();
            }
         }
         else if (current_main_item == 4 + 6*3 + 5)
         {
            if (!stopped)
            {
               stopped = true;
               SetStopSign();
            }
            onestep = true;
         }


      }
   }


   navigate(keyword,lefters,NULL,uppers,downers,main_items,mainR,&current_main_item);

   if (current_main_item != last_item)
   {
      push(last_item,false);
      push(current_main_item,true);
   }
   return retval;
}
Exemplo n.º 13
0
TreeWidget::TreeWidget(QWidget* parent) : QTreeWidget(parent)
{
    d.block = false;
    d.blink = false;
    d.pressedItem = 0;
    d.sortingBlocked = false;

    qRegisterMetaType<TreeItem*>();

    setAnimated(true);
    setColumnCount(2);
    setIndentation(0);
    setHeaderHidden(true);
    setRootIsDecorated(false);
    setFocusPolicy(Qt::NoFocus);
    setFrameStyle(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#ifdef Q_OS_MAC
    setVerticalScrollMode(ScrollPerPixel);
#endif

    setItemDelegate(new TreeDelegate(this));

    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);

    header()->setStretchLastSection(false);
    header()->setResizeMode(0, QHeaderView::Stretch);
    header()->setResizeMode(1, QHeaderView::Fixed);
#ifdef Q_OS_WIN
    header()->resizeSection(1, fontMetrics().width("9999"));
#else
    header()->resizeSection(1, fontMetrics().width("999"));
#endif

    connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(onItemExpanded(QTreeWidgetItem*)));
    connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(onItemCollapsed(QTreeWidgetItem*)));
    connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            this, SLOT(onCurrentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));

#ifdef Q_OS_MAC
    QString navigate(tr("Ctrl+Alt+%1"));
    QString nextActive(tr("Shift+Ctrl+Alt+%1"));
#else
    QString navigate(tr("Alt+%1"));
    QString nextActive(tr("Shift+Alt+%1"));
#endif

    QShortcut* shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(navigate.arg("Up")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(moveToPrevItem()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(navigate.arg("Down")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(moveToNextItem()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(nextActive.arg("Up")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(moveToPrevActiveItem()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(nextActive.arg("Down")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(moveToNextActiveItem()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(navigate.arg("Right")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(expandCurrentConnection()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(navigate.arg("Left")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(collapseCurrentConnection()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(tr("Ctrl+L")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(moveToMostActiveItem()));

    shortcut = new QShortcut(this);
    shortcut->setKey(QKeySequence(tr("Ctrl+R")));
    connect(shortcut, SIGNAL(activated()), this, SLOT(resetItems()));
}
Exemplo n.º 14
0
void IEEmbed::navigate(char *url)
{
	wchar_t *pwszUrl = mir_a2u(url);
	navigate(pwszUrl);
	mir_free(pwszUrl);
}
Exemplo n.º 15
0
void GenericTab::goBack()
{
    emit navigate(false,m_index);
}
Exemplo n.º 16
0
void GenericTab::goForward()
{
    emit navigate(true,m_index);
}
Exemplo n.º 17
0
PhotoView::Actions::Actions( PhotoView * photoView ):
    _photoView( photoView )
{
    //
    // Zoom
    //

    noZoom = createAction( tr( "No Zoom (100% / &1:1)" ), Qt::Key_1, NoZoom );
    CONNECT_ACTION( noZoom, photoView, setZoomMode() );

    zoomIn = createAction( tr( "Zoom In (Enlarge)" ), Qt::Key_Plus );
    CONNECT_ACTION( zoomIn, photoView, zoomIn() );

    zoomOut = createAction( tr( "Zoom Out (Shrink)" ), Qt::Key_Minus );
    CONNECT_ACTION( zoomOut, photoView, zoomOut() );

    zoomFitImage = createAction( tr( "Zoom to &Fit Window" ), Qt::Key_F, ZoomFitImage );
    addShortcut( zoomFitImage, Qt::Key_M );
    CONNECT_ACTION( zoomFitImage, photoView, setZoomMode() );

    zoomFitWidth = createAction( tr( "Zoom to Fit Window &Width" ), Qt::Key_W, ZoomFitWidth );
    CONNECT_ACTION( zoomFitWidth, photoView, setZoomMode() );

    zoomFitHeight = createAction( tr( "Zoom to Fit Window &Height" ), Qt::Key_H, ZoomFitHeight );
    CONNECT_ACTION( zoomFitHeight, photoView, setZoomMode() );

    zoomFitBest = createAction( tr( "&Best Zoom for Window Width or Height" ), Qt::Key_B, ZoomFitBest );
    CONNECT_ACTION( zoomFitBest, photoView, setZoomMode() );

    //
    // Navigation
    //

    loadNext = createAction( tr( "Load &Next Image" ), Qt::Key_Space, NavigateNext );
    addShortcut( loadNext, Qt::Key_PageDown );
    CONNECT_ACTION( loadNext, photoView, navigate() );

    loadPrevious = createAction( tr( "Load &Previous Image" ), Qt::Key_Backspace, NavigatePrevious );
    addShortcut( loadPrevious, Qt::Key_PageUp );
    CONNECT_ACTION( loadPrevious, photoView, navigate() );

    loadFirst = createAction( tr( "Load &First Image" ), Qt::Key_Home, NavigateFirst );
    CONNECT_ACTION( loadFirst, photoView, navigate() );

    loadLast = createAction( tr( "Load &Last Image" ), Qt::Key_End, NavigateLast );
    CONNECT_ACTION( loadLast, photoView, navigate() );


    //
    // Misc
    //

    forceReload = createAction( tr( "Force &Reload" ), Qt::Key_F5 );
    CONNECT_ACTION( forceReload, photoView, forceReload() );

    toggleFullscreen = createAction( tr( "Toggle F&ullscreen" ), Qt::Key_Return );
    CONNECT_ACTION( toggleFullscreen, photoView, toggleFullscreen() );

    quit = createAction( tr ( "&Quit" ), Qt::Key_Q );
    addShortcut( quit, Qt::Key_Escape );
    CONNECT_ACTION( quit, qApp, quit() );
}
Exemplo n.º 18
0
static void on_address_resolved( void*                context,
                                 address_candidate*   array,
                                 int                  size,
                                 roadmap_result       rc)
{
   static   const char* results[ADSR_MAX_RESULTS+1];
   static   void*       indexes[ADSR_MAX_RESULTS+1];
   static   const char* icons[ADSR_MAX_RESULTS+1];

   SsdWidget list_cont = (SsdWidget)context;
   SsdWidget list;
   int       i;

   s_searching = FALSE;

   /* Close the progress message */
   ssd_progress_msg_dialog_hide();

   roadmap_main_set_cursor( ROADMAP_CURSOR_NORMAL);

   assert(list_cont);

   list = ssd_widget_get( list_cont, ASD_RC_LIST_NAME);

   if( succeeded != rc)
   {
      if( is_network_error( rc))
         roadmap_messagebox_cb ( roadmap_lang_get( "Oops"),
                              roadmap_lang_get( "Search requires internet connection.\r\nPlease make sure you are connected."), on_search_error_message );



      else if( err_as_could_not_find_matches == rc)
         roadmap_messagebox_cb ( roadmap_lang_get( "Oops"),
                              roadmap_lang_get( "Sorry, no results were found for this search"), on_search_error_message );
      else
      {
         char msg[128];

         snprintf( msg, sizeof(msg), "%s\n%s",roadmap_lang_get("Sorry we were unable to complete the search"), roadmap_lang_get("Please try again later"));

         roadmap_messagebox_cb ( roadmap_lang_get( "Oops"), msg, on_search_error_message );
      }

      roadmap_log(ROADMAP_ERROR,
                  "address_search_dlg::on_address_resolved() - Resolve process failed with error '%s' (%d)",
                  roadmap_result_string( rc), rc);
      return;
   }

   if( !size)
   {
      roadmap_log(ROADMAP_DEBUG,
                  "address_search_dlg::on_address_resolved() - NO RESULTS for the address-resolve process");
      return;
   }

   assert( size <= ADSR_MAX_RESULTS);
   
   if (size == 1 && s_auto_start_nav) {
      s_auto_start_nav = FALSE;
      generic_search_dlg_switch_gui();
      ssd_dialog_hide_all( dec_close);
      navigate(1);
      return;
   }

   for( i=0; i<size; i++)
   {
      results[i] = array[i].address;
      indexes[i] = (void*)i;
      icons[i] = "search_address";
   }

   results[i] = roadmap_lang_get(COULDNT_FIND_ADDRESS_TEXT);
   indexes[i] = (void*)COULDNT_FIND_INDEX;
   icons[i] = "submit_logs";

   if ( roadmap_native_keyboard_enabled() )
   {
	   roadmap_native_keyboard_hide();
   }
   ssd_list_populate(list,
                     size+1,
                     results,
                     (const void **)indexes,
                     icons,
                     0,
                     on_list_item_selected,
                     NULL,
                     FALSE);


   generic_search_dlg_switch_gui();
}
Exemplo n.º 19
0
void ImageExample::touchMoved( ofTouchEventArgs & touch )
{
    TUIO::TuioCursor* cursor1 = nullptr;
    TUIO::TuioCursor* cursor2 = nullptr;
    TUIO::TuioCursor* cursor3 = nullptr;
    TUIO::TuioCursor* cursor4 = nullptr;

    if(m_Mode == M_TAP)
    {
        for ( auto *iter : MyClient.client->getTuioCursors() )
        {
            if (iter->getCursorID() == 0)
            {
                cursor1 = iter;
            }
        }

        if (cursor1 == nullptr)
        {
            return;
        }
    }
    if(m_Mode == M_SCALE)
    {
        for ( auto *iter : MyClient.client->getTuioCursors() )
        {
            switch ( iter->getCursorID() )
            {
            case 0:
                cursor1 = iter;
                break;
            case 1:
                cursor2 = iter;
                break;
            }
        }
        if(cursor1 == nullptr || cursor2 == nullptr)
            return;
    }
    if(m_Mode == M_NAVIGATION)
    {
        for ( auto *iter : MyClient.client->getTuioCursors() )
        {
            switch ( iter->getCursorID() )
            {
            case 0:
                cursor1 = iter;
                break;
            case 1:
                cursor2 = iter;
                break;
            case 2:
                cursor3 = iter;
                break;
            case 3:
                cursor4 = iter;
                break;
            default:
                break;
            }
        }
    }
    if(m_Mode == M_ZOOM)
    {
        for ( auto *iter : MyClient.client->getTuioCursors() )
        {
            switch ( iter->getCursorID() )
            {
            case 0:
                cursor1 = iter;
                break;
            case 1:
                cursor2 = iter;
                break;
            case 2:
                cursor3 = iter;
                break;
            default:
                break;
            }
        }
    }

    //탭한 상태의 이미지라면
    if(m_Mode == M_TAP && m_currentElement != nullptr && m_currentElement->m_isCover ==false)
    {
        m_currentElement->m_ImgPositionX = cursor1->getX() * WINDOW_WIDTH;
        m_currentElement->m_ImgPositionY =cursor1->getY() * WINDOW_HEIGHT;
    }//탭한 상태의 앨범이라면 전체를 이동한다.
    else if(m_Mode == M_TAP && m_currentElement != nullptr && m_currentElement->m_isCover==true)
    {
        float movedX = cursor1->getX() * WINDOW_WIDTH - m_currentElement->m_ImgPositionX;
        float movedY = cursor1->getY() * WINDOW_HEIGHT - m_currentElement->m_ImgPositionY;

        m_currentElement->m_ImgPositionX = cursor1->getX() * WINDOW_WIDTH;
        m_currentElement->m_ImgPositionY =cursor1->getY() * WINDOW_HEIGHT;
        myImage* currentImage = m_currentElement->nextImage;
        //전체 이미지도 이동
        while(currentImage != nullptr)
        {
            currentImage->m_ImgPositionX +=movedX;
            currentImage->m_ImgPositionY +=movedY;
            currentImage = currentImage->nextImage;
        }
    }
    else if(m_Mode == M_NAVIGATION)
    {
        if (cursor1 == nullptr || cursor2 == nullptr|| cursor3 == nullptr|| cursor4 == nullptr)
            return;

        float positionX = (cursor1->getX()+cursor2->getX() + cursor3->getX()+cursor4->getX())/4;
        float positionY = (cursor1->getY()+cursor2->getY() + cursor3->getY()+cursor4->getY())/4;

        navigate(positionX*WINDOW_WIDTH,positionY*WINDOW_HEIGHT);
    }
    else if(m_Mode == M_SCALE)
    {
        scale(cursor1,cursor2);
        rotate(cursor1,cursor2);
    }
    else if(m_Mode == M_ZOOM)
    {
        if (cursor1 == nullptr || cursor2 == nullptr|| cursor3 == nullptr)
            return;
        if(m_currentElement ==nullptr)
            return;
        zoomAlbum(m_currentElement,cursor1);
    }
    else
    {
        return;
    }
}
Exemplo n.º 20
0
void Explorer::on_tbRoot_clicked() {
	navigate(QDir::rootPath());
}
Exemplo n.º 21
0
void HelpPopup::popup()
{
#ifdef Q_OS_MAC
    QString next = tr("Alt+Tab");
    QString previous = tr("Shift+Alt+Tab");
    QString navigate(tr("Ctrl+Alt+%1"));
    QString active(tr("Shift+Ctrl+Alt+%1"));
#else
    QString next = tr("Ctrl+Tab");
    QString previous = tr("Shift+Ctrl+Tab");
    QString navigate(tr("Alt+%1"));
    QString active(tr("Shift+Alt+%1"));
#endif

    const QString header("<tr><th align='left' colspan='3'><h3>%1</h3></th></tr>");
    const QString row("<tr><th align='left'>%1</th><td>&nbsp;</td><td><pre>%2</pre></td></tr>");

    QString shortcuts;
    shortcuts += "<table>";
    shortcuts += header.arg(tr("Shortcuts"));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Next view:"), QKeySequence(navigate.arg(tr("Down"))).toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Previous view:"), QKeySequence(navigate.arg(tr("Up"))).toString(QKeySequence::NativeText));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Next active view:"), QKeySequence(active.arg(tr("Down"))).toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Previous active view:"), QKeySequence(active.arg(tr("Up"))).toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Most live view:"), QKeySequence("Ctrl+L").toString(QKeySequence::NativeText));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Expand view:"), QKeySequence(navigate.arg(tr("Right"))).toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Collapse view:"), QKeySequence(navigate.arg(tr("Left"))).toString(QKeySequence::NativeText));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Next split:"), QKeySequence(next).toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Previous split:"), QKeySequence(previous).toString(QKeySequence::NativeText));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Auto complete:"), QKeySequence("Tab").toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Auto complete backwards:"), QKeySequence("Shift+Tab").toString(QKeySequence::NativeText));
    shortcuts += "<tr/>";
    shortcuts += row.arg(tr("Find:"), QKeySequence("Ctrl+F").toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Search views:"), QKeySequence("Ctrl+S").toString(QKeySequence::NativeText));
    shortcuts += row.arg(tr("Search users:"), QKeySequence("Ctrl+U").toString(QKeySequence::NativeText));
    shortcuts += "</table>";

    QString commands;
    commands += "<table>";
    commands += header.arg(tr("Commands"));
    commands += "<tr/>";
    commands += row.arg("/AWAY", "(&lt;reason&gt;)");
    commands += row.arg("/CLEAR", "");
    commands += row.arg("/CLOSE", "");
    commands += row.arg("/INVITE", "&lt;user&gt; (&lt;channel&gt;)");
    commands += row.arg("/JOIN", "&lt;channel&gt; (&lt;key&gt;)");
    commands += row.arg("/KICK", "(&lt;channel&gt;) &lt;user&gt; (&lt;reason&gt;)");
    commands += row.arg("/ME", "&lt;message&gt;");
    commands += row.arg("/MODE", "(&lt;channel/user&gt;) (&lt;mode&gt;) (&lt;arg&gt;)");
    commands += row.arg("/MSG", "&lt;user/channel> &lt;message&gt;");
    commands += row.arg("/NAMES", "(&lt;channel&gt;)");
    commands += row.arg("/NICK", "&lt;nick&gt;");
    commands += row.arg("/NOTICE", "&lt;channel/user&gt; &lt;message&gt;");
    commands += row.arg("/PART", "(&lt;channel&gt;) (&lt;message&gt;)");
    commands += row.arg("/QUERY", "&lt;user&gt;");
    commands += row.arg("/QUIT", "(&lt;message&gt;)");
    commands += row.arg("/QUOTE", "&lt;command&gt; (&lt;parameters&gt;)");
    commands += row.arg("/TOPIC", "(&lt;channel&gt;) (&lt;topic&gt;)");
    commands += row.arg("/WHOIS", "&lt;user&gt;");
    commands += row.arg("/WHOWAS", "&lt;user&gt;");

    QString table("<table><td>%1</td><td width='25'></td><td>%2</td></table>");
    setText(table.arg(shortcuts, commands));

    adjustSize();
    QRect rect = geometry();
    rect.moveCenter(parentWidget()->geometry().center());
    move(rect.topLeft());

    show();
    raise();
    setFocus();
    activateWindow();
}
Exemplo n.º 22
0
void Explorer::forceSynchronize(const QString& name_) {
	QFileInfo fi(name_);
	QString path = fi.canonicalPath();
	navigate(path);
}
Exemplo n.º 23
0
void Robot::navigateTarget() {
	navigation.solveTo(currentTarget);
	navigate();
}
Exemplo n.º 24
0
void CommandExecutionEngine::execute(Visualization::Item *originator, const QString& command)
{
	deleteLastCommandResult();

	QString trimmed = command.trimmed();

	if ( !doQuotesMatch(command, QUOTE_SYMBOLS, ESCAPE_SYMBOLS) )
	{
		lastCommandResult = new CommandResult(new CommandError("A quoted string expands past the end of the command."));
		lastCommandResult->errors().first()->addResolutionTip("Try inserting a matching quote.");
		return;
	}

	QString navigation = extractNavigationString(trimmed);

	// This is the node where we begin trying to process the command
	Visualization::Item* source = originator;
	// Alter the source node according to the requested navigation location.
	if (!navigation.isEmpty()) source = navigate(originator, navigation);

	// This is the node (source or one of its ancestors) where we manage to process the command.
	Visualization::Item* target = source;

	QStringList tokens = tokenize(trimmed, QUOTE_SYMBOLS, ESCAPE_SYMBOLS);

	bool processed = false;

	while(target != nullptr && !processed)
	{
		GenericHandler* handler = dynamic_cast<GenericHandler*> (target->handler());

		if (handler)
		{
			for(int i = 0; i< handler->commands().size(); ++i)
			{
				if ( handler->commands().at(i)->canInterpret(source, target, tokens) )
				{
					lastCommandResult = handler->commands().at(i)->execute(source, target, tokens);

					if (lastCommandResult->code() != CommandResult::CanNotInterpret)
					{
						processed = true;
						break;
					}
					else deleteLastCommandResult();
				}
			}
		}

		if (!processed) target = target->parent();
	}

	// If no item can process this command dispatch it to the SceneItem
	if (!processed && originator != originator->scene()->sceneHandlerItem())
	{
		GenericHandler* handler = dynamic_cast<GenericHandler*> (source->scene()->sceneHandlerItem()->handler());

		if ( handler )
		{
			for (int i = 0; i < handler->commands().size(); ++i)
			{
				if ( handler->commands().at(i)->canInterpret(source, nullptr, tokens) )
				{
					lastCommandResult = handler->commands().at(i)->execute(source, nullptr, tokens);

					if ( lastCommandResult->code() != CommandResult::CanNotInterpret )
					{
						processed = true;
						break;
					}
					else deleteLastCommandResult();
				}
			}
		}
	}

	// If the command is still not processed this is an error
	if (!processed)
	{
		lastCommandResult = new CommandResult(new CommandError("Unknown command '" + command + "' "));
		InteractionBase::log()->add(Logger::Log::LOGWARNING, "Unknown command: " + command);
	}
}
Exemplo n.º 25
0
void Robot::planAction(void) {
	ownTime_ms_delta_t hurryUp = 1000*60*11; // If it's time to abandon everything else and get current targets to the goal 
	static ownTime_ms_delta_t explRollStartTime = 0;
	static ownTime_ms_delta_t hidasprkl = 0;
	if (!manual.enabled) {
		if(statistics.taskStartTime == 0)
			statistics.taskStartTime = ownTime_get_ms();
		SLAM::RobotLocation p = slam.getCurrentMapData().getRobotLocation();
		std::cout << "PLANNER: ROBOT LOCATION " << p.x << " " << p.y << " " << p.theta << std::endl;
		switch (taskState) {
			case START: // roll around to discover empty areas
				if (!motionControl.rollStart(p))
					taskState = EXPLORE;
				break;
			case EXPLORE: // seek unexplored areas until targets visible
				if (ownTime_get_ms_since(hidasprkl) >= 5000) {
					hidasprkl = ownTime_get_ms();
					updateTargets();
				}
				if (targets.size()) {
					if (motionControl.running())
						motionControl.stop();
					taskState = GO_TO_TARGET;
					selectTarget();
					navigateTarget();
				} else {
					if (!motionControl.iterate(p) && explRollStartTime == 0) {
						explRollStartTime = ownTime_get_ms();
						motionControl.setCtrl(0, 1.0 / 10 * M_PI);
					} else if (explRollStartTime != 0 && ownTime_get_ms_since(explRollStartTime) > 3000) {
						motionControl.setCtrl(0, 0);
						SLAM::Location to(navigation.farthest());
						explRollStartTime = 0;
						std::cout << "PLANNER: explore to farthest " << to.x << " " << to.y << std::endl;
						navigation.solveTo(to);
						navigate();
						//explore();
					}
				}
				break;
			case GO_TO_TARGET: // Move near the nearest target to open the hatch
				if (motionControl.routeLeft() < HATCH_OPEN_DISTANCE) {
					if (approachStarted < 1) {
						approachStarted = ownTime_get_ms();
						break;
					}
					camera.rotateNear();
					if(ownTime_get_ms_since(approachStarted) < 1000) {
						if (motionControl.running()) {
							motionControl.stop();
						}
						break;
					}
					servoControl.setHatch(false);
					navigateTarget();
					approachStarted = 0;
					taskState = APPROACH_PICK_UP;
				}
				motionControl.iterate(p);
				break;
			case APPROACH_PICK_UP: // Move on close to target
				if (!motionControl.iterate(p)) {
					float clear = navigation.wallClearance(p);
					float walk = clear < PICKUPWALK ? clear : PICKUPWALK;
					navigation.solveTo(SLAM::Location(p.x + cos(p.theta) * walk, p.y + sin(p.theta) * walk));
					navigate();
					taskState = PICK_UP;
				}
				break;
			case GO_RETURN_TO_GOAL: // Try to find a route to the goal -- if cannot, explore more
				ownSleep_ms(1000);
				updateTargets();
				if (navigation.solveTo(SLAM::Location(0, 0))) {
					navigate();
					taskState = RETURN_TO_GOAL;
				} else {
					taskState = EXPLORE;
				}
				break;
			case RETURN_TO_GOAL: // Going to goal
				if (!motionControl.iterate(p)) {
					float clear = navigation.wallClearance(p);
					float walk = clear < GOALWALK ? clear : GOALWALK;
					navigation.solveTo(SLAM::Location(p.x + cos(p.theta) * walk, p.y + sin(p.theta) * walk));
					navigate();
					camera.rotateFar();
					taskState = GOAL_WALKHAX;
				}
				break;
			case GOAL_WALKHAX: // in goal, drive a bit forwards to be able to drop targets correctly
				if (!motionControl.iterate(p)) {
					taskState = RELEASE_TARGETS;
					servoControl.setHatch(false);
				}
				break;
			case PICK_UP: // when target is near, drive a bit forwards to be sure
				if (!motionControl.iterate(p)) {
					servoControl.setHatch(true);
					camera.rotateFar();
					numberOfPickUps++;
					speak("Pallo " + lexical_cast(numberOfPickUps));
					if(numberOfPickUps >= 10) {
						taskState = GO_RETURN_TO_GOAL;
					} else {
						if (targets.empty()) {
							taskState = EXPLORE;
						} else {
							selectTarget();
							navigateTarget();
							taskState = GO_TO_TARGET;
						}
						taskState = EXPLORE;
					}
				}
				break;
			case RELEASE_TARGETS: // eggs hatching, get back
				servoControl.setHatch(false);
				if (!motionControl.backFromGoal(p)) {
					taskState = RETURN_TO_GOAL_AGAIN;
					navigation.solveTo(SLAM::Location(0, 0));
					navigate();
				}
				break;
			case RETURN_TO_GOAL_AGAIN: // Going to goal another time to get last balls rolling
				if (!motionControl.iterate(p)) {
					float clear = navigation.wallClearance(p);
					float walk = clear < GOALWALK_AGAIN ? clear : GOALWALK_AGAIN;
					navigation.solveTo(SLAM::Location(p.x + cos(p.theta) * walk, p.y + sin(p.theta) * walk));
					navigate();
					camera.rotateFar();
					taskState = GOAL_WALKHAX_AGAIN;
				}
				break;
			case GOAL_WALKHAX_AGAIN: // in goal, drive a bit forwards to be able to drop targets correctly
				if (!motionControl.iterate(p)) {
					taskState = RELEASE_TARGETS_AGAIN;
				}
				break;
			case RELEASE_TARGETS_AGAIN: // they see me rollin', they hatin'
				if (!motionControl.backFromGoal(p)) {
					taskState = END_STATE;
				}
				break;
			case END_STATE: // world domination succeeded
				camera.rotateNear();
				speak("Hurraa");
				manual.enabled = true;
				break;
			case BACK_OFF: // bumpers hit. exit to exploring when bumpers not hitting anymore
				std::cout << "PLANNER: DYNDYNDYY" << std::endl;
				motionControl.backOff();
				break;
			default: throw std::runtime_error("Bad task state number"); break;
		}
		float timeSince = ownTime_get_ms_since(statistics.taskStartTime);
		if (timeSince >= hurryUp && (
				taskState == START
				|| taskState == EXPLORE
				|| taskState == GO_TO_TARGET
				|| taskState == APPROACH_PICK_UP
				|| taskState == PICK_UP
		   )) {
			taskState = GO_RETURN_TO_GOAL;
			speak("Hop hop hop");
		}
		std::cout << "PLANNER: CURRENT TASK: " << taskdescr[taskState] << ", time elapsed " << (timeSince / 1000) << std::endl;
	}
}