22 #include <qcombobox.h>
23 #include <qlistwidget.h>
24 #include <qmessagebox.h>
26 #include <QGridLayout>
36 #define TR(id) OLocalizator::getString("TYLibraryWidget", (id))
42 setWindowTitle(
TR(
"id_caption"));
43 QGridLayout* pLayout =
new QGridLayout();
64 dirPath = QDir::toNativeSeparators(
getTYApp()->tympanUserDir() +
"/library/");
84 SLOT(comboboxItemChanged(QString)));
99 SLOT(comboboxItemChanged(QString)));
171 QStringList subdirs_filters;
172 subdirs_filters.append(
"*");
173 QStringList subdirsList = dir.entryList(subdirs_filters, QDir::Dirs, QDir::Name);
176 for (
unsigned int j = 0; j < subdirsList.count(); ++j)
178 QString subdirname = subdirsList[j];
190 QString categName = dir.canonicalPath();
192 categName.remove(0, rootDir.canonicalPath().length());
197 filters.append(
"*.xml");
198 QStringList fileList = dir.entryList(filters, QDir::Files, QDir::Name);
204 for (
unsigned int i = 0; i < fileList.count(); ++i)
208 QString filename = QDir::toNativeSeparators(dir.path() +
"/" + fileList[i]);
216 QString item = fileList[i].section(
".", -2, -2);
223 if ((eltName ==
"TYSiteNode") || (eltName ==
"TYInfrastructure") ||
224 (eltName ==
"TYUserSourcePonctuelle") || (eltName ==
"TYBatiment") ||
225 (eltName ==
"TYMachine") || (eltName ==
"TYReseauTransport") || (eltName ==
"TYRoute") ||
226 (eltName ==
"TYTopographie") || (eltName ==
"TYPlanEau") || (eltName ==
"TYCoursEau") ||
227 (eltName ==
"TYCourbeNiveau") || (eltName ==
"TYTerrain"))
229 QString item = fileList[i].section(
".", -2, -2);
237 if ((eltName ==
"TYInfrastructure") || (eltName ==
"TYUserSourcePonctuelle") ||
238 (eltName ==
"TYBatiment") || (eltName ==
"TYMachine") ||
239 (eltName ==
"TYReseauTransport") || (eltName ==
"TYRoute"))
241 QString item = fileList[i].section(
".", -2, -2);
249 if ((eltName ==
"TYUserSourcePonctuelle"))
251 QString item = fileList[i].section(
".", -2, -2);
259 if ((eltName ==
"TYBatiment"))
261 QString item = fileList[i].section(
".", -2, -2);
269 if ((eltName ==
"TYEtage") || (eltName ==
"TYAcousticCylinder"))
271 QString item = fileList[i].section(
".", -2, -2);
279 if ((eltName ==
"TYUserSourcePonctuelle") || (eltName ==
"TYMachine"))
281 QString item = fileList[i].section(
".", -2, -2);
289 if ((eltName ==
"TYMachine"))
291 QString item = fileList[i].section(
".", -2, -2);
299 if ((eltName ==
"TYReseauTransport"))
301 QString item = fileList[i].section(
".", -2, -2);
309 if ((eltName ==
"TYRoute"))
311 QString item = fileList[i].section(
".", -2, -2);
319 if ((eltName ==
"TYTopographie") || (eltName ==
"TYPlanEau") || (eltName ==
"TYCoursEau") ||
320 (eltName ==
"TYCourbeNiveau") || (eltName ==
"TYTerrain"))
322 QString item = fileList[i].section(
".", -2, -2);
330 if ((eltName ==
"TYPlanEau"))
332 QString item = fileList[i].section(
".", -2, -2);
340 if ((eltName ==
"TYCoursEau"))
342 QString item = fileList[i].section(
".", -2, -2);
350 if ((eltName ==
"TYCourbeNiveau"))
352 QString item = fileList[i].section(
".", -2, -2);
360 if ((eltName ==
"TYTerrain"))
362 QString item = fileList[i].section(
".", -2, -2);
370 if ((eltName ==
"TYSiteNode"))
372 QString item = fileList[i].section(
".", -2, -2);
390 if (e->key() == Qt::Key_Delete)
393 QString dirPath = QDir::toNativeSeparators(
getTYApp()->tympanUserDir() +
"/library/");
398 if (!QMessageBox::question(
this,
TR(
"id_delete_box_caption"),
400 TR(
"id_delete_box_yes"),
TR(
"id_delete_box_no"), QString(), 0, 1))
404 QMessageBox::information(
this,
"Tympan",
425 QMessageBox::warning(
this,
"Tympan",
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
pour l'application Tympan (fichier header)
#define TYDIRPREFERENCEMANAGER
int getEltType(const QString &fileName, QString &eltType)