void OpenSavedGameDialog::on_checkBlackPits_stateChanged(int checkedState)
{
    if (checkedState == Qt::Checked) {
        ui->checkMultiplayer->setChecked(false);
        updateTableWidget(QString("bpsave"));
    } else {
        // load single-player games
        updateTableWidget(QString("save"));
    }
}
void OpenSavedGameDialog::on_toolOpenSavedGame_clicked()
{
    QString dirName = QFileDialog::getExistingDirectory(this, tr("Saved Game Directory"));

    if (!dirName.isEmpty()) {
        QDir dir(dirName);

        // ensure that the save directory exists within this sub-directory
        if (!dir.exists("save")) {
            QMessageBox::critical(this, tr("Error"), tr("Save directory not found!"));
            return;
        }

        // delete our old pointer
        delete savedir;
        savedir = new QDir(dir);

        // reset the multiplayer and black pits options
        reset();

        // update our text field
        ui->textDir->setText(dirName);

        // update the table widget
        updateTableWidget(QString("save"));

        // save this directory in our global
        _strDocumentsPath = savedir->absolutePath();

        if (!_strDocumentsPath.endsWith(QDir::separator()))
            _strDocumentsPath = _strDocumentsPath + QDir::separator();
    }
}
OpenSavedGameDialog::OpenSavedGameDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::OpenSavedGameDialog),
    savedir(NULL),
    m_saveDirectory(""),
    m_saveName("")
{
    ui->setupUi(this);

    // grab our saved information
    if (!_strDocumentsPath.isEmpty() ) {
        QDir dir(_strDocumentsPath);

        if (!dir.exists("save") ) {
            QMessageBox::warning(
                        this,
                        tr("Error loading documents path"),
                        tr("The current documents path does not have any saved games. Please set a new documents path for BG:EE.")
            );
        } else {
            savedir = new QDir(dir);
            updateTableWidget(QString("save"));
            ui->textDir->setText(_strDocumentsPath);
        }
    }

    // hide the data column
    ui->tableWidget->hideColumn(2);

    // reset our UI
    reset();
}
Example #4
0
void TabDialog::updateColSettings()
{
int i=ui.spinBoxNumCol->value()-1;
colData col;
col.alignment=ui.comboBoxColAl->currentIndex();
col.leftborder=ui.comboLeftBorder->currentIndex();
colDataList.replace(i,col);
updateTableWidget();
//qDebug() << "change" << i << colDataList.at(i).alignment << colDataList.at(i).leftborder;
}
Example #5
0
void TabDialog::applytoAllColumns()
{
colData col;
col.alignment=ui.comboBoxColAl->currentIndex();
col.leftborder=ui.comboLeftBorder->currentIndex();
for ( int i = 0; i < 99; ++i )
  {
  colDataList.replace(i,col);
  }
updateTableWidget();
}
Example #6
0
void TabDialog::showColSettings(int column)
{
int i=column-1;
if (i>=99) return;
disconnect(ui.comboBoxColAl, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));
disconnect(ui.comboLeftBorder, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));
ui.comboBoxColAl->setCurrentIndex(colDataList.at(i).alignment);
ui.comboLeftBorder->setCurrentIndex(colDataList.at(i).leftborder);
connect(ui.comboBoxColAl, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));
connect(ui.comboLeftBorder, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));
updateTableWidget();
}
TripPlanner::TripPlanner(char *name,char *id, QObject *parent):QTcpSocket(parent)
{
  std::stringstream strValue;
  strValue << id;
  strValue >> busID;
  
  busName = QString(name);
  finished = false;
  lastStation = -1;
  
  // Determine Start Station
  station = 0.0;
  
  peopleGettingOff = 0;
  space = BUS_SPACE;
  
 // ... // Create widgets.
  //connectButton = new QPushButton("Connect");
  //exitButton = new QPushButton("Exit");
  //layout = new QHBoxLayout(this);
  
  
  // Connect button signals.
 // connect(connectButton, SIGNAL(clicked()),
  //this, SLOT(startSending()));
  
  /*connect(stopButton, SIGNAL(clicked()),
  this, SLOT(stopSearch()));
  connect(quitButton, SIGNAL(clicked()),
  this, SLOT(close()));*/

 // connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
  
  // Connect TCP socket signals.
  connect(&tcpSocket, SIGNAL(connected()),
  this, SLOT(sendRequest()));
  connect(&tcpSocket, SIGNAL(disconnected()),
  this, SLOT(connectionClosedByServer()));
  connect(&tcpSocket, SIGNAL(readyRead()),
  this, SLOT(updateTableWidget()));
  connect(&tcpSocket,
  SIGNAL(error(QAbstractSocket::SocketError)),
  this, SLOT(error()));
  
  //layout->addWidget(connectButton);
  //layout->addWidget(exitButton);
  
  startSending();
}
Example #8
0
void TabDialog::updateRowSettings()
{
int i=ui.spinBoxNumLi->value()-1;
liData li;
li.topborder=ui.checkBoxBorderTop->isChecked();
li.merge=ui.checkBoxSpan->isChecked();
li.mergefrom=ui.spinBoxSpanFrom->value();
li.mergeto=ui.spinBoxSpanTo->value();
if (li.mergefrom>li.mergeto) 
  {
  li.mergefrom=1;
  li.mergeto=1;
  }
liDataList.replace(i,li);
updateTableWidget();
}
Example #9
0
void TabDialog::NewColumns(int num)
{
ui.tableWidget->setColumnCount( num );
ui.spinBoxNumCol->setRange(1,num);
if (num>1)
  {
  ui.spinBoxSpanFrom->setRange(1,num-1);
  ui.spinBoxSpanTo->setRange(2,num);
  }
else
  {
  ui.spinBoxSpanFrom->setRange(1,num-1);
  ui.spinBoxSpanTo->setRange(2,num);
  }
updateTableWidget();
}
Example #10
0
void TabDialog::showRowSettings(int row)
{
int i=row-1;
if (i>=99) return;
disconnect(ui.checkBoxBorderTop, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
disconnect(ui.checkBoxSpan, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
disconnect(ui.spinBoxSpanFrom, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));
disconnect(ui.spinBoxSpanTo, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));
ui.checkBoxBorderTop->setChecked(liDataList.at(i).topborder);
ui.checkBoxSpan->setChecked(liDataList.at(i).merge);
ui.spinBoxSpanFrom->setValue(liDataList.at(i).mergefrom);
ui.spinBoxSpanTo->setValue(liDataList.at(i).mergeto);
connect(ui.checkBoxBorderTop, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
connect(ui.checkBoxSpan, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
connect(ui.spinBoxSpanFrom, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));
connect(ui.spinBoxSpanTo, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));
updateTableWidget();
}
Example #11
0
void TabDialog::applytoAllLines()
{
liData li;
li.topborder=ui.checkBoxBorderTop->isChecked();
li.merge=ui.checkBoxSpan->isChecked();
li.mergefrom=ui.spinBoxSpanFrom->value();
li.mergeto=ui.spinBoxSpanTo->value();
if (li.mergefrom>li.mergeto) 
  {
  li.mergefrom=1;
  li.mergeto=1;
  }
for ( int i = 0; i < 99; ++i )
  {
  liDataList.replace(i,li);
  }
updateTableWidget();
}
Example #12
0
TripPlanner::TripPlanner(QWidget *parent) :
    QDialog(parent)
{
    setupUi(this);
    searchButton = buttonBox->addButton(tr("&Search"),
                                        QDialogButtonBox::ActionRole);

    stopButton   = buttonBox->addButton(tr("S&top"),
                                        QDialogButtonBox::ActionRole);

    stopButton->setEnabled(false);
    buttonBox->button(QDialogButtonBox::Close)->setText(tr("&Quit"));

    QDateTime dateTime = QDateTime::currentDateTime();
    dateEdit->setDate(dateTime.date());
    timeEdit->setTime(QTime(dateTime.time().hour(), 0));

    progressBar->hide();
    progressBar->setSizePolicy(QSizePolicy::Preferred,
                               QSizePolicy::Ignored);

    tableWidget->verticalHeader()->hide();
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);

    connect(searchButton, SIGNAL(clicked(bool)),
            this, SLOT(connectToServer()));
    connect(stopButton, SIGNAL(clicked(bool)), this, SLOT(stopSearch()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(&tcpSocket, SIGNAL(connected()), this, SLOT(sendRequest()));
    connect(&tcpSocket, SIGNAL(disconnected()),
            this, SLOT(connectionClosedByServer()));
    connect(&tcpSocket, SIGNAL(readyRead()),
            this, SLOT(updateTableWidget()));
    connect(&tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(error()));
}
Example #13
0
TabDialog::TabDialog(QWidget *parent, const char *name)
    :QDialog( parent)
{
setWindowTitle(name);
setModal(true);
ui.setupUi(this);

colData col;
col.alignment=0;
col.leftborder=0;
liData li;
li.topborder=true;
li.merge=false;
li.mergefrom=1;
li.mergeto=1;
colDataList.clear();
liDataList.clear();
for ( int j = 0; j < 99; ++j )
{
colDataList.append(col);
liDataList.append(li);
}
ui.tableWidget->setRowCount( 2 );
ui.tableWidget->setColumnCount( 2 );

ui.spinBoxRows->setValue(2);
ui.spinBoxRows->setRange(1,99);
connect( ui.spinBoxRows, SIGNAL(valueChanged(int)),this, SLOT(NewRows(int)));


ui.spinBoxColumns->setValue(2);
ui.spinBoxColumns->setRange(1,99);
connect( ui.spinBoxColumns, SIGNAL(valueChanged(int)),this, SLOT(NewColumns(int)));

ui.spinBoxNumCol->setRange(1,2);
ui.spinBoxNumLi->setRange(1,2);
ui.spinBoxSpanFrom->setRange(1,1);
ui.spinBoxSpanTo->setRange(2,2);

ui.comboBoxColAl->insertItem(0,"Center" );
ui.comboBoxColAl->insertItem(1,"Left" );
ui.comboBoxColAl->insertItem(2,"Right" );
ui.comboBoxColAl->insertItem(3, "p{} (fixed width - left)");
ui.comboBoxColAl->insertItem(4, "p{} (fixed width - center)");
ui.comboBoxColAl->insertItem(5, "p{} (fixed width - right)");
ui.comboBoxColAl->setCurrentIndex(0);

ui.comboLeftBorder->insertItem(0,"|");
ui.comboLeftBorder->insertItem(1,"||");
ui.comboLeftBorder->insertItem(2,"none");
ui.comboLeftBorder->insertItem(3, "@{text}" );
ui.comboLeftBorder->setCurrentIndex(0);

ui.comboBoxEndBorder->insertItem(0,"|");
ui.comboBoxEndBorder->insertItem(1,"||");
ui.comboBoxEndBorder->insertItem(2,"none");
ui.comboBoxEndBorder->insertItem(3, "@{text}" );
ui.comboLeftBorder->setCurrentIndex(0);

ui.spinBoxNumCol->setValue(1);
ui.spinBoxNumLi->setValue(1);

ui.checkBoxBorderTop->setChecked(true);
ui.checkBoxSpan->setChecked(false);
ui.spinBoxSpanFrom->setValue(1);
ui.spinBoxSpanTo->setValue(1);
ui.spinBoxSpanFrom->setEnabled(false);
ui.spinBoxSpanTo->setEnabled(false);
ui.checkBoxBorderBottom->setChecked(true);
ui.checkBoxMargin->setChecked(false);

connect(ui.checkBoxSpan, SIGNAL(toggled(bool)),this, SLOT(updateSpanStatus(bool)));

connect(ui.pushButtonColumns, SIGNAL(clicked()), this, SLOT(applytoAllColumns()));
connect(ui.pushButtonLines, SIGNAL(clicked()), this, SLOT(applytoAllLines()));

connect( ui.spinBoxNumCol, SIGNAL(valueChanged(int)),this, SLOT(showColSettings(int)));
connect( ui.spinBoxNumLi, SIGNAL(valueChanged(int)),this, SLOT(showRowSettings(int)));

connect(ui.comboBoxColAl, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));
connect(ui.comboLeftBorder, SIGNAL(currentIndexChanged(int)),this, SLOT(updateColSettings()));

connect(ui.checkBoxBorderTop, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
connect(ui.checkBoxSpan, SIGNAL(toggled(bool)),this, SLOT(updateRowSettings()));
connect(ui.spinBoxSpanFrom, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));
connect(ui.spinBoxSpanTo, SIGNAL(valueChanged(int)),this, SLOT(updateRowSettings()));

connect(ui.comboBoxEndBorder, SIGNAL(currentIndexChanged(int)),this, SLOT(updateTableWidget()));

connect(ui.tableWidget, SIGNAL(cellClicked(int,int)),this, SLOT(showColRowSettings(int,int)));
connect(ui.tableWidget, SIGNAL(currentCellChanged(int,int,int,int)),this, SLOT(showColRowSettings(int,int)));

setWindowTitle(tr("Quick Tabular"));
updateTableWidget();
}
Example #14
0
void TabDialog::updateSpanStatus(bool enabled)
{
ui.spinBoxSpanFrom->setEnabled(enabled);
ui.spinBoxSpanTo->setEnabled(enabled);
updateTableWidget();
}
Example #15
0
void TabDialog::NewRows(int num)
{
ui.tableWidget->setRowCount( num );
ui.spinBoxNumLi->setRange(1,num);
updateTableWidget();
}