Exemplo n.º 1
0
void MainWnd::on_act_open_triggered()
{
    QString fileName = QFileDialog::getOpenFileName(this, "", "", "Файл редактора (*.txt)");
    if(fileName.isEmpty() || AskSave()) return;
    fileName = QDir::toNativeSeparators(fileName);

    std::vector<std::vector<std::string> > data;
    Lab::FType ftype = Lab::open(fileName.toLocal8Bit().constData(), data);

    if(ftype == Lab::None) // Error reading file
    {
        QMessageBox msgBox(this);
        msgBox.setText("Ошибка чтения файла");
        msgBox.setIcon(QMessageBox::Critical);
        msgBox.setWindowTitle("Редактор");
        msgBox.exec();
        return;
    }
    SetupNew(ftype);
    ui->tableWidget->setRowCount(data.size());
    for(unsigned i = 0; i < data.size(); i++)
    {
        for(unsigned int j = 0; j < data[i].size(); j++)
        {
            SetData(i, j, data[i][j]);
        }
    }
    Modified = false;
    ui->lblName->setText(fileName);
    curFile = fileName;
}
Exemplo n.º 2
0
void DestroyMessage (void)
{
  gtk_widget_destroy (messagewindow);
  iyesno = 0;
  if (iquit == 1)
  {
    Play ("", 2);
    gtk_exit (0);
  }
  if (iselectdead == 1)
  {
    itype = 3;
    AskSave ();
  }
}
Exemplo n.º 3
0
bool ResetWatches()
{
	if(!AskSave())
		return false;
	for (;WatchCount>=0;WatchCount--)
	{
		free(rswatches[WatchCount].comment);
		rswatches[WatchCount].comment = NULL;
	}
	WatchCount++;
	if (RamWatchHWnd)
		ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
	RWfileChanged = false;
	currentWatch[0] = NULL;
	return true;
}
Exemplo n.º 4
0
void MainWnd::closeEvent(QCloseEvent* event)
{
    if(AskSave()) event->ignore();
}
Exemplo n.º 5
0
void MainWnd::on_act_close_triggered()
{
    if(!AskSave()) Close();
}
Exemplo n.º 6
0
void MainWnd::on_act_new2_triggered()
{
    if(!AskSave()) SetupNew(Lab::FType::Cities);
}
Exemplo n.º 7
0
void MainWnd::on_act_new1_triggered()
{
    if(!AskSave()) SetupNew(Lab::FType::Roads);
}