Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/designer/src/lib/shared/qtresourceview.cpp

    r372 r561  
    22**
    33** 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])
    56**
    67** This file is part of the Qt Designer of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include "qtresourceeditordialog_p.h"
    4646#include "iconloader_p.h"
     47
    4748
    4849#include <QtDesigner/QDesignerFormEditorInterface>
     
    149150    void slotCopyResourcePath();
    150151    void slotListWidgetContextMenuRequested(const QPoint &pos);
     152
    151153    void createPaths();
    152154    QTreeWidgetItem *createPath(const QString &path, QTreeWidgetItem *parent);
     
    157159    void saveSettings();
    158160    void updateActions();
     161
    159162
    160163    QPixmap makeThumbnail(const QPixmap &pix) const;
     
    163166    QtResourceModel *m_resourceModel;
    164167    QToolBar *m_toolBar;
     168
    165169    QTreeWidget *m_treeWidget;
    166170    QListWidget *m_listWidget;
    167171    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
    169175    QMap<QString, QTreeWidgetItem *> m_pathToItem;
    170176    QMap<QTreeWidgetItem *, QString> m_itemToPath;
     
    180186    QString m_settingsKey;
    181187    bool m_resourceEditingEnabled;
     188
    182189};
    183190
     
    256263}
    257264
     265
     266
     267
     268
     269
     270
    258271void QtResourceViewPrivate::storeExpansionState()
    259272{
     
    299312    m_editResourcesAction->setEnabled(resourceActive);
    300313    m_reloadResourcesAction->setEnabled(resourceActive);
     314
    301315}
    302316
     
    312326    m_treeWidget->clear();
    313327    m_pathToContents.clear();
     328
     329
    314330    m_pathToItem.clear();
    315331    m_itemToPath.clear();
     
    325341    else if (!currentPath.isEmpty())
    326342        q_ptr->selectResource(currentPath);
     343
    327344}
    328345
     
    366383
    367384    const QString root(QLatin1Char(':'));
    368 
    369     QMap<QString, QString> pathToParentPath; // full path to full parent path
    370     QMap<QString, QStringList> pathToSubPaths; // full path to full sub paths
    371385
    372386    QMap<QString, QString> contents = m_resourceModel->contents();
     
    377391        QString dirPath = fi.absolutePath();
    378392        m_pathToContents[dirPath].append(fi.fileName());
    379         while (!pathToParentPath.contains(dirPath) && dirPath != root) {
     393        while (!
    380394            const QFileInfo fd(dirPath);
    381395            const QString parentDirPath = fd.absolutePath();
    382             pathToParentPath[dirPath] = parentDirPath;
    383             pathToSubPaths[parentDirPath].append(dirPath);
     396            pathToParentPath[dirPath] = parentDirPath;
     397            pathToSubPaths[parentDirPath].append(dirPath);
    384398            dirPath = parentDirPath;
    385399        }
     
    392406        const QString path = pathToParentItem.first;
    393407        QTreeWidgetItem *item = createPath(path, pathToParentItem.second);
    394         QStringList subPaths = pathToSubPaths.value(path);
     408        QStringList subPaths = pathToSubPaths.value(path);
    395409        QStringListIterator itSubPaths(subPaths);
    396410        while (itSubPaths.hasNext())
    397411            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