Changeset 561 for trunk/tools/designer/src/lib/shared/qtresourceview.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/designer/src/lib/shared/qtresourceview.cpp
r372 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the Qt Designer of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include "qtresourceeditordialog_p.h" 46 46 #include "iconloader_p.h" 47 47 48 48 49 #include <QtDesigner/QDesignerFormEditorInterface> … … 149 150 void slotCopyResourcePath(); 150 151 void slotListWidgetContextMenuRequested(const QPoint &pos); 152 151 153 void createPaths(); 152 154 QTreeWidgetItem *createPath(const QString &path, QTreeWidgetItem *parent); … … 157 159 void saveSettings(); 158 160 void updateActions(); 161 159 162 160 163 QPixmap makeThumbnail(const QPixmap &pix) const; … … 163 166 QtResourceModel *m_resourceModel; 164 167 QToolBar *m_toolBar; 168 165 169 QTreeWidget *m_treeWidget; 166 170 QListWidget *m_listWidget; 167 171 QSplitter *m_splitter; 168 QMap<QString, QStringList> m_pathToContents; // full path to contents file names 172 QMap<QString, QStringList> m_pathToContents; // full path to contents file names (full path to its resource filenames) 173 QMap<QString, QString> m_pathToParentPath; // full path to full parent path 174 QMap<QString, QStringList> m_pathToSubPaths; // full path to full sub paths 169 175 QMap<QString, QTreeWidgetItem *> m_pathToItem; 170 176 QMap<QTreeWidgetItem *, QString> m_itemToPath; … … 180 186 QString m_settingsKey; 181 187 bool m_resourceEditingEnabled; 188 182 189 }; 183 190 … … 256 263 } 257 264 265 266 267 268 269 270 258 271 void QtResourceViewPrivate::storeExpansionState() 259 272 { … … 299 312 m_editResourcesAction->setEnabled(resourceActive); 300 313 m_reloadResourcesAction->setEnabled(resourceActive); 314 301 315 } 302 316 … … 312 326 m_treeWidget->clear(); 313 327 m_pathToContents.clear(); 328 329 314 330 m_pathToItem.clear(); 315 331 m_itemToPath.clear(); … … 325 341 else if (!currentPath.isEmpty()) 326 342 q_ptr->selectResource(currentPath); 343 327 344 } 328 345 … … 366 383 367 384 const QString root(QLatin1Char(':')); 368 369 QMap<QString, QString> pathToParentPath; // full path to full parent path370 QMap<QString, QStringList> pathToSubPaths; // full path to full sub paths371 385 372 386 QMap<QString, QString> contents = m_resourceModel->contents(); … … 377 391 QString dirPath = fi.absolutePath(); 378 392 m_pathToContents[dirPath].append(fi.fileName()); 379 while (! pathToParentPath.contains(dirPath) && dirPath != root) {393 while (! 380 394 const QFileInfo fd(dirPath); 381 395 const QString parentDirPath = fd.absolutePath(); 382 pathToParentPath[dirPath] = parentDirPath;383 pathToSubPaths[parentDirPath].append(dirPath);396 pathToParentPath[dirPath] = parentDirPath; 397 pathToSubPaths[parentDirPath].append(dirPath); 384 398 dirPath = parentDirPath; 385 399 } … … 392 406 const QString path = pathToParentItem.first; 393 407 QTreeWidgetItem *item = createPath(path, pathToParentItem.second); 394 QStringList subPaths = pathToSubPaths.value(path);408 QStringList subPaths = pathToSubPaths.value(path); 395 409 QStringListIterator itSubPaths(subPaths); 396 410 while (itSubPaths.hasNext()) 397 411 pathToParentItemQueue.enqueue(qMakePair(itSubPaths.next(), item)); 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524