void MainWindow::importDialog()
{
    ImportDialog *dialog = new ImportDialog(this);
    connect(dialog, &ImportDialog::loadFromFile, this, &MainWindow::loadFromFile);
    connect(dialog, &ImportDialog::onlineLoad, this, &MainWindow::onlineLoadingDialog);
    dialog->exec();
}
Пример #2
0
// -----------------------------------------------------------
void QucsApp::slotImportData()
{
  slotHideEdit(); // disable text edit of component property

  if(ProjName.isEmpty()) {
    QMessageBox::critical(this, tr("Error"), tr("Please open project first!"));
    return;
  }

  ImportDialog *d = new ImportDialog(this);
  d->exec();
}
Пример #3
0
// -----------------------------------------------------------
void QucsApp::slotImportData()
{
  editText->setHidden(true); // disable text edit of component property

  if(ProjName.isEmpty()) {
    QMessageBox::critical(this, tr("Error"), tr("Please open project first!"));
    return;
  }

  ImportDialog *d = new ImportDialog(this);
  if(d->exec() == QDialog::Accepted)
    readProjectFiles();  // re-read all project files
}
Пример #4
0
bool MainWindow::loadModel(const QString& file, WZM& model, ModelInfo &info, bool nogui)
{
	wmit_filetype_t type;

	if (!guessModelTypeFromFilename(file, type))
	{
		return false;
	}

	info.m_read_type = type;

	bool read_success = false;
	std::ifstream f;
	ImportDialog* importDialog = nullptr;
	QSettings* settings = nullptr;

	f.open(file.toLocal8Bit(), std::ios::in | std::ios::binary);

	switch (type)
	{
	case WMIT_FT_WZM:
		read_success = model.read(f);
		break;
	case WMIT_FT_OBJ:
		if (!nogui)
		{
			importDialog = new ImportDialog();
			int result = importDialog->exec();
			delete importDialog;
			importDialog = nullptr;

			if (result != QDialog::Accepted)
			{
				return false;
			}
		}

		settings = new QSettings();

		read_success = model.importFromOBJ(f, settings->value(WMIT_SETTINGS_IMPORT_WELDER, true).toBool());
		break;
	case WMIT_FT_PIE:
	case WMIT_FT_PIE2:
		int pieversion = pieVersion(f);
		if (pieversion <= 2)
		{
			Pie2Model p2;
			read_success = p2.read(f);
			if (read_success)
			{
				Pie3Model p3(p2);
				info.m_pieCaps = p3.getCaps();
				model = WZM(p3);
			}
		}
		else // 3 or higher
		{
			Pie3Model p3;
			read_success = p3.read(f);
			if (read_success)
			{
				info.m_pieCaps = p3.getCaps();
				model = WZM(p3);
			}
		}
	}

	f.close();

	if (importDialog)
		delete importDialog;
	if (settings)
		delete settings;

	return read_success;
}