MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags ) : QMainWindow( parent, flags ), ui(new Ui::MainWindow) { qDebug( "Home Path : %s" ,QDir::homePath().toLatin1().constData()); qDebug( "Current Path : %s" ,QDir::currentPath ().toLatin1().constData()); ui->setupUi(this); this->setAttribute( Qt::WA_DeleteOnClose ); //hide by default setWindowTitle(QString(PACKAGE) + " " + QString(VERSION)); // loads the settings loadSettings(); // connecting the Go server tab buttons and signals // connecting the new game button connect( ui->actionOpen, SIGNAL(triggered()), SLOT(slot_fileOpen()) ); connect(ui->actionNew,SIGNAL(triggered()),SLOT(slot_fileNew())); connect(ui->cancelButtonPrefs,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui->cancelButtonServer,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui->stackedWidget, SIGNAL(currentChanged ( int )), SLOT(slot_currentChanged(int ))); //coneects the preference buttons connect( ui->gobanPathButton, SIGNAL( clicked() ), this, SLOT( slot_getGobanPath() ) ); connect( ui->tablePathButton, SIGNAL( clicked() ), this, SLOT( slot_getTablePath() ) ); connect(ui->comboBox_language, SIGNAL(currentIndexChanged ( int )), SLOT(slot_languageChanged(int ))); //sound connectSound = new Sound("static.wav"); logindialog = new LoginDialog(this); connect( ui->actionConnect, SIGNAL(triggered()), SLOT(openConnectDialog()) ); engineTableModel = new EngineTableModel(this); ui->engineTableView->setModel(engineTableModel); ui->engineTableView->setColumnWidth ( EngineTableModel::ENGINE_DEFAULT, 60 ); ui->engineTableView->setColumnWidth ( EngineTableModel::ENGINE_PATH, 300 ); connect(ui->engineAddButton, &QPushButton::pressed, this, &MainWindow::addEngine); connect(ui->engineRemoveButton, &QPushButton::pressed, this, &MainWindow::removeEngine); }
MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags ) : QMainWindow( parent, flags ) { qDebug( "Home Path : %s" ,QDir::homePath().toLatin1().constData()); qDebug( "Current Path : %s" ,QDir::currentPath ().toLatin1().constData()); ui.setupUi(this); //hide by default ui.changeServerPB->hide(); ui.createRoomPB->hide(); setWindowTitle(QString(PACKAGE) + " " + QString(VERSION)); initStatusBar(); /* FIXME, really need a list of such things, 0s */ connection = 0; logindialog = 0; /* We need to integrate this room list with the new room code FIXME */ connect(ui.RoomList,SIGNAL(currentIndexChanged( const QString &)), SLOT(slot_roomListClicked(const QString &))); connect(ui.channelsCB,SIGNAL(currentIndexChanged( const QString &)), SLOT(slot_channelListClicked(const QString &))); SGFloaded = ""; SGFloaded2 = ""; // loads the settings loadSettings(); //creates the connection code seekMenu = new QMenu(); ui.toolSeek->setMenu(seekMenu); connect(seekMenu,SIGNAL(triggered(QAction*)), SLOT(slot_seek(QAction*))); connect(ui.toolSeek, SIGNAL( toggled(bool) ), SLOT( slot_seek(bool) ) ); // filling the file view QStringList filters = (QStringList() << "*.sgf" << "*.SGF"); model = new QDirModel(filters, QDir::AllEntries | QDir::AllDirs , QDir::Name,0); ui.dirView_1->setModel(model); ui.dirView_1->hideColumn(1); ui.dirView_1->hideColumn(2); ui.dirView_1->setColumnWidth(0,300); if(currentWorkingDir == QString()) ui.dirView_1->setCurrentIndex(model->index(QDir::homePath())); else ui.dirView_1->setCurrentIndex(model->index(currentWorkingDir)); if (model->isDir(ui.dirView_1->currentIndex())) ui.dirView_1->expand(ui.dirView_1->currentIndex()); ui.dirView_2->setModel(model); ui.dirView_2->hideColumn(1); ui.dirView_2->hideColumn(2); ui.dirView_2->setColumnWidth(0,300); if(currentWorkingDir == QString()) ui.dirView_2->setCurrentIndex(model->index(QDir::homePath ())); else ui.dirView_2->setCurrentIndex(model->index(currentWorkingDir)); if (model->isDir(ui.dirView_2->currentIndex())) ui.dirView_2->expand(ui.dirView_2->currentIndex()); //init the small board display ui.displayBoard->init(19); ui.displayBoard2->init(19); // ui.displayBoard->setShowCoords(FALSE); // connecting the Go server tab buttons and signals connect( ui.pb_connect, SIGNAL( toggled(bool) ), SLOT( slot_connect(bool) ) ); connect( ui.cb_cmdLine, SIGNAL( activated(const QString&) ), this, SLOT( slot_cmdactivated(const QString&) ) ); // connect( ui.cb_cmdLine, SIGNAL( activated(int) ), this, SLOT( slot_cmdactivated_int(int) ) ); // connecting the new game button connect(ui.button_newGame,SIGNAL(pressed()),SLOT(slot_fileNewBoard())); connect(ui.button_loadGame,SIGNAL(pressed()),SLOT(slot_fileOpenBoard())); connect(ui.button_newComputerGame,SIGNAL(pressed()),SLOT(slot_computerNewBoard())); connect(ui.button_loadComputerGame,SIGNAL(pressed()),SLOT(slot_computerOpenBoard())); connect(ui.dirView_1, SIGNAL(expanded(const QModelIndex &)), this, SLOT(slot_expanded(const QModelIndex &))); connect(ui.dirView_2, SIGNAL(expanded(const QModelIndex &)), this, SLOT(slot_expanded(const QModelIndex &))); connect(ui.dirView_1, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slot_fileOpenBoard(const QModelIndex &))); connect(ui.dirView_2, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slot_computerOpenBoard(const QModelIndex &))); connect(ui.dirView_1->selectionModel(), SIGNAL(currentChanged ( const QModelIndex & , const QModelIndex & )), this, SLOT(slot_displayFileHeader(const QModelIndex & , const QModelIndex & ))); connect(ui.dirView_2->selectionModel(), SIGNAL(currentChanged ( const QModelIndex & , const QModelIndex & )), this, SLOT(slot_loadComputerFile(const QModelIndex & , const QModelIndex & ))); connect( ui.computerPathButton, SIGNAL( clicked() ), this, SLOT( slot_getComputerPath() ) ); connect(ui.LineEdit_computer, SIGNAL(textChanged (const QString &)), this, SLOT(slot_computerPathChanged(const QString &))); // connecting the server tab buttons connect(ui.cb_connect, SIGNAL(currentIndexChanged ( int )), SLOT(slot_cbconnectChanged(int ))); connect( ui.setQuietMode, SIGNAL( clicked(bool) ), this, SLOT( slot_cbquiet() ) ); connect( ui.setOpenMode, SIGNAL( clicked(bool) ), this, SLOT( slot_cbopen() ) ); connect( ui.setLookingMode, SIGNAL( clicked(bool) ), this, SLOT( slot_cblooking() ) ); connect(ui.newFile_Handicap, SIGNAL(valueChanged(int)), this, SLOT(slot_newFile_HandicapChange(int))); connect(ui.newComputer_Handicap, SIGNAL(valueChanged(int)), this, SLOT(slot_newComputer_HandicapChange(int))); connect(ui.cancelButtonPrefs,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui.cancelButtonServer,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui.stackedWidget, SIGNAL(currentChanged ( int )), SLOT(slot_currentChanged(int ))); //coneects the preference buttons connect( ui.gobanPathButton, SIGNAL( clicked() ), this, SLOT( slot_getGobanPath() ) ); connect( ui.tablePathButton, SIGNAL( clicked() ), this, SLOT( slot_getTablePath() ) ); connect(ui.comboBox_language, SIGNAL(currentIndexChanged ( int )), SLOT(slot_languageChanged(int ))); connect( ui.alternateListColorsCB, SIGNAL( clicked(bool) ), this, SLOT( slot_alternateListColorsCB(bool) ) ); // Creates the SGF parser for displaying the file infos MW_SGFparser = new SGFParser(NULL); // for saving server ip lists serverliststorage = new ServerListStorage(); //sound connectSound = SoundFactory::newSound(SOUND_PATH_PREFIX"static.wav"); }