Sessions.qml 2.35 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
Eike Ziller's avatar
Eike Ziller committed
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
Eike Ziller's avatar
Eike Ziller committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
Eike Ziller's avatar
Eike Ziller committed
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
Eike Ziller's avatar
Eike Ziller committed
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22 23 24 25
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
Eike Ziller's avatar
Eike Ziller committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
Eike Ziller's avatar
Eike Ziller committed
29

30 31
import QtQuick 2.1
import widgets 1.0
32

33
Item {
34 35
    id: root
    property var model
36
    property int topMargin: 6
37
    height: Math.min(content.contentHeight + topMargin, parent.height - 260)
38

39
    ListView {
40 41
        id: content
        model: root.model
Jens Bache-Wiig's avatar
Jens Bache-Wiig committed
42

43
        anchors.fill: parent
44
        anchors.topMargin: topMargin
45 46
        snapMode: ListView.SnapToItem
        spacing: 4
47
        clip: true
48

49 50 51 52 53 54 55 56 57 58 59 60
        delegate: SessionItem {
            function fullSessionName()
            {
                var newSessionName = sessionName
                if (model.lastSession && sessionList.isDefaultVirgin())
                    newSessionName = qsTr("%1 (last session)").arg(sessionName);
                else if (model.activeSession && !sessionList.isDefaultVirgin())
                    newSessionName = qsTr("%1 (current session)").arg(sessionName);
                return newSessionName;
            }
            name: fullSessionName()
        }
61
    }
62
}