Commit 87def01d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Finally make it lookup the plugins in the system directories.

parent fe3c8096
add_subdirectory(scripts)
add_subdirectory(plugins)
kde4_add_executable(kalgebramobile graph2dmobile.cpp
analitzawrapper.cpp kalgebramobile.cpp main.cpp console.cpp)
target_link_libraries(kalgebramobile ${KDE4_KDEUI_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
target_link_libraries(kalgebramobile ${KDE4_KDECORE_LIBS} ${QT_QTSCRIPT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
# ${QT_QTSCRIPTTOOLS_LIBRARY}
analitza analitzagui)
......
......@@ -60,23 +60,18 @@ class PluginsModel : public QStandardItemModel
explicit PluginsModel(QObject* parent = 0)
:QStandardItemModel(parent)
{
#if 0
KStandardDirs d;
QStringList basedirs = d.findDirs("data", "kalgebra/scripts");
QStringList basedirs = d.findDirs("data", "kalgebra/plugins");
QStringList foundPlugins;
foreach(const QString& dir, basedirs) {
//we list <dir>/*/*.desktop
QDir d(dir);
QStringList dirs = d.entryList(QDir::Dirs|QDir::NoDotAndDotDot);
QStringList files = d.entryList(QStringList("*.desktop"));
foreach(const QString& plugindir, dirs) {
QDir pd(d.filePath(plugindir));
QStringList files = pd.entryList(QStringList("*.desktop"));
foreach(const QString& plugin, files) {
foundPlugins += pd.absoluteFilePath(plugin);
}
qDebug() << "lalala" << dir << files;
foreach(const QString& plugin, files) {
foundPlugins += d.absoluteFilePath(plugin);
}
}
......@@ -88,7 +83,7 @@ class PluginsModel : public QStandardItemModel
// const KPluginInfo& info;
QStandardItem* item = new QStandardItem(KIcon(info.icon()), info.name());
QString postfix = "kalgebra/scripts/"+info.pluginName();
QString postfix = "kalgebra/plugins/"+info.pluginName();
QString scriptPath = KStandardDirs::locate("data", postfix);
Q_ASSERT(!scriptPath.isEmpty());
......@@ -101,18 +96,6 @@ class PluginsModel : public QStandardItemModel
appendRow(item);
}
#endif
QDir pd("/home/kde-devel/kalgebra/mobile/plugins/");
QStringList files = pd.entryList(QStringList("*.qml")), foundPlugins;
qDebug() << "tururuuuuu" << files;
foreach(const QString& plugin, files) {
QString scriptPath = pd.absoluteFilePath(plugin);
QStandardItem* item = new QStandardItem(plugin);
item->setData(scriptPath, PathRole);
item->setData(0, PriorityRole);
appendRow(item);
}
setSortRole(PriorityRole);
sort(0);
}
......
add_subdirectory(widgets)
install( FILES
Console.qml Plot2D.qml Tables.qml
kalgebraconsole.desktop kalgebraplot2d.desktop kalgebratables.desktop
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/plugins/
)
......@@ -54,7 +54,7 @@ Comment[zh_TW]=提供主控台以使用 KAlgebra 做為計算機
X-KDE-PluginInfo-Author=Aleix Pol Gonzalez
X-KDE-PluginInfo-Email=aleixpol@kde.org
X-KDE-PluginInfo-Name=console/console.js
X-KDE-PluginInfo-Name=Console.qml
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-License=GPL
X-KAlgebra-Priority=0
......@@ -53,6 +53,6 @@ Comment[zh_TW]=讓您繪製平面圖形
X-KDE-PluginInfo-Author=Aleix Pol Gonzalez
X-KDE-PluginInfo-Email=aleixpol@kde.org
X-KDE-PluginInfo-Name=plot2d/plot2d.js
X-KDE-PluginInfo-Name=Plot2D.qml
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-License=GPL
......@@ -52,6 +52,6 @@ Comment[zh_TW]=提供主控台以使用 KAlgebra 做為計算機
X-KDE-PluginInfo-Author=Aleix Pol Gonzalez
X-KDE-PluginInfo-Email=aleixpol@kde.org
X-KDE-PluginInfo-Name=tables/tables.js
X-KDE-PluginInfo-Name=Tables.qml
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-License=GPL
install( FILES
Button.qml CalcButton.qml CategoryDelegate.qml ConsoleDelegate.qml ConsoleModel.qml ExpressionInput.qml Keyboard.qml RealInput.qml ToolTip.qml
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/plugins/widgets/
)
add_subdirectory(console)
add_subdirectory(plot2d)
add_subdirectory(tables)
add_subdirectory(variables)
install( FILES
console.js kalgebraconsole.desktop
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/scripts/console/
)
KAlgebraExtension.prototype.addOperation = function()
{
with(this.ui) {
console.addItem(Analitza.execute(display.text))
display.selectAll()
console.scrollDown()
}
}
function KAlgebraExtension(cfg)
{
this.ui = cfg.newVerticalLayout();
this.ui.addWidget(cfg.newListWidget("console"));
this.ui.addWidget(cfg.newQLineEdit("display"));
this.ui.display.setFocus()
this.ui.display.returnPressed.connect(this, this.addOperation);
}
install( FILES
plot2d.js
kalgebraplot2d.desktop
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/scripts/plot2d/
)
KAlgebraExtension.prototype.edit = function()
{
this.dialog.show()
}
function KAlgebraExtension(cfg)
{
this.ui = cfg.newVerticalLayout();
this.dialog = cfg.newFunctionsDialog("dialog");
this.ui.addWidget(cfg.newGraph2D("graph"));
this.ui.addWidget(cfg.newQPushButton("edit"));
this.ui.edit.text = "Edit"
this.ui.edit.clicked.connect(this, this.edit);
}
install( FILES
tables.js kalgebratables.desktop
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/scripts/tables/
)
KAlgebraExtension.prototype.execute = function()
{
var a=Analitza;
with(this.ui) {
list.clear();
var tmp = a.unusedVariableName();
print(a.execute(tmp+":="+display.text));
for (var i=from.value; i<=to.value; i++) {
print(":::: "+tmp + ", " + i);
var args = new Array();
args[0]=i;
list.addItem(i+": "+a.executeFunc(tmp, args));
}
a.removeVariable(tmp);
}
}
function KAlgebraExtension(cfg)
{
this.ui = cfg.newVerticalLayout();
this.ui.addWidget(cfg.newQLineEdit("display"));
this.ui.addWidget(cfg.newQDoubleSpinBox("from"));
this.ui.addWidget(cfg.newQDoubleSpinBox("to"));
this.ui.addWidget(cfg.newListWidget("list"));
this.ui.addWidget(cfg.newQPushButton("go"));
this.ui.go.text = "Go!"
this.ui.go.clicked.connect(this, this.execute);
}
install( FILES
variables.js kalgebravariables.desktop
DESTINATION ${DATA_INSTALL_DIR}/kalgebra/scripts/variables/
)
[Desktop Entry]
Icon=code-variable
Type=Service
ServiceTypes=KAlgebra/Script
Name=Variables
Name[bs]=Promjenljive
Name[ca]=Variables
Name[ca@valencia]=Variables
Name[cs]=Proměnné
Name[da]=Variabler
Name[de]=Variablen
Name[en_GB]=Variables
Name[es]=Variables
Name[et]=Muutujad
Name[fi]=Muuttujat
Name[fr]=Variables
Name[gl]=Variábeis
Name[it]=Variabili
Name[ja]=変数
Name[km]=អថេរ
Name[nb]=Variabler
Name[nds]=Variabeln
Name[nl]=Variabelen
Name[pa]=ਵੇਰੀਬਲ
Name[pt]=Variáveis
Name[pt_BR]=Variáveis
Name[ru]=Переменные
Name[sl]=Spremenljivke
Name[sv]=Variabler
Name[ug]=ئۆزگەرگۈچىلەر
Name[uk]=Змінні
Name[x-test]=xxVariablesxx
Name[zh_TW]=變數
Comment=Provides an enumeration of all defined variables
Comment[ca]=Enumera totes les variables definides
Comment[ca@valencia]=Enumera totes les variables definides
Comment[da]=Giver en nummerering af alle definerede værdier
Comment[de]=Stellt eine Aufzählung aller definierten Variablen bereit
Comment[en_GB]=Provides an enumeration of all defined variables
Comment[es]=Proporciona una enumeración de todas las variables definidas
Comment[et]=Kõigi defineeritud muutujate loend
Comment[fr]=Fournit une énumération de toutes les variables définies
Comment[gl]=Fornece unha enumeración de todas as variábeis definidas
Comment[it]=Fornisce un elenco di tutte le variabili definite
Comment[km]=ផ្ដល់​នូវ​ការ​រាយ​ឈ្មោះ​អថេរ​ទាំង​អស់​ដែល​បាន​កំណត់
Comment[nb]=Gir en oppregning av alle definerte variabler
Comment[nds]=All defineert Variabeln optellen
Comment[nl]=Biedt en opsomming van alle gedefinieerde variabelen
Comment[pt]=Fornece uma enumeração de todas as variáveis definidas
Comment[pt_BR]=Fornece uma enumeração de todas as variáveis definidas
Comment[ru]=Список всех определённых переменных
Comment[sl]=Ponuja seznam vseh definiranih spremenljivk
Comment[sv]=Tillhandahåller en uppräkning av alla variabler
Comment[uk]=Показує перелік всіх визначених змінних
Comment[x-test]=xxProvides an enumeration of all defined variablesxx
Comment[zh_TW]=提供所有已定義變數的列舉。
X-KDE-PluginInfo-Author=Aleix Pol Gonzalez
X-KDE-PluginInfo-Email=aleixpol@kde.org
X-KDE-PluginInfo-Name=variables/variables.js
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-License=GPL
function KAlgebraExtension(cfg)
{
this.ui = cfg.newTreeView("view");
this.ui.rootIsDecorated = false;
this.ui.setModel(VariablesModel);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment