Exemplo n.º 1
0
void SCgWindow::createActions()
{
    mActionFind = new QAction(findIcon("edit-find.png"), tr("&Find by Identifier..."), this);
    mActionFind->setShortcuts(QKeySequence::Find);
    mActionFind->setIcon(QIcon::fromTheme("edit-find", findIcon("edit-find.png")));
    connect(mActionFind, SIGNAL(triggered()), this, SLOT(showTextSearch()));

    mActionUndo = mUndoStack->createUndoAction(this, tr("Undo"));//new QAction(tr("Undo"),this);
    mActionUndo->setEnabled(false);
    mActionUndo->setShortcut(QKeySequence::Undo);
    mActionUndo->setIcon(QIcon::fromTheme("edit-undo", findIcon("edit-undo.png")));

    mActionRedo = mUndoStack->createRedoAction(this, tr("Redo"));//new QAction(tr("Redo"),this);
    mActionRedo->setEnabled(false);
    mActionRedo->setShortcut(QKeySequence::Redo);
    mActionRedo->setIcon(QIcon::fromTheme("edit-redo", findIcon("edit-redo.png")));

    mActionPrinterGrid = new QAction(tr("Show printer grid"), this);
    connect(mActionPrinterGrid, SIGNAL(triggered()), this, SLOT(showPrinterGridDialog()));

//    mActionMinMap = new QAction(tr("Minimap"), this);
//    mActionMinMap->setCheckable(true);
//    mActionMinMap->setShortcuts();
//    fi.setFile();
//    mActionMinMap->setIcon(QIcon(fi.absoluteFilePath()));
//    connect(mActionMinMap, SIGNAL(triggered(bool)), this, SLOT(setVisibleMinMap(bool)));
}
Exemplo n.º 2
0
QString IconCache::getIconPath(const QString& site)
{

	QString cachedName = site;
	if (site.contains("http"))
		cachedName = QUrl(site).host();

	qDebug() << cachedName;

	//cachedName = cachedName.replace("http:", "").replace("https:", "").replace("/", "");
	QFileInfo info;
	info.setFile(cachePath, cachedName + ".png");

	if (info.exists())
		return info.size() > 0 ? info.absoluteFilePath() : QString();
	info.setFile(cachePath, cachedName + ".ico");
	if (info.exists())
		return info.size() > 0 ? info.absoluteFilePath() : QString();

	if (!site.startsWith("http"))
		return "";


	// Call the main thread to grab the icon in the background
	emit findIcon(QUrl("http://" + QUrl(site).host() + "/favicon.ico"));

	return "";
}
Exemplo n.º 3
0
bool LXQtTray::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
    if (eventType != "xcb_generic_event_t")
        return false;

    xcb_generic_event_t* event = static_cast<xcb_generic_event_t *>(message);

    TrayIcon* icon;
    int event_type = event->response_type & ~0x80;

    switch (event_type)
    {
        case ClientMessage:
            clientMessageEvent(event);
            break;

//        case ConfigureNotify:
//            icon = findIcon(event->xconfigure.window);
//            if (icon)
//                icon->configureEvent(&(event->xconfigure));
//            break;

        case DestroyNotify: {
            unsigned long event_window;
            event_window = reinterpret_cast<xcb_destroy_notify_event_t*>(event)->window;
            icon = findIcon(event_window);
            if (icon)
            {
                icon->windowDestroyed(event_window);
                mIcons.removeAll(icon);
                delete icon;
            }
            break;
        }
        default:
            if (event_type == mDamageEvent + XDamageNotify)
            {
                xcb_damage_notify_event_t* dmg = reinterpret_cast<xcb_damage_notify_event_t*>(event);
                icon = findIcon(dmg->drawable);
                if (icon)
                    icon->update();
            }
            break;
    }

    return false;
}
Exemplo n.º 4
0
static void iconPopup(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
 DTIconRec *dticon;

 if (!(dticon = findIcon(w)))
     return;
 XmMenuPosition(dticon->popup, (XButtonPressedEvent *)event);
 XtManageChild(dticon->popup);
}
Exemplo n.º 5
0
GFXTexHandle EditorIconRegistry::findIcon( const SimObject *object )
{
	if( object == NULL )
		return mDefaultIcon;

   AbstractClassRep *classRep = object->getClassRep();

   return findIcon( classRep );
}   
Exemplo n.º 6
0
void RazorTray::x11EventFilter(XEvent* event) {
  TrayIcon* icon;

  switch(event->type) {
  case ClientMessage:
    if(event->xany.window == mTrayId)
      clientMessageEvent(&(event->xclient));
    break;

//        case ConfigureNotify:
//            icon = findIcon(event->xconfigure.window);
//            if (icon)
//                icon->configureEvent(&(event->xconfigure));
//            break;

  case SelectionClear:
    stopTray();
    break;

  case DestroyNotify:
    icon = findIcon(event->xany.window);

    if(icon) {
      mIcons.removeAll(icon);
      delete icon;
    }

    break;

  default:

    if(event->type == mDamageEvent + XDamageNotify) {
      XDamageNotifyEvent* dmg = reinterpret_cast<XDamageNotifyEvent*>(event);
      icon = findIcon(dmg->drawable);

      if(icon)
        icon->update();
    }

    break;
  }
}
Exemplo n.º 7
0
MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    delete ui->menuPreferences;

    setWindowIcon(findIcon("document-print", ":/images/print-48x48"));
    setWindowTitle(tr("Boomaga"));

    setStyleSheet("QListView::item { padding: 2px;}");

    foreach(Printer *printer, availablePrinters())
    {
        ui->printersCbx->addPrinter(printer);
    }
Exemplo n.º 8
0
void EditMetadataDialog::updateGenreImage(void)
{
    QString genre = m_genreEdit->GetText();
    QString file;

    if (m_genreIcon)
    {
        file = findIcon("genre", genre.toLower());
        if (!file.isEmpty())
        {
            m_genreIcon->SetFilename(file);
            m_genreIcon->Load();
        }
        else
            m_genreIcon->Reset();
    }
}
Exemplo n.º 9
0
void EditMetadataDialog::updateArtistImage(void)
{
    QString artist =  m_artistEdit->GetText();

    QString file;

    if (m_artistIcon)
    {
        file = findIcon("artist", artist.toLower());
        if (!file.isEmpty())
        {
            m_artistIcon->SetFilename(file);
            m_artistIcon->Load();
        }
        else
            m_artistIcon->Reset();
    }
}
Exemplo n.º 10
0
GFXTexHandle EditorIconRegistry::findIcon( const char *className )
{   
   // On the chance we have this className already in the map,
   // check there first because its a lot faster...
   
   StringNoCase key( className );
   IconMap::Iterator icon = mIcons.find( key );

   if ( icon != mIcons.end() && icon->value.isValid() )
      return icon->value;

   // Well, we could still have an icon for a parent class,
   // so find the AbstractClassRep for the className.
   //
   // Unfortunately the only way to do this is looping through
   // the AbstractClassRep linked list.

   bool found = false;
   AbstractClassRep* pClassRep = AbstractClassRep::getClassList();
   
   while ( pClassRep )
   {
      if ( key.equal( pClassRep->getClassName(), String::NoCase ) )
      {
         found = true;
         break;
      }
      pClassRep = pClassRep->getNextClass();
   }

   if ( !found )
   {
      Con::errorf( "EditorIconRegistry::findIcon, passed className %s was not an AbstractClassRep!", key.c_str() );
      return mDefaultIcon;
   }
   
   // Now do a find by AbstractClassRep recursively up the class tree...
   return findIcon( pClassRep );
}
Exemplo n.º 11
0
static void moveIconCb(Widget w, XEvent *event, String *params,
		       Cardinal *num_params)
{
 Window root, child;
 static DTIconRec *dticon;
 static int x_offset, y_offset;
 int x, y;
 unsigned int mask;

 if (event->xany.type == ButtonPress)
 {
     if (!(dticon = findIcon(w)))
	 return;
     dticons_blocked = True;
     XQueryPointer(dpy, XtWindow(dticon->shell), &root, &child, &x, &y,
		   &x_offset, &y_offset, &mask);
 }
 else if (event->xany.type == ButtonRelease)
 {
     if (dticon->moved)
     {
	 if (resources.auto_save)
	     writeDTIcons(True);
	 dticon->moved = False;
	 dticons_blocked = False;
     }
 }
 else
 {
     dticon->x = event->xbutton.x_root - x_offset;
     dticon->y = event->xbutton.y_root - y_offset;
     dticon->moved = True;
     XtVaSetValues(dticon->shell,
		   XmNx, (Dimension) dticon->x,
		   XmNy, (Dimension) dticon->y, NULL);
 }
}
Exemplo n.º 12
0
void AlbumArtImages::findImages(void)
{
    while (!m_imageList.empty())
    {
        delete m_imageList.back();
        m_imageList.pop_back();
    }

    if (m_parent == NULL)
        return;

    int trackid = ID_TO_ID(m_parent->ID());
    int repo = ID_TO_REPO(m_parent->ID());

    if (repo == RT_Radio)
    {
        MSqlQuery query(MSqlQuery::InitCon());
        query.prepare("SELECT logourl FROM music_radios WHERE intid = :ID;");
        query.bindValue(":ID", trackid);
        if (query.exec())
        {
            while (query.next())
            {
                QString logoUrl = query.value(0).toString();
                AlbumArtImage *image = new AlbumArtImage();
                image->id = -1;
                image->filename = logoUrl;
                image->imageType = IT_FRONTCOVER;
                image->embedded = false;

                m_imageList.push_back(image);
            }
        }
    }
    else
    {
        if (trackid == 0)
            return;

        QFileInfo fi(m_parent->Filename(false));
        QString dir = fi.path();

        MSqlQuery query(MSqlQuery::InitCon());
        query.prepare("SELECT albumart_id, CONCAT_WS('/', music_directories.path, "
                "music_albumart.filename), music_albumart.filename, music_albumart.imagetype, "
                "music_albumart.embedded "
                "FROM music_albumart "
                "LEFT JOIN music_directories ON "
                "music_directories.directory_id = music_albumart.directory_id "
                "WHERE music_directories.path = :DIR "
                "OR song_id = :SONGID "
                "ORDER BY music_albumart.imagetype;");
        query.bindValue(":DIR", dir);
        query.bindValue(":SONGID", trackid);
        if (query.exec())
        {
            while (query.next())
            {
                AlbumArtImage *image = new AlbumArtImage();
                bool embedded = (query.value(4).toInt() == 1);
                image->id = query.value(0).toInt();

                if (embedded)
                    image->filename = GetConfDir() + "/MythMusic/AlbumArt/" + query.value(1).toString();
                else
                    image->filename = gMusicData->musicDir + query.value(1).toString();

                image->imageType = (ImageType) query.value(3).toInt();
                image->embedded = embedded;

                m_imageList.push_back(image);
            }
        }

        // add any artist images
        QString artist = m_parent->Artist().toLower();
        if (findIcon("artist", artist) != QString())
        {
            AlbumArtImage *image = new AlbumArtImage();
            image->id = -1;
            image->filename = findIcon("artist", artist);
            image->imageType = IT_ARTIST;
            image->embedded = false;

            m_imageList.push_back(image);
        }
    }
}
Exemplo n.º 13
0
void KGridWidget::cacheImages()
{
	seaPng = QPixmap(findIcon("sea.png"));
	waterPng = QPixmap(findIcon("water.png"));
	hitPng = QPixmap(findIcon("hit.png"));
	borderPng = QPixmap(findIcon("border.png"));
	deathPng = QPixmap(findIcon("death.png"));
	ship1p1Png = QPixmap(findIcon("ship1-1.png"));
	ship1p1rPng = QPixmap(findIcon("ship1-1-r.png"));
	ship2p1Png = QPixmap(findIcon("ship2-1.png"));
	ship2p1rPng = QPixmap(findIcon("ship2-1-r.png"));
	ship2p2Png = QPixmap(findIcon("ship2-2.png"));
	ship2p2rPng = QPixmap(findIcon("ship2-2-r.png"));
	ship3p1Png = QPixmap(findIcon("ship3-1.png"));
	ship3p1rPng = QPixmap(findIcon("ship3-1-r.png"));
	ship3p2Png = QPixmap(findIcon("ship3-2.png"));
	ship3p2rPng = QPixmap(findIcon("ship3-2-r.png"));
	ship3p3Png = QPixmap(findIcon("ship3-3.png"));
	ship3p3rPng = QPixmap(findIcon("ship3-3-r.png"));
	ship4p1Png = QPixmap(findIcon("ship4-1.png"));
	ship4p1rPng = QPixmap(findIcon("ship4-1-r.png"));
	ship4p2Png = QPixmap(findIcon("ship4-2.png"));
	ship4p2rPng = QPixmap(findIcon("ship4-2-r.png"));
	ship4p3Png = QPixmap(findIcon("ship4-3.png"));
	ship4p3rPng = QPixmap(findIcon("ship4-3-r.png"));
	ship4p4Png = QPixmap(findIcon("ship4-4.png"));
	ship4p4rPng = QPixmap(findIcon("ship4-4-r.png"));
}
Exemplo n.º 14
0
QIcon SCgWindow::icon() const
{
    return findIcon("mime_type.png");
}
Exemplo n.º 15
0
void SCgWindow::createToolBar()
{
    mToolBar = new QToolBar(this);

    mToolBar->setIconSize(QSize(32, 32));

    QActionGroup* group = new QActionGroup(mToolBar);

    // Select mode
    QAction *action = new QAction(findIcon("tool-select.png"), tr("Selection mode"), mToolBar);
    action->setCheckable(true);
    action->setChecked(true);
    action->setShortcut(QKeySequence(tr("1", "Selection mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Select] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectMode()));

    //Pair creation mode
    action = new QAction(findIcon("tool-pair.png"), tr("Pair creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("2", "Pair creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Pair] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onPairMode()));

    //Bus creation mode
    action = new QAction(findIcon("tool-bus.png"), tr("Bus creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("3", "Bus creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Bus] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onBusMode()));

    //Contour creation mode
    action = new QAction(findIcon("tool-contour.png"), tr("Contour creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("4", "Contour creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Contour] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onContourMode()));
    //
    mToolBar->addSeparator();
    //

    // align group button
    QToolButton *alignButton = new QToolButton(mToolBar);
    alignButton->setIcon(findIcon("tool-align.png"));
    alignButton->setPopupMode(QToolButton::InstantPopup);
    alignButton->setToolTip(tr("Alignment"));
    mToolBar->addWidget(alignButton);

    //Grid alignment
    action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("5", "Grid alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment()));

    // tuple alignment
    action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("6", "Tuple alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment()));

    //Vertical alignment
    action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("7", "Vertical alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment()));

    //Horizontal alignment
    action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("8", "Horizontal alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment()));

    // selection group button
    QToolButton *selectButton = new QToolButton(mToolBar);
    selectButton->setIcon(findIcon("tool-select-group.png"));
    selectButton->setPopupMode(QToolButton::InstantPopup);
    selectButton->setToolTip(tr("Selection group"));
    mToolBar->addWidget(selectButton);

    // input/output selection
    action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput()));

    // sbgraph selection
    action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph()));

    mToolBar->addSeparator();

    action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Export image")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onExportImage()));

    //
    mToolBar->addSeparator();
    //
    //Zoom in
    action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("+", "Zoom in")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn()));

    //Scale combobox
    QComboBox* b = new QComboBox(mToolBar);
    b->setEditable(true);
    b->setInsertPolicy(QComboBox::NoInsert);
    b->addItems(SCgWindow::mScales);
    b->setCurrentIndex(mScales.indexOf("100"));
    mZoomFactorLine = b->lineEdit();
    mZoomFactorLine->setInputMask("D90%");
    mToolBar->addWidget(b);
    connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&)));
    connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal)));

    //Zoom out
    action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("-", "Zoom out")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut()));

    mToolBar->setWindowTitle(tr("SCg Tools"));
    mToolBar->setObjectName("SCgMainToolBar");

    //! @bug toolbar state is not saved
    mToolBar->setMovable(false);
}
Exemplo n.º 16
0
XIcon * XDesktopContainer::parseIconEvents()
{
    XIcon * icon;

    icon = findIcon(event.xmotion.window);
   
    if (icon)
    {
        switch (event.type)
        {
            case ButtonPress:
                setEventState();

                if (event.xbutton.button == Button1)
                    currentAction.setLeft(hold);                
                else if (event.xbutton.button == Button2)
                    currentAction.setMiddle(hold);
                else if (event.xbutton.button == Button3)
		             currentAction.setRight(hold);
		
                if(event.xbutton.window == *icon->getImageWindow()  || event.xbutton.window == *icon->getCaptionWindow()){
			 if(bg->spareRoot){
				 icon->pressImage();
			 }
		}
                        
                break;
			
            case MotionNotify:
                if (icon->isDragging() && !isLocked())
		     icon->dragMotionNotify(event);
                break;

            case ButtonRelease:
                setEventState();

                if (event.xbutton.button == Button1)
                    translateButtonRelease(0);
                else if (event.xbutton.button == Button2)
                    translateButtonRelease(1);
                else if (event.xbutton.button == Button3)
		            translateButtonRelease(2);

		if(event.xbutton.window == *icon->getImageWindow() || event.xbutton.window == *icon->getCaptionWindow()){
			 if(bg->spareRoot){
				 icon->unpressImage();
			 }
	        }

                break;
			    
            case Expose:
                //since we are redrawing the whole window we can ignore
                //multiple expose events and only draw text once
		 if (event.xexpose.count == 0){
			 if(bg->spareRoot){
                      		icon->draw();	
			 }  
		  }
                break;
            case EnterNotify:
	        if(event.xcrossing.window == *icon->getImageWindow() || event.xcrossing.window == *icon->getCaptionWindow()){
			if(bg->spareRoot){
				icon->mouseOverEffect();
				icon->event_enter_notify();
			}
		 }
                break;
            case LeaveNotify:  
	        if(event.xcrossing.window == *icon->getImageWindow() || event.xcrossing.window == *icon->getCaptionWindow()){
			if(bg->spareRoot){
				icon->mouseOffEffect();
				icon->event_leave_notify();
			}
		}
                break;     
        }
    }
    return icon;
}
Exemplo n.º 17
0
void SCgWindow::createToolBar()
{
    mToolBar = new QToolBar(this);

    mToolBar->setIconSize(QSize(32, 32));

    QActionGroup* group = new QActionGroup(mToolBar);

    // Select mode
    QAction *action = new QAction(findIcon("tool-select.png"), tr("Selection mode"), mToolBar);
    action->setCheckable(true);
    action->setChecked(true);
    action->setShortcut(QKeySequence(tr("1", "Selection mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Select] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectMode()));

    //Pair creation mode
    action = new QAction(findIcon("tool-pair.png"), tr("Pair creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("2", "Pair creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Pair] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onPairMode()));

    //Bus creation mode
    action = new QAction(findIcon("tool-bus.png"), tr("Bus creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("3", "Bus creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Bus] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onBusMode()));

    //Contour creation mode
    action = new QAction(findIcon("tool-contour.png"), tr("Contour creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("4", "Contour creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Contour] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onContourMode()));
    //
    mToolBar->addSeparator();
    //

    // align group button
    QToolButton *alignButton = new QToolButton(mToolBar);
    alignButton->setIcon(findIcon("tool-align.png"));
    alignButton->setPopupMode(QToolButton::InstantPopup);
    mToolBar->addWidget(alignButton);

    //Grid alignment
    action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("5", "Grid alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment()));

    // tuple alignment
    action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("6", "Tuple alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment()));

    //Vertical alignment
    action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("7", "Vertical alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment()));

    //Horizontal alignment
    action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("8", "Horizontal alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment()));

    // Energy-based layout
    action = new QAction(findIcon("tool-align-energy.png"), tr("Energy-based layout"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("9", "Energy-based layout")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onEnergyBasedLayout()));


    // selection group button
    QToolButton *selectButton = new QToolButton(mToolBar);
    selectButton->setIcon(findIcon("tool-select-group.png"));
    selectButton->setPopupMode(QToolButton::InstantPopup);
    mToolBar->addWidget(selectButton);

    // input/output selection
    action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput()));

    // sbgraph selection
    action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph()));

    mToolBar->addSeparator();

    action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Export image")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onExportImage()));

    //
    mToolBar->addSeparator();
    //

    //Zoom label
    mZoomLabel = new QLabel(mToolBar);
    mToolBar->addWidget(mZoomLabel);

    //Zoom in
    action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("+", "Zoom in")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn()));

    //Zoom slider
    mZoomSlider = new QSlider(Qt::Vertical);

    //mZoomSlider->setInvertedAppearance(false);
    mZoomSlider->setRange(25, 200);
    mZoomSlider->setTickPosition(QSlider::TicksBelow);
    mZoomSlider->setTickInterval(25);
    mZoomSlider->setFixedHeight(150);
    mZoomSlider->setSliderPosition(100);
    mToolBar->addWidget(mZoomSlider);
    connect(mZoomSlider, SIGNAL(valueChanged(int)), mView, SLOT(setScale(int)));
    connect(mZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomLabel(int)));
    connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal)));

    //Zoom out
    action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("-", "Zoom out")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut()));

    mToolBar->setWindowTitle(tr("SCg Tools"));
    mToolBar->setObjectName("SCgMainToolBar");

    //! @bug toolbar state is not saved
    mToolBar->setMovable(false);
}