mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
make librarydialog use stringlist
This commit is contained in:
parent
87b3c463c0
commit
ec0cf44cd0
@ -1,19 +1,25 @@
|
||||
/***************************************************************************
|
||||
librarydialog.cpp
|
||||
-------------------
|
||||
begin : Sun Jun 04 2006
|
||||
copyright : (C) 2006 by Michael Margraf
|
||||
email : michael.margraf@alumni.tu-berlin.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
/*
|
||||
* librarydialog.cpp - implementation of dialog to create library
|
||||
*
|
||||
* Copyright (C) 2006, Michael Margraf, michael.margraf@alumni.tu-berlin.de
|
||||
* Copyright (C) 2014, Yodalee, lc85301@gmail.com
|
||||
*
|
||||
* This file is part of Qucs
|
||||
*
|
||||
* Qucs is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
@ -36,18 +42,17 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
#include "librarydialog.h"
|
||||
#include "qucs.h"
|
||||
#include "main.h"
|
||||
#include "schematic.h"
|
||||
|
||||
extern SubMap FileList;
|
||||
|
||||
LibraryDialog::LibraryDialog(QucsApp *App_, QTreeWidgetItem *SchematicList)
|
||||
: QDialog(App_)
|
||||
LibraryDialog::LibraryDialog(QWidget *parent, QStringList SchematicList)
|
||||
: QDialog(parent)
|
||||
{
|
||||
App = App_;
|
||||
setWindowTitle(tr("Create Library"));
|
||||
|
||||
Expr.setPattern("[\\w_]+");
|
||||
@ -207,16 +212,10 @@ LibraryDialog::LibraryDialog(QucsApp *App_, QTreeWidgetItem *SchematicList)
|
||||
|
||||
// ...........................................................
|
||||
// insert all subcircuits of into checklist
|
||||
QTreeWidgetItem *p ;
|
||||
for(int i=0; i < SchematicList->childCount(); i++){
|
||||
p = SchematicList->child(i);
|
||||
if(p->parent() == 0)
|
||||
break;
|
||||
if(!p->text(1).isEmpty()){
|
||||
QCheckBox *subCheck = new QCheckBox(p->text(0));
|
||||
checkBoxLayout->addWidget(subCheck);
|
||||
BoxList.append(subCheck);
|
||||
}
|
||||
foreach(const QString &filename, SchematicList) {
|
||||
QCheckBox *subCheck = new QCheckBox(filename);
|
||||
checkBoxLayout->addWidget(subCheck);
|
||||
BoxList.append(subCheck);
|
||||
}
|
||||
|
||||
if(BoxList.isEmpty()) {
|
||||
|
@ -1,19 +1,25 @@
|
||||
/***************************************************************************
|
||||
librarydialog.h
|
||||
-----------------
|
||||
begin : Sun Jun 04 2006
|
||||
copyright : (C) 2006 by Michael Margraf
|
||||
email : michael.margraf@alumni.tu-berlin.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
/*
|
||||
* librarydialog.h - declaration of dialog to create library
|
||||
*
|
||||
* Copyright (C) 2006, Michael Margraf, michael.margraf@alumni.tu-berlin.de
|
||||
* Copyright (C) 2014, Yodalee, lc85301@gmail.com
|
||||
*
|
||||
* This file is part of Qucs
|
||||
*
|
||||
* Qucs is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBRARYDIALOG_H
|
||||
#define LIBRARYDIALOG_H
|
||||
@ -32,7 +38,6 @@
|
||||
#include <QStackedWidget>
|
||||
|
||||
class QLabel;
|
||||
class QucsApp;
|
||||
class QLineEdit;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
@ -41,12 +46,13 @@ class QTreeWidgetItem;
|
||||
class QGroupBox;
|
||||
class QRegExpValidator;
|
||||
class QStackedWidget;
|
||||
class QStringList;
|
||||
|
||||
|
||||
class LibraryDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LibraryDialog(QucsApp*, QTreeWidgetItem*);
|
||||
LibraryDialog(QWidget *, QStringList);
|
||||
~LibraryDialog();
|
||||
|
||||
private slots:
|
||||
@ -82,7 +88,6 @@ private:
|
||||
QStringList Descriptions;
|
||||
QCheckBox *checkDescr;
|
||||
|
||||
QucsApp *App;
|
||||
QFile LibFile;
|
||||
QDir LibDir;
|
||||
QRegExp Expr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* searchdialog.h - implementation of search dialog
|
||||
* searchdialog.cpp - implementation of search dialog
|
||||
*
|
||||
* Copyright (C) 2006, Michael Margraf, michael.margraf@alumni.tu-berlin.de
|
||||
* Copyright (C) 2014, Yodalee, lc85301@gmail.com
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <QMenu>
|
||||
#include <QComboBox>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#include "main.h"
|
||||
#include "qucs.h"
|
||||
@ -1238,7 +1239,18 @@ void QucsApp::slotCreateLib()
|
||||
return;
|
||||
}
|
||||
|
||||
LibraryDialog *d = new LibraryDialog(this, ConSchematics);
|
||||
QStringList SchematicList;
|
||||
QTreeWidgetItem *p;
|
||||
for(int i=0; i < ConSchematics->childCount(); i++){
|
||||
p = ConSchematics->child(i);
|
||||
if(p->parent() == 0)
|
||||
break;
|
||||
if(!p->text(1).isEmpty()){
|
||||
SchematicList.append(p->text(0));
|
||||
}
|
||||
}
|
||||
|
||||
LibraryDialog *d = new LibraryDialog(this, SchematicList);
|
||||
d->exec();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user