mirror of https://github.com/KLayout/klayout.git
Started package manager development ('salt')
This commit is contained in:
parent
fea965a321
commit
e421026366
|
|
@ -0,0 +1,351 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SaltManagerDialog</class>
|
||||||
|
<widget class="QDialog" name="SaltManagerDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>692</width>
|
||||||
|
<height>440</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Manage Packages</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_4">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/import.png</normaloff>:/import.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_2">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_3">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/new_folder.png</normaloff>:/new_folder.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_5">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/rename.png</normaloff>:/rename.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_3">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><body><center>No packages are installed currently.<br><br>You can use:<br>
|
||||||
|
</center>
|
||||||
|
<table>
|
||||||
|
<tr><td width="30"><a href=":import"><img src=":/import.png"></a></td><td>to import a package from an external source</td></tr>
|
||||||
|
<tr><td><a href=":add"><img src=":/add.png"></a></td><td>to create a new package</td></tr>
|
||||||
|
</table>
|
||||||
|
</body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Package Details</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="textBrowser"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<action name="actionNewFolder">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/new_folder.png</normaloff>:/new_folder.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New Folder</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionNew">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>New Package</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionDelete">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Delete Package</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRename">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/rename.png</normaloff>:/rename.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rename</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Rename Package</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionImport">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/import.png</normaloff>:/import.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Import</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Import Package</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>treeWidget</tabstop>
|
||||||
|
<tabstop>toolButton_4</tabstop>
|
||||||
|
<tabstop>toolButton_2</tabstop>
|
||||||
|
<tabstop>toolButton_3</tabstop>
|
||||||
|
<tabstop>toolButton</tabstop>
|
||||||
|
<tabstop>toolButton_5</tabstop>
|
||||||
|
<tabstop>textBrowser</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources>
|
||||||
|
<include location="layResources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -539,6 +539,10 @@ Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "MainWind
|
||||||
"@brief 'cm_technologies' action (bound to a menu)"
|
"@brief 'cm_technologies' action (bound to a menu)"
|
||||||
"\nThis method has been added in version 0.22."
|
"\nThis method has been added in version 0.22."
|
||||||
) +
|
) +
|
||||||
|
gsi::method ("cm_packages", &lay::MainWindow::cm_packages,
|
||||||
|
"@brief 'cm_packages' action (bound to a menu)"
|
||||||
|
"\nThis method has been added in version 0.25."
|
||||||
|
) +
|
||||||
gsi::method ("cm_open_too", &lay::MainWindow::cm_open_too,
|
gsi::method ("cm_open_too", &lay::MainWindow::cm_open_too,
|
||||||
"@brief 'cm_open_too' action (bound to a menu)"
|
"@brief 'cm_open_too' action (bound to a menu)"
|
||||||
) +
|
) +
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,11 @@ HEADERS = \
|
||||||
layTextProgress.h \
|
layTextProgress.h \
|
||||||
layVersion.h \
|
layVersion.h \
|
||||||
layCommon.h \
|
layCommon.h \
|
||||||
layConfig.h
|
layConfig.h \
|
||||||
|
laySalt.h \
|
||||||
|
laySaltGrain.h \
|
||||||
|
laySaltGrains.h \
|
||||||
|
laySaltManagerDialog.h
|
||||||
|
|
||||||
FORMS = \
|
FORMS = \
|
||||||
ClipDialog.ui \
|
ClipDialog.ui \
|
||||||
|
|
@ -90,7 +94,8 @@ FORMS = \
|
||||||
XORToolDialog.ui \
|
XORToolDialog.ui \
|
||||||
TechLoadOptionsEditorPage.ui \
|
TechLoadOptionsEditorPage.ui \
|
||||||
TechSaveOptionsEditorPage.ui \
|
TechSaveOptionsEditorPage.ui \
|
||||||
MainConfigPage7.ui
|
MainConfigPage7.ui \
|
||||||
|
SaltManagerDialog.ui
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
gsiDeclLayApplication.cc \
|
gsiDeclLayApplication.cc \
|
||||||
|
|
@ -134,6 +139,10 @@ SOURCES = \
|
||||||
layTechSetupDialog.cc \
|
layTechSetupDialog.cc \
|
||||||
layTextProgress.cc \
|
layTextProgress.cc \
|
||||||
layVersion.cc \
|
layVersion.cc \
|
||||||
|
laySalt.cc \
|
||||||
|
laySaltGrain.cc \
|
||||||
|
laySaltGrains.cc \
|
||||||
|
laySaltManagerDialog.cc
|
||||||
|
|
||||||
RESOURCES = layBuildInMacros.qrc \
|
RESOURCES = layBuildInMacros.qrc \
|
||||||
layHelpResources.qrc \
|
layHelpResources.qrc \
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,8 @@
|
||||||
#include "layLogViewerDialog.h"
|
#include "layLogViewerDialog.h"
|
||||||
#include "layLayerToolbox.h"
|
#include "layLayerToolbox.h"
|
||||||
#include "laySettingsForm.h"
|
#include "laySettingsForm.h"
|
||||||
#include "laySettingsForm.h"
|
|
||||||
#include "layTechSetupDialog.h"
|
#include "layTechSetupDialog.h"
|
||||||
|
#include "laySaltManagerDialog.h"
|
||||||
#include "layTipDialog.h"
|
#include "layTipDialog.h"
|
||||||
#include "laySelectCellViewForm.h"
|
#include "laySelectCellViewForm.h"
|
||||||
#include "layLayoutPropertiesForm.h"
|
#include "layLayoutPropertiesForm.h"
|
||||||
|
|
@ -950,6 +950,7 @@ MainWindow::init_menu ()
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuLayoutEntry tools_menu [] = {
|
MenuLayoutEntry tools_menu [] = {
|
||||||
|
MenuLayoutEntry ("packages", tl::to_string (QObject::tr ("Manage Packages")), SLOT (cm_packages ())),
|
||||||
MenuLayoutEntry ("technologies", tl::to_string (QObject::tr ("Manage Technologies")), SLOT (cm_technologies ())),
|
MenuLayoutEntry ("technologies", tl::to_string (QObject::tr ("Manage Technologies")), SLOT (cm_technologies ())),
|
||||||
MenuLayoutEntry::separator ("verification_group"),
|
MenuLayoutEntry::separator ("verification_group"),
|
||||||
MenuLayoutEntry ("drc", tl::to_string (QObject::tr ("DRC")), drc_menu),
|
MenuLayoutEntry ("drc", tl::to_string (QObject::tr ("DRC")), drc_menu),
|
||||||
|
|
@ -4699,6 +4700,13 @@ MainWindow::eventFilter (QObject *obj, QEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::cm_packages ()
|
||||||
|
{
|
||||||
|
lay::SaltManagerDialog dialog (this);
|
||||||
|
dialog.exec ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::cm_technologies ()
|
MainWindow::cm_technologies ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -734,6 +734,7 @@ public slots:
|
||||||
void cm_macro_editor ();
|
void cm_macro_editor ();
|
||||||
void cm_new_drc_script ();
|
void cm_new_drc_script ();
|
||||||
void cm_edit_drc_scripts ();
|
void cm_edit_drc_scripts ();
|
||||||
|
void cm_packages ();
|
||||||
void cm_technologies ();
|
void cm_technologies ();
|
||||||
void cm_open_too ();
|
void cm_open_too ();
|
||||||
void cm_open_new_view ();
|
void cm_open_new_view ();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "laySalt.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HDR_laySalt
|
||||||
|
#define HDR_laySalt
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "laySaltGrain.h"
|
||||||
|
#include "tlString.h"
|
||||||
|
#include "tlXMLParser.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
static const std::string grain_filename = "grain.xml";
|
||||||
|
|
||||||
|
SaltGrain::SaltGrain ()
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SaltGrain::operator== (const SaltGrain &other) const
|
||||||
|
{
|
||||||
|
return m_name == other.m_name &&
|
||||||
|
m_version == other.m_version &&
|
||||||
|
m_path == other.m_path &&
|
||||||
|
m_url == other.m_url &&
|
||||||
|
m_title == other.m_title &&
|
||||||
|
m_doc == other.m_doc &&
|
||||||
|
m_dependencies == other.m_dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_name (const std::string &n)
|
||||||
|
{
|
||||||
|
m_name = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_version (const std::string &v)
|
||||||
|
{
|
||||||
|
m_version = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_path (const std::string &p)
|
||||||
|
{
|
||||||
|
m_path = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_url (const std::string &u)
|
||||||
|
{
|
||||||
|
m_url = u;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_title (const std::string &t)
|
||||||
|
{
|
||||||
|
m_title = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::set_doc (const std::string &t)
|
||||||
|
{
|
||||||
|
m_doc = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SaltGrain::compare_versions (const std::string &v1, const std::string &v2)
|
||||||
|
{
|
||||||
|
tl::Extractor ex1 (v1.c_str ());
|
||||||
|
tl::Extractor ex2 (v2.c_str ());
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
if (ex1.at_end () && ex2.at_end ()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n1 = 0, n2 = 0;
|
||||||
|
if (! ex1.at_end ()) {
|
||||||
|
ex1.try_read (n1);
|
||||||
|
}
|
||||||
|
if (! ex2.at_end ()) {
|
||||||
|
ex2.try_read (n2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n1 != n2) {
|
||||||
|
return n1 < n2 ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (! ex1.at_end ()) {
|
||||||
|
char c = *ex1;
|
||||||
|
++ex1;
|
||||||
|
if (c == '.') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (! ex2.at_end ()) {
|
||||||
|
char c = *ex2;
|
||||||
|
++ex2;
|
||||||
|
if (c == '.') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static tl::XMLStruct<lay::SaltGrain> xml_struct ("salt-grain",
|
||||||
|
tl::make_member (&SaltGrain::name, &SaltGrain::set_name, "name") +
|
||||||
|
tl::make_member (&SaltGrain::version, &SaltGrain::set_version, "version") +
|
||||||
|
tl::make_member (&SaltGrain::title, &SaltGrain::set_title, "title") +
|
||||||
|
tl::make_member (&SaltGrain::doc, &SaltGrain::set_doc, "doc") +
|
||||||
|
tl::make_member (&SaltGrain::url, &SaltGrain::set_url, "url") +
|
||||||
|
tl::make_element (&SaltGrain::begin_dependencies, &SaltGrain::end_dependencies, &SaltGrain::add_dependency, "depends",
|
||||||
|
tl::make_member (&SaltGrain::Dependency::name, "name") +
|
||||||
|
tl::make_member (&SaltGrain::Dependency::url, "url") +
|
||||||
|
tl::make_member (&SaltGrain::Dependency::version, "version")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::load (const std::string &p)
|
||||||
|
{
|
||||||
|
tl::XMLFileSource source (p);
|
||||||
|
xml_struct.parse (source, *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::save () const
|
||||||
|
{
|
||||||
|
save (tl::to_string (QDir (tl::to_qstring (path ())).filePath (tl::to_qstring (grain_filename))));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaltGrain::save (const std::string &p) const
|
||||||
|
{
|
||||||
|
tl::OutputStream os (p, tl::OutputStream::OM_Plain);
|
||||||
|
xml_struct.write (os, *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
SaltGrain
|
||||||
|
SaltGrain::from_path (const std::string &path)
|
||||||
|
{
|
||||||
|
QDir dir (tl::to_qstring (path));
|
||||||
|
|
||||||
|
SaltGrain g;
|
||||||
|
g.load (tl::to_string (dir.filePath (tl::to_qstring (grain_filename))));
|
||||||
|
g.set_path (tl::to_string (dir.absolutePath ()));
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SaltGrain::is_grain (const std::string &path)
|
||||||
|
{
|
||||||
|
QDir dir (tl::to_qstring (path));
|
||||||
|
QString gf = dir.filePath (tl::to_qstring (grain_filename));
|
||||||
|
return QFileInfo (gf).exists ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,264 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HDR_laySaltGrain
|
||||||
|
#define HDR_laySaltGrain
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
#include "tlObject.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class represents on grain of salt
|
||||||
|
* "One grain of salt" is one package.
|
||||||
|
*/
|
||||||
|
class LAY_PUBLIC SaltGrain
|
||||||
|
: public tl::Object
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief A descriptor for one dependency
|
||||||
|
* A dependency can be specified either through a name (see name property)
|
||||||
|
* or a download URL. If download URL are specified, they have precedence
|
||||||
|
* over names.
|
||||||
|
* The version is the minimum required version. If empty, any version is
|
||||||
|
* allowed to resolve this dependency.
|
||||||
|
*/
|
||||||
|
struct Dependency
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
std::string url;
|
||||||
|
std::string version;
|
||||||
|
|
||||||
|
bool operator== (const Dependency &other) const
|
||||||
|
{
|
||||||
|
return name == other.name && url == other.url && version == other.version;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*/
|
||||||
|
SaltGrain ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Equality
|
||||||
|
*/
|
||||||
|
bool operator== (const SaltGrain &other) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Inequality
|
||||||
|
*/
|
||||||
|
bool operator!= (const SaltGrain &other) const
|
||||||
|
{
|
||||||
|
return !operator== (other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the name of the grain
|
||||||
|
*
|
||||||
|
* The name is either a plain name (a word) or a path into a collection.
|
||||||
|
* Name paths are formed using the "/" separator. "mypackage" is a plain name,
|
||||||
|
* while "mycollection/mypackage" is a package within a collection. Collections
|
||||||
|
* can be used to group packages. Names are case sensitive in general, but
|
||||||
|
* names differing only in case should be avoided.
|
||||||
|
*/
|
||||||
|
const std::string &name () const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the name of the grain
|
||||||
|
*/
|
||||||
|
void set_name (const std::string &p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the title of the grain
|
||||||
|
*
|
||||||
|
* The title is a brief description that is shown in the title of the
|
||||||
|
* package manager.
|
||||||
|
*/
|
||||||
|
const std::string &title () const
|
||||||
|
{
|
||||||
|
return m_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the title of the grain
|
||||||
|
*/
|
||||||
|
void set_title (const std::string &t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the documentation text of the grain
|
||||||
|
*
|
||||||
|
* The documentation text is an XML document using
|
||||||
|
* KLayout's doc format.
|
||||||
|
*/
|
||||||
|
const std::string &doc () const
|
||||||
|
{
|
||||||
|
return m_doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the documentation text of the grain
|
||||||
|
*/
|
||||||
|
void set_doc (const std::string &t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the version of the grain
|
||||||
|
*
|
||||||
|
* A version string is of the form "x.y..." where x, y and other version
|
||||||
|
* components are integer numbers.
|
||||||
|
*/
|
||||||
|
const std::string &version () const
|
||||||
|
{
|
||||||
|
return m_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the version of the grain
|
||||||
|
*/
|
||||||
|
void set_version (const std::string &v);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the absolute file path of the installed grain
|
||||||
|
* This is the file path to the grain folder.
|
||||||
|
*/
|
||||||
|
const std::string &path () const
|
||||||
|
{
|
||||||
|
return m_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the absolute file path of the installed grain
|
||||||
|
*/
|
||||||
|
void set_path (const std::string &p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the download URL
|
||||||
|
* The download URL is the place from which the grain was installed originally.
|
||||||
|
*/
|
||||||
|
const std::string &url () const
|
||||||
|
{
|
||||||
|
return m_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the download URL
|
||||||
|
*/
|
||||||
|
void set_url (const std::string &u);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the dependencies of the grain
|
||||||
|
* Grains this grain depends on are installed automatically when the grain
|
||||||
|
* is installed.
|
||||||
|
*/
|
||||||
|
const std::vector<Dependency> &dependencies () const
|
||||||
|
{
|
||||||
|
return m_dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the dependencies of the grain (non-const)
|
||||||
|
*/
|
||||||
|
std::vector<Dependency> &dependencies ()
|
||||||
|
{
|
||||||
|
return m_dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dependency iterator (begin)
|
||||||
|
*/
|
||||||
|
std::vector<Dependency>::const_iterator begin_dependencies () const
|
||||||
|
{
|
||||||
|
return m_dependencies.begin ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dependency iterator (end)
|
||||||
|
*/
|
||||||
|
std::vector<Dependency>::const_iterator end_dependencies () const
|
||||||
|
{
|
||||||
|
return m_dependencies.end ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a dependency
|
||||||
|
*/
|
||||||
|
void add_dependency (const Dependency &dep)
|
||||||
|
{
|
||||||
|
m_dependencies.push_back (dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Loads the data from a given file
|
||||||
|
* This method will *not* set the path.
|
||||||
|
*/
|
||||||
|
void load (const std::string &file_path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Saves the data to the path inside the grain folder given by the "path" property
|
||||||
|
*/
|
||||||
|
void save () const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Saves the data to the given file
|
||||||
|
*/
|
||||||
|
void save (const std::string &file_path) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compares two version strings
|
||||||
|
* Returns -1 if v1 < v2, 0 if v1 == v2 and 1 if v1 > v2.
|
||||||
|
* Malformed versions are read gracefully. Letters and non-digits are skipped.
|
||||||
|
* Missing numbers are read as 0. Hence "1.0 == 1" for example.
|
||||||
|
*/
|
||||||
|
static int compare_versions (const std::string &v1, const std::string &v2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Detects a grain from the given directory
|
||||||
|
* This method will return a grain constructed from the given directory.
|
||||||
|
* The data is read from "path/grain.xml". This method will throw an
|
||||||
|
* exception if an error occurs during reading.
|
||||||
|
*/
|
||||||
|
static SaltGrain from_path (const std::string &path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a value indicating whether the given path represents is a grain
|
||||||
|
*/
|
||||||
|
static bool is_grain (const std::string &path);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_name;
|
||||||
|
std::string m_version;
|
||||||
|
std::string m_path;
|
||||||
|
std::string m_url;
|
||||||
|
std::string m_title;
|
||||||
|
std::string m_doc;
|
||||||
|
std::vector<Dependency> m_dependencies;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "laySaltGrains.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HDR_laySaltGrains
|
||||||
|
#define HDR_laySaltGrains
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "laySaltManagerDialog.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
SaltManagerDialog::SaltManagerDialog (QWidget *parent)
|
||||||
|
: QDialog (parent)
|
||||||
|
{
|
||||||
|
Ui::SaltManagerDialog::setupUi (this);
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HDR_laySaltManager
|
||||||
|
#define HDR_laySaltManager
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "ui_SaltManagerDialog.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The dialog for managing the Salt ("Packages")
|
||||||
|
*/
|
||||||
|
class SaltManagerDialog
|
||||||
|
: public QDialog, private Ui::SaltManagerDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*/
|
||||||
|
SaltManagerDialog (QWidget *parent);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2017 Matthias Koefferlein
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This program 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 this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "laySaltGrain.h"
|
||||||
|
#include "utHead.h"
|
||||||
|
|
||||||
|
TEST (1)
|
||||||
|
{
|
||||||
|
lay::SaltGrain g;
|
||||||
|
|
||||||
|
g.set_name ("abc");
|
||||||
|
EXPECT_EQ (g.name (), "abc");
|
||||||
|
g.set_url ("xyz");
|
||||||
|
EXPECT_EQ (g.url (), "xyz");
|
||||||
|
g.set_version ("1.0");
|
||||||
|
EXPECT_EQ (g.version (), "1.0");
|
||||||
|
g.set_path ("a/b");
|
||||||
|
EXPECT_EQ (g.path (), "a/b");
|
||||||
|
g.set_title ("title");
|
||||||
|
EXPECT_EQ (g.title (), "title");
|
||||||
|
g.set_doc ("doc");
|
||||||
|
EXPECT_EQ (g.doc (), "doc");
|
||||||
|
|
||||||
|
g.add_dependency (lay::SaltGrain::Dependency ());
|
||||||
|
g.dependencies ().back ().name = "depname";
|
||||||
|
g.dependencies ().back ().url = "depurl";
|
||||||
|
g.dependencies ().back ().version = "0.0";
|
||||||
|
EXPECT_EQ (int (g.dependencies ().size ()), 1);
|
||||||
|
|
||||||
|
lay::SaltGrain gg;
|
||||||
|
EXPECT_EQ (g == gg, false);
|
||||||
|
EXPECT_EQ (g == g, true);
|
||||||
|
EXPECT_EQ (g != gg, true);
|
||||||
|
EXPECT_EQ (g != g, false);
|
||||||
|
|
||||||
|
gg = g;
|
||||||
|
EXPECT_EQ (g == gg, true);
|
||||||
|
|
||||||
|
gg.set_doc ("blabla");
|
||||||
|
EXPECT_EQ (g == gg, false);
|
||||||
|
|
||||||
|
std::string tmp = tmp_file ();
|
||||||
|
|
||||||
|
EXPECT_EQ (g == gg, false);
|
||||||
|
g.save (tmp);
|
||||||
|
|
||||||
|
EXPECT_EQ (g == gg, false);
|
||||||
|
|
||||||
|
gg = lay::SaltGrain ();
|
||||||
|
gg.load (tmp);
|
||||||
|
gg.set_path (g.path ()); // path is not set by load(file)
|
||||||
|
EXPECT_EQ (int (gg.dependencies ().size ()), 1);
|
||||||
|
EXPECT_EQ (g == gg, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST (2)
|
||||||
|
{
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("", ""), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1", "2"), -1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1", ""), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1", "1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("2", "1"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0", "2.0"), -1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0", "1.0"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.1", "1.0"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0.1", "1.0.0"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0.1", "1.0"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0.1", "1"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.0.0", "1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1a", "1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.a.1", "1.0.1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.1a", "1.1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.1a", "1.0"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.1a.1", "1.0"), 1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("1.1a.1", "1.1.1"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("990", "991"), -1);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("990", "990"), 0);
|
||||||
|
EXPECT_EQ (lay::SaltGrain::compare_versions ("991", "990"), 1);
|
||||||
|
}
|
||||||
|
|
@ -95,7 +95,8 @@ SOURCES = \
|
||||||
tlVariant.cc \
|
tlVariant.cc \
|
||||||
tlXMLParser.cc \
|
tlXMLParser.cc \
|
||||||
gsiTest.cc \
|
gsiTest.cc \
|
||||||
tlFileSystemWatcher.cc
|
tlFileSystemWatcher.cc \
|
||||||
|
laySaltGrain.cc
|
||||||
|
|
||||||
# main components:
|
# main components:
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue