Beispiel #1
0
/**
  * clear(int row, int column, bool allowedClear)
  * clear recursively reveals all zeros and reveals its neighbors that are not mines
  * @param int - The row to inspect
  * @param int - The column to inspect
  * @param bool - If we are allowed to clear the particular cell. This is used when recursively clearing something not a zero -- it is a neighbor of a zero so it is not allowed to clear others
  */
void MainWindow::clear(int row, int column, bool allowedClear)
{
    //Retrieve the button
    QString coordinates = QString::number(row) + "," + QString::number(column);

    MineSweeperButton *buttonPushed = qobject_cast<MineSweeperButton *>(signalMapper->mapping(coordinates));

    //Ensure that the button is not flat, that the value is not a mine, that it is allowed to clear (not something that isn't a zero) and it isn't flagged
    if ( buttonPushed->isFlat () == false && game->getValue (row, column) != MINE && allowedClear == true && mineStatus[row][column] != FLAGGED_CELL)
    {
        buttonPushed->setFlat (true); //We're now flat

        //Set the image according to the value of the cell
        changeIcon(buttonPushed, row, column);

        cellsRevealed++;

        //If we have 90 cells revealed (10 mines, 90 not mines), we win the game!
        if (cellsRevealed == 90 && game->getValue(row, column) != MINE)
        {
            changeIcon(buttonPushed, row, column);
            won();
            return;
        }   // in case clearing occurs in the end of the game.

        //Make sure that we are allowed to clear
        if ( game->getValue (row, column) == 0)
            allowedClear = true;
        else
            allowedClear = false;

        //Recrusively call clear on all adjacent cells
        //Top left
        if ( (row-1) != -1 && (column -1) != -1)
            clear(row-1, column-1, allowedClear);
        //Top center
        if ( (row-1) != -1)
            clear(row-1, column, allowedClear);
        //Top right
        if ( (row-1) != -1 && (column + 1) != 10)
            clear(row-1, column+1, allowedClear);
        //Left
        if ( (column -1) != -1)
            clear(row, column-1, allowedClear);
        //Right
        if ( (column + 1) != 10)
            clear(row, column+1, allowedClear);
        //Bottom left
        if ( (row+1) != 10 && (column -1) != -1)
            clear(row+1, column-1, allowedClear);
        //Bottom center
        if ( (row+1) != 10)
            clear(row+1, column, allowedClear);
        //Bottom right
        if ( (row+1) != 10 && (column+1) != 10)
        {
            clear(row+1, column+1, allowedClear);
        }
    }
}
Beispiel #2
0
KVirtual::KVirtual()
		: KXmlGuiWindow(),
		m_view( new KVirtualView( this ) )
		//m_printer( 0 )
{
	m_id = 0;

	m_options = new KVirtualOptions();
	m_view->initOptions( m_options );
	connect( m_view,
			 SIGNAL( signalChangeDistribution( QString ) ),
			 SLOT( changeIcon( QString ) )
		   );

	m_create = new KVirtualCreateImg( this );
	connect( m_create,
			 SIGNAL( accepted( const QString &, const QString &, const QString & ) ),
			 SLOT( createVDisk( const QString &, const QString &, const QString & ) )
		   );

	// accept dnd
	setAcceptDrops( true );

	// tell the KXmlGuiWindow that this is indeed the main widget
	setCentralWidget( m_view );

	// then, setup our actions
	setupActions();

	// add a status bar
	statusBar()->show();

	// a call to KXmlGuiWindow::setupGUI() populates the GUI
	// with actions, using KXMLGUI.
	// It also applies the saved mainwindow settings, if any, and ask the
	// mainwindow to automatically save settings if changed: window size,
	// toolbar position, icon size, etc.
	setupGUI();

	if( Settings::systray_enable() )
	{
		m_systray = new KStatusNotifierItem( this );
		m_systray->setStandardActionsEnabled( true );
		m_systray->activate();
		m_systray->setStatus( KStatusNotifierItem::Passive );
	}
	else
	{
		m_systray = 0;
	}
	changeIcon( m_options->getDistrib() );
}
Beispiel #3
0
void HomeButton::changeIconOnConnectorType(Polyplexer::ConnectorType type)
{
    /*if ( type == Polyplexer::ServerTCP)
    {
        changeIcon( QPixmap(":/img/img/logo_400_blu.png") );
    }
    else*/ if ( type == Polyplexer::Tcp)
    {
        changeIcon( QPixmap(":/img/img/logo_400_yellow.png") );
    }
    else //if ( type == Serial)
    {
        changeIcon( QPixmap(":/img/img/logo_400.png") );
    }
}
Beispiel #4
0
Tray::Tray( QWidget * parent, const QString & UserName):
   QSystemTrayIcon( parent),
   icon( afqt::stoq( af::Environment::getAfRoot()) + "/icons/talk_tray.png"),
   icon_msg( afqt::stoq( af::Environment::getAfRoot()) + "/icons/talk_tray_msg.png"),
   icon_flashing( false),
   icon_state( false),
   username( UserName),
   trayToolTipHeader("afTalk users:")
{
   connect( this, SIGNAL(     activated( QSystemTrayIcon::ActivationReason )),
            this, SLOT(   trayActivated( QSystemTrayIcon::ActivationReason )));

   QAction * restoreAction = new QAction(tr("&Hide|Raise"), this);
   connect(  restoreAction,  SIGNAL( triggered()), parent, SLOT( hideRaiseDialog()));
   QAction * quitAction    = new QAction(tr("&Quit" ), this);
   connect(  quitAction,     SIGNAL( triggered()), qApp,   SLOT( quit()));

   QMenu *trayIconMenu = new QMenu( parent);
   trayIconMenu->addAction( restoreAction);
   trayIconMenu->addSeparator();
   trayIconMenu->addAction( quitAction);
   setContextMenu(trayIconMenu);

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

   setIcon( icon);
   setToolTip("af Talk");
   show();
}
Beispiel #5
0
systemTrayIcon::systemTrayIcon(QObject *parent) : QSystemTrayIcon(parent)
{
    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(systemTrayIconActivated(QSystemTrayIcon::ActivationReason)));

    connect(&m_timer, SIGNAL(timeout()), this, SLOT(changeIcon()));

    m_bMouseHorer = false;
    m_timerCheckMousePos.start(300);
    connect(&m_timerCheckMousePos, SIGNAL(timeout()), this, SLOT(checkMousePos()));
}
FullScreenPlugin::FullScreenPlugin(PluginMaster* val) 
{ 
	this->myMaster = val;
	this->name = "fullscreen";
	this->icon = "fullscreen.png";
	this->iconLock = "fullscreen.png";
	this->description = "Plein ecran";
	this->fullScreen = false;
	this->observer = false;

	changeIcon();
}
Beispiel #7
0
void systemTrayIcon::coruscateIcon(const QString &strID, const QIcon &icon1, const QIcon &icon2)
{
    stopCoruscateIcon(true);

    m_strID = strID;

    m_i8ChangeTimes = 0;
    m_icon1 = icon1;
    m_icon2 = icon2;
    m_timer.start(500);
    changeIcon();
}
Beispiel #8
0
ZoomInPlugin::ZoomInPlugin(PluginMaster* val) 
{ 
	this->myMaster = val;
	this->nbZoom = 1;
	this->name = "zoomIn";
	this->icon = "zoomIn.png";
	this->iconLock = "zoomInLock.png";
	this->description = "zoom avant sur l'image";
	this->nbZoomInMax = 5;
	this->observer = true;
	this->region = NULL;
	
	changeIcon();
}
Beispiel #9
0
void ZoomOutPlugin::buttonListener()
{
	std::cout << "Zoom arriere (" << this->myPlugin->getZoom() << ")" << std::endl;

	this->myPlugin->subZoom();
	this->myPlugin->changeIcon();
	changeIcon();

	this->myPlugin->calculRegion();

	if(this->myPlugin->getZoom() > 1)
		this->myMaster->changeCursor(Qt::CursorShape::OpenHandCursor);
	else
		this->myMaster->changeCursor(Qt::CursorShape::ArrowCursor);
}
Beispiel #10
0
void ZoomInPlugin::buttonListener()
{
	std::cout << "Zoom avant (" << this->nbZoom << ")" << std::endl;
	
	this->addZoom();
	this->myPlugin->changeIcon();
	changeIcon();

	this->calculRegion();

	if(this->nbZoom > 1)
		this->myMaster->changeCursor(Qt::CursorShape::OpenHandCursor);
	else
		this->myMaster->changeCursor(Qt::CursorShape::ArrowCursor);

	this->myMaster->zoomImage(this->myMaster->getCurrentImage(), region);

	this->myMaster->updateImage();
}
Beispiel #11
0
void UiGenerator::changeParasExclusive(const scheme::Para* multiPara) {
    qDebug() << "changeParasExclusive()";
    qDebug() << "multiPara" << (multiPara == nullptr ? nullptr : multiPara->getName());
    for(const auto& paraPtr : mParasManager->getParaSet()) {
        if(paraPtr.get() != multiPara) {
            for(auto groupBox : mButtonGroupMap.values(paraPtr.get())) {
                /**
                  * when multiPara is nullptr, means multi is some -> null
                  *     then all paras exclusive = false
                  * when multiPara is not null, means null -> some
                  *     then all other paras exclusive = true
                  */
                groupBox->setExclusive(multiPara != nullptr);
            }
        }
    }
    static const scheme::Para* lastMultiPara = nullptr;
    changeIcon(lastMultiPara != nullptr ? lastMultiPara : multiPara);
    lastMultiPara = multiPara;
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: about(); break;
        case 1: changeStyle((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 2: changeSize((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: changeSize(); break;
        case 4: changeIcon(); break;
        case 5: addImages(); break;
        case 6: removeAllImages(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    progress = 0;
    view = new QWebView(this);
    setCentralWidget(view);
    resize(800, 600);

    // 关联信号和槽
    connect(view, SIGNAL(loadProgress(int)), this, SLOT(setProgress(int)));
    connect(view, SIGNAL(titleChanged(QString)), this, SLOT(adjustTitle()));
    connect(view, SIGNAL(loadFinished(bool)), this, SLOT(finishLoading(bool)));

    locationEdit = new QLineEdit(this);
    connect(locationEdit, SIGNAL(returnPressed()), this, SLOT(changeLocation()));

    // 向工具栏添加动作和部件
    ui->mainToolBar->addAction(view->pageAction(QWebPage::Back));
    ui->mainToolBar->addAction(view->pageAction(QWebPage::Forward));
    ui->mainToolBar->addAction(view->pageAction(QWebPage::Reload));
    ui->mainToolBar->addAction(view->pageAction(QWebPage::Stop));
    // 添加历史动作
    ui->mainToolBar->addAction(tr("历史"), this, SLOT(showHistory()));
    ui->mainToolBar->addWidget(locationEdit);

    // 设置并加载初始网页地址
    locationEdit->setText("http://www.baidu.com");
    view->load(QUrl("http://www.baidu.com"));

    // 必须先设置图标数据库路径
    view->settings()->setIconDatabasePath("./");
    connect(view, SIGNAL(iconChanged()), this, SLOT(changeIcon()));

    historyList = new QListWidget;
    historyList->setWindowTitle(tr("历史记录"));
    historyList->setMinimumWidth(300);
    connect(historyList, SIGNAL(clicked(QModelIndex)), this, SLOT(gotoHistory(QModelIndex)));
}
Beispiel #14
0
CustomTrayIcon::CustomTrayIcon(QObject* parent) : QSystemTrayIcon(parent)
{

/*#ifdef Q_OS_MAC
    // Yes the files names are inverted...
    this->iconActive = QIcon(":/images/flat.sips.png");
    this->iconTransfer = QIcon(":/images/PydioSync-Systray-Windows-Transfer.png");
    this->iconInactive = QIcon(":/images/PydioSync-Systray-Mac-Inactive.png");
#else*/
    this->iconActive = QIcon(":/images/PydioSync-Systray-Mac.png");
    this->iconTransfer = QIcon(":/images/PydioSync-Systray-Mac-Transfer.png");
    this->iconInactive = QIcon(":/images/PydioSync-Systray-Mac-Inactive.png");
//#endif

    this->debugMode = true;
    this->pathToWinAgent = pathToWinAgent;
    this->syncAgentUp = false;
    this->setIconNormal();
    this->createMainMenu();
    this->jobMenus = new QHash<QString, JobMenu*>();
    this->globalRunningStatus = false;
    this->singleJob = NULL;
    this->working = false;
    this->animationOn = false;
    this->normalIcon = false;
    this->agentConnectedToInternet = true;

    this->animationTimer = new QTimer(this);
    this->animationTimer->setInterval(1100);
    connect(animationTimer, SIGNAL(timeout()), this, SLOT(changeIcon()));
    separatorAction = new QAction(this);
    separatorAction->setSeparator(true);
    singleJobLocal = new QAction(tr("Open local folder"), this);
    singleJobLocal->setIcon(QIcon(":/images/folder-32.png"));
    connect(singleJobLocal, SIGNAL(triggered()), this, SLOT(openSingleJobLocal()));
    singleJobRemote = new QAction(tr("Open remote"), this);
    singleJobRemote->setIcon(QIcon(":/images/world.png"));
    connect(singleJobRemote, SIGNAL(triggered()), this, SLOT(openSingleJobRemote()));
    this->checkJobs();
}
Beispiel #15
0
void UiGenerator::generateUi() {
    auto paraListWidgetPtr = mPanel->getParaListWidget();
    auto stackedViewPtr = mPanel->getStackedWidget();
    auto parent = mPanel.get();

    for(auto& paraPtr : mParasManager->getParaSet()) {
        auto& para = *paraPtr;
        QWidget* specialWidget = createSpecialParaWidget(para, parent);
        if(specialWidget != nullptr) {
            stackedViewPtr->addWidget(specialWidget);
        } else {
            stackedViewPtr->addWidget(generateUi(para, parent));
        }
        paraListWidgetPtr->addItem(createListWidgetItem(para, paraListWidgetPtr));
    }
    paraListWidgetPtr->setMinimumWidth(paraListWidgetPtr->sizeHintForColumn(0));
    QObject::connect(paraListWidgetPtr, &QListWidget::currentRowChanged, [this](int row){
        changeIcon(mParasManager->getParaSet()[row].get());
    });
    auto multiPara = mParasManager->getMultiSelPara();
    if(multiPara != nullptr)
        changeParasExclusive(multiPara);
}
Beispiel #16
0
const void GSquare::createMenu()
{
    this->setMinimumSize(800, 600);
    this->setMaximumSize(800, 600);

    // Creer la scene
    scene = new QGraphicsScene(this);


    // Creer le fond
    QPixmap pix = QPixmap("fond.png", "PNG");
    fond = new QGraphicsPixmapItem(pix, NULL, scene);

    //  qreal scale = (qreal)((800.0 - pix.size().height()) / /*(pix.size().width())*/ 1000);
    qreal scale = 0.62;
    fond->setScale(scale);


    // Creer la vue
    this->vw_square = new QGraphicsView(scene);
    this->vw_square->setBaseSize(900, 700);
    this->vw_square->setMaximumSize(900, 700);
    this->vw_square->setMinimumSize(900, 700);

    QTransform matrice;
 //   matrice.rotateRadians(-40, Qt::XAxis);
//    matrice.translate(100, 100,     );
   // matrice.scale(1.2, 1.2);
    this->vw_square->setTransform(matrice, true);
    this->vw_square->show();

    //Boutton menu
    menu_btn = new QPushButton(NULL);
    menu_btn->setIcon(QIcon("ButtonPlay.png"));
    menu_btn->setFlat(true);
    menu_btn->setAutoFillBackground(false);
//    menu_btn->setTaken(false);
    menu_btn->setGeometry(QRect(800 / 2 - 100, 600 / 2 - 50, 200, 100));
    menu_btn->setIconSize(QSize(200, 100));
    proxy_btn = new QGraphicsProxyWidget(fond);
    proxy_btn->setWidget(menu_btn);
    proxy_btn->setPalette(QPalette(QColor(0, 0, 0, 0)));
    QObject::connect(menu_btn, SIGNAL(released()), this, SLOT(play()));
    QObject::connect(menu_btn, SIGNAL(pressed()), this, SLOT(changeIcon()));


        // bouton option du debut
        menu_opt = new QPushButton(NULL);
        menu_opt->setIcon(QIcon("ButtonOptions.png"));
        menu_opt->setFlat(true);
        menu_opt->setAutoFillBackground(false);
    //    menu_btn->setTaken(false);
        menu_opt->setGeometry(QRect(800 / 2 - 100, 600 / 2 + 100, 200, 100));
        menu_opt->setIconSize(QSize(200, 100));
        proxy_opt = new QGraphicsProxyWidget(fond);
        proxy_opt->setWidget(menu_opt);
        proxy_opt->setPalette(QPalette(QColor(0, 0, 0, 0)));
        QObject::connect(menu_opt, SIGNAL(released()), this, SLOT(option()));
        QObject::connect(menu_opt, SIGNAL(pressed()), this, SLOT(changeIconOption()));

    //creation du bouton quit
        menu_quit = new QPushButton;
        menu_quit->setIcon(QIcon("ButtonQuit.png"));
        menu_quit->setFlat(true);
        menu_quit->setGeometry(QRect(800 / 2 - 100, 600 / 2 + 200, 200, 100));
        menu_quit->setIconSize(QSize(200, 100));
        proxy_menuQuit = new QGraphicsProxyWidget(fond);
        proxy_menuQuit->setWidget(menu_quit);
        proxy_menuQuit->setPalette(QPalette(QColor(0,0,0,0)));

   QObject::connect(menu_quit, SIGNAL(pressed()), this, SLOT(changeIconQuit()));
   QObject::connect(menu_quit,SIGNAL(clicked()), qApp, SLOT(quit()));

}
void ddColumnOptionIcon::OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view)
{
	changeIcon((ddColumnOptionType)event.GetId());
}
Beispiel #18
0
/**
  * revealCell()
  * Reveals the cell at the given coordinate, also handles losing / winning
  */
void MainWindow::revealCell(QString coordinates)
{
    //Obtain the coordinates
    QStringList results = coordinates.split(",");

    if ( results.size() != 2) //Ensure that we receive two coordinates
        qFatal("Less than two numbers received");

    int row = results.at(0).toInt();
    int column = results.at(1).toInt();

    //If we already finished the game.. we won't do anything here
    if (hasFinished)
    {
        return;
    }
    else
    {
        cellsRevealed++;
    }

    //If it is flagged, we will ignore the mine
    if ( mineStatus[row][column] == FLAGGED_CELL || mineStatus[row][column] == QUESTION_CELL )
    {
            cellsRevealed--;
            return;
    }

    //Get the button we just pushed
    MineSweeperButton *buttonPushed = qobject_cast<MineSweeperButton *>(signalMapper->mapping(coordinates));


    //If it is flat.. we already pushed it so ignore it
    if (buttonPushed->isFlat())
    {
            cellsRevealed--;
            return;
    }

    //If we have 90 cells revealed (10 mines, 90 not mines), we win the game!
    if (cellsRevealed == 90 && game->getValue(row, column) != MINE)
    {
        changeIcon(buttonPushed, row, column);
        won();
        return;
    }

    //Recrusively clear the squares if we reveal a zero
    if ( game->getValue (row, column) == 0 ) {
        cellsRevealed--;
        clear(row, column, true);
    }

    //Set the image according to the value of the cell
    changeIcon(buttonPushed, row, column);

    buttonPushed->setFlat(true);    // if revealed, set button flat

    //If we reveal a mine, we just lost :(
    if ( game->isMine( row, column ) )
    {
        lost();
        cellsRevealed--;
        return;
    } else {
        //Phew, it's not a mine! We're happy!!!!!!! :D
        ui->smileyFace->setIcon(QIcon(":/images/normal_face.png"));
    }

    //If we haven't started yet, let's start the counter
    if ( !hasStarted )
    {
        timer->start(1000);
        hasStarted = true;
    }
}
Beispiel #19
0
Spinwidget::Spinwidget(double *x, double *y, double *z, int *n, int *colors, int* cols, double *max, char** names, char **colnames, QWidget *parent) : QWidget(parent) {

	// icon dialog first
	Icondialog icondialog(this);
	Iconview::Icon selectedIcon = Iconview::Cross;
	
	if(icondialog.exec()) {
		Iconview *iv = static_cast<Iconview *>(icondialog.focusWidget());
		selectedIcon = iv->getIcon();
	}

	// Layouts
	gridLayout = new QGridLayout(this);
	QVBoxLayout *leftLayout = new QVBoxLayout(0);
	QVBoxLayout *rightLayout = new QVBoxLayout(0);

	// OpenGL View
        view = new Spinview(x, y, z, n, colors, max, selectedIcon, names, colnames, cols, this);
	//gridLayout->addWidget(view, 0, 1, 7, 4);

	// Zoom In Button
	QPushButton *button_zoomin = new QPushButton("+");
	QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(button_zoomin->sizePolicy().hasHeightForWidth());
	button_zoomin->setSizePolicy(sizePolicy);
	button_zoomin->setFixedSize(QSize(35, 35));
	button_zoomin->setToolTip(tr("Zoom in"));
	//gridLayout->addWidget(button_zoomin, 0, 5, 1, 1);
	rightLayout->addWidget(button_zoomin);
	connect(button_zoomin, SIGNAL(clicked()), this, SLOT(zoomInClicked()));

	// Zoom Slider
	slider_zoom = new QSlider(this);
	slider_zoom->setMinimumSize(QSize(30, 0));
	slider_zoom->setOrientation(Qt::Vertical);
	slider_zoom->setMinimum(1);
	slider_zoom->setMaximum(100);
	slider_zoom->setSingleStep(1);
	slider_zoom->setPageStep(10);
	slider_zoom->setValue(30);
	slider_zoom->setInvertedAppearance(true);
	slider_zoom->setInvertedControls(true);
	slider_zoom->setToolTip(tr("Zoom in/out"));
	//gridLayout->addWidget(slider_zoom, 1, 5, 5, 1);
	rightLayout->addWidget(slider_zoom);
	connect(slider_zoom, SIGNAL(valueChanged(int)), this, SLOT(zoomChanged(int)));

	// ZoomOut Button
	QPushButton *button_zoomout = new QPushButton("-");
	sizePolicy.setHeightForWidth(button_zoomout->sizePolicy().hasHeightForWidth());
	button_zoomout->setSizePolicy(sizePolicy);
	button_zoomout->setFixedSize(QSize(35, 35));
	button_zoomout->setToolTip(tr("Zoom out"));
	//gridLayout->addWidget(button_zoomout, 6, 5, 1, 1);
	rightLayout->addWidget(button_zoomout);
	connect(button_zoomout, SIGNAL(clicked()), this, SLOT(zoomOutClicked()));

	// info label
	info = new QLabel(this);
	gridLayout->addWidget(info, 1, 1);

	// exit button
	QPushButton *button_exit = new QPushButton(this);
	button_exit->setFixedSize(QSize(35, 35));
	button_exit->setToolTip(tr("Exit"));
	QIcon icon7;
	icon7.addPixmap(QPixmap(QString::fromUtf8(":/images/exit.png")), QIcon::Normal, QIcon::Off);
	button_exit->setIcon(icon7);
	gridLayout->addWidget(button_exit, 1, 2);
	connect(button_exit, SIGNAL(clicked()), this, SLOT(close()));

	// Rotate Mode Button
	QPushButton *button_rotate = new QPushButton(this);
	connect(button_rotate, SIGNAL(clicked()), this, SLOT(setRotateMode()));
	button_rotate->setFixedSize(QSize(35, 35));
	QIcon icon;
	icon.addPixmap(QPixmap(QString::fromUtf8(":/images/rotate.png")), QIcon::Normal, QIcon::Off);
	button_rotate->setIcon(icon);
	button_rotate->setAutoExclusive(true);
	button_rotate->setCheckable(true);
	button_rotate->setToolTip(tr("Spin"));
	//gridLayout->addWidget(button_rotate, 0, 0, 1, 1);
	leftLayout->addWidget(button_rotate);

	// Move Mode Button
	QPushButton *button_move = new QPushButton(this);
	button_move->setFixedSize(QSize(35, 35));
	QIcon icon1;
	icon1.addPixmap(QPixmap(QString::fromUtf8(":/images/move.png")), QIcon::Normal, QIcon::Off);
	button_move->setIcon(icon1);
	button_move->setAutoExclusive(true);
	button_move->setCheckable(true);
	button_move->setToolTip(tr("Move"));
	//gridLayout->addWidget(button_move, 1, 0, 1, 1);
	leftLayout->addWidget(button_move);
	connect(button_move, SIGNAL(clicked()), this, SLOT(setMoveMode()));

	// Brush Mode Button
	QPushButton *button_brush = new QPushButton(this);
	button_brush->setFixedSize(QSize(35, 35));
	QIcon icon2;
	icon2.addPixmap(QPixmap(QString::fromUtf8(":/images/brush.png")), QIcon::Normal, QIcon::Off);
	button_brush->setIcon(icon2);
	button_brush->setAutoExclusive(true);
	button_brush->setCheckable(true);
	button_brush->setToolTip(tr("Brush"));
	//gridLayout->addWidget(button_brush, 2, 0, 1, 1);
	leftLayout->addWidget(button_brush);
	connect(button_brush, SIGNAL(clicked()), this, SLOT(setBrushMode()));

	// Info Mode Button
	QPushButton *button_info = new QPushButton(this);
	button_info->setFixedSize(QSize(35, 35));
	QIcon icon3;
	icon3.addPixmap(QPixmap(QString::fromUtf8(":/images/info.png")), QIcon::Normal, QIcon::Off);
	button_info->setIcon(icon3);
	button_info->setAutoExclusive(true);
	button_info->setCheckable(true);
	button_info->setToolTip(tr("Info"));
	//gridLayout->addWidget(button_brush, 2, 0, 1, 1);
	leftLayout->addWidget(button_info);
	connect(button_info, SIGNAL(clicked()), this, SLOT(setInfoMode()));

	QPushButton *button_identify = new QPushButton(this);
	button_identify->setFixedSize(QSize(35, 35));
        QIcon icon8;
        icon8.addPixmap(QPixmap(QString::fromUtf8(":/images/identify.png")), QIcon::Normal, QIcon::Off);
        button_identify->setIcon(icon8);
	button_identify->setAutoExclusive(true);
	button_identify->setCheckable(true);
	button_identify->setToolTip(tr("Identify"));
	//gridLayout->addWidget(button_brush, 2, 0, 1, 1);
	leftLayout->addWidget(button_identify);
	connect(button_identify, SIGNAL(clicked()), this, SLOT(setIdentifyMode()));


	// Spacer
	leftLayout->addStretch(1);

	// item change button
	QPushButton *button_item = new QPushButton(this);
	button_item->setFixedSize(QSize(35, 35));
	QIcon icon6;
	icon6.addPixmap(QPixmap(QString::fromUtf8(":/images/icons.png")), QIcon::Normal, QIcon::Off);
	button_item->setIcon(icon6);
	button_item->setToolTip(tr("Change Item type"));
	leftLayout->addWidget(button_item);
	connect(button_item, SIGNAL(clicked()), this, SLOT(changeIcon()));

	// Spacer
	leftLayout->addStretch(1);

	Aboutwidget *about = new Aboutwidget(this);

	// about S&B Button
	QPushButton *button_sb = new QPushButton(this);
	button_sb->setFixedSize(QSize(35, 35));
	QIcon icon5;
	icon5.addPixmap(QPixmap(QString::fromUtf8(":/images/logo.png")), QIcon::Normal, QIcon::Off);
	button_sb->setIcon(icon5);
	button_sb->setToolTip(tr("About"));
	leftLayout->addWidget(button_sb);
	connect(button_sb, SIGNAL(clicked()), about, SLOT(exec()));

	// about Qt Button
	QPushButton *button_qt = new QPushButton(this);
	button_qt->setFixedSize(QSize(35, 35));
	QIcon icon4;
	icon4.addPixmap(QPixmap(QString::fromUtf8(":/images/qt.png")), QIcon::Normal, QIcon::Off);
	button_qt->setIcon(icon4);
	button_qt->setToolTip(tr("About Qt"));
	//gridLayout->addWidget(button_qt, 6, 0, 1, 1);
	leftLayout->addWidget(button_qt);
	connect(button_qt, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
	
	move(200, 200); // move widget on screen
	
	// Group Widget
        Groupwidget *groupWidget = new Groupwidget(view, this);
	groupWidget->setWindowIcon(icon2);
	connect(button_brush, SIGNAL(toggled(bool)), groupWidget, SLOT(setVisible(bool)));
	connect(groupWidget, SIGNAL(indexChanged(const int &)), view, SLOT(setGroupIndex(const int &)));
	connect(groupWidget, SIGNAL(colorChanged(const int &, const QColor &)), view, SLOT(setColor(const int &, const QColor &)));	

	// Rotate Widget
	Rotatewidget *rotateWidget = new Rotatewidget(view, this);
	rotateWidget->setWindowIcon(icon);
	connect(button_rotate, SIGNAL(toggled(bool)), rotateWidget, SLOT(setVisible(bool)));

	// Identify Widget
        Identifywidget *identifyWidget = new Identifywidget(*n, names, this);
        identifyWidget->setWindowIcon(icon8);
        connect(button_identify, SIGNAL(toggled(bool)), identifyWidget, SLOT(setVisible(bool)));
        connect(identifyWidget, SIGNAL(identify(int)), view, SLOT(identify(int)));


	gridLayout->addLayout(leftLayout, 0, 0);
	gridLayout->addWidget(view, 0, 1);
	gridLayout->addLayout(rightLayout, 0, 2);
	setLayout(gridLayout);
        setWindowTitle(tr("Spin & Brush"));
	setWindowIcon(icon5);

	button_rotate->click(); // click() instead of setChecked(true) ist used to emit signal 
	connect(view, SIGNAL(zoomChanged(int)), slider_zoom, SLOT(setValue(int)));

	Legendwidget *legend = new Legendwidget(colnames, this);
	legend->show();
}