24 #include <main_window.h> 34 action = MainWindow::getInstance()->createModuleMenuItem(
35 "Load Plugin",
this, SLOT(
load(
void)));
38 MainWindow::getInstance()->insertModuleMenuSeparator();
40 userprefs.setPath(QSettings::NativeFormat,
41 QSettings::SystemScope,
42 "/usr/local/share/rtxi/");
43 userprefs.beginGroup(
"/recentFileList");
44 QStringList entries = userprefs.childKeys();
46 int numRecentFiles = entries.size();
49 for (
int i = 0; i < std::min(numRecentFiles - 2, 10); ++i) {
50 listmodule = userprefs.value(
"/recentFileList/" + entries[i]).toString();
51 text = tr(
"&%1 %2").arg(i).arg(listmodule);
52 MainWindow::getInstance()->createModuleMenuItem(text);
56 userprefs.beginGroup(
"/recentSettingsList");
57 entries = userprefs.childKeys();
59 numRecentFiles = entries.size() - 1;
60 for (
int i = 0; i < std::min(numRecentFiles, 10); ++i) {
62 userprefs.value(
"/recentSettingsList/" + entries[i]).toString();
63 text = tr(
"&%1 %2").arg(i).arg(listmodule);
64 MainWindow::getInstance()->createFileMenuItem(text);
70 MainWindow::getInstance()->removeModuleMenuItem(action);
75 QString plugin_dir = QString(EXEC_PREFIX) + QString(
"/lib/rtxi/");
76 QString filename = QFileDialog::getOpenFileName(
77 0, tr(
"Load plugin"), plugin_dir, tr(
"Plugins (*.so);;All (*.*)"));
79 if (filename.isNull() || filename.isEmpty()
80 || filename.contains(
"model_loader") || filename.contains(
"analogy"))
83 if (filename.startsWith(plugin_dir))
84 filename.remove(0, plugin_dir.length());
86 Plugin::Manager::getInstance()->load(filename.toLatin1());
91 QSettings::NativeFormat, QSettings::SystemScope,
"/usr/local/share/rtxi");
93 int oldestmodule = userprefs.value(
"/recentFileList/start", 0).toInt();
94 if (oldestmodule == 0)
95 userprefs.setValue(
"/recentFileList/start", 0);
97 int num_module = userprefs.value(
"/recentFileList/num", 0).toInt();
98 userprefs.beginGroup(
"/recentFileList");
99 QStringList entries = userprefs.childKeys();
100 userprefs.endGroup();
102 int numRecentFiles = entries.size();
105 bool doesnotexist =
true;
107 for (
int i = 0; i < numRecentFiles; ++i) {
108 listmodule = userprefs.value(
"/recentFileList/" + entries[i]).toString();
109 if (filename == listmodule)
110 doesnotexist =
false;
113 if (num_module == 10) {
114 userprefs.setValue(
"/recentFileList/" + QString::number(oldestmodule),
117 if (oldestmodule == 10)
119 userprefs.setValue(
"/recentFileList/start", oldestmodule);
121 userprefs.setValue(
"/recentFileList/" + QString::number(num_module++),
123 userprefs.setValue(
"/recentFileList/num", num_module);
virtual ~ModelLoader(void)
Plugin::Object * createRTXIPlugin(void *)