editorview.cpp 19.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact:  Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file.  Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/

#include "editorview.h"
#include "editormanager.h"
#include "coreimpl.h"

#include <utils/qtcassert.h>

#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QMimeData>

#include <QtGui/QApplication>
#include <QtGui/QComboBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QStackedWidget>
#include <QtGui/QStyle>
#include <QtGui/QStyleOption>
#include <QtGui/QToolBar>
#include <QtGui/QToolButton>
#ifdef Q_WS_MAC
#include <qmacstyle_mac.h>
#endif

Q_DECLARE_METATYPE(Core::IEditor *)

using namespace Core;
using namespace Core::Internal;


//================EditorModel====================
int EditorModel::columnCount(const QModelIndex &parent) const
{
    Q_UNUSED(parent);
    return 1;
}

int EditorModel::rowCount(const QModelIndex &parent) const
{
    if (!parent.isValid())
        return m_editors.count();
    return 0;
}

mae's avatar
mae committed
80
void EditorModel::addEditor(IEditor *editor, bool isDuplicate)
81
{
mae's avatar
mae committed
82
83
84
85
86
    if (isDuplicate) {
        m_duplicateEditors.append(editor);
        return;
    }

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    int index = 0;

    QString fileName = editor->file()->fileName();
    for (index = 0; index < m_editors.count(); ++index)
        if (fileName < m_editors.at(index)->file()->fileName())
            break;

    beginInsertRows(QModelIndex(), index, index);
    m_editors.insert(index, editor);
    connect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
    endInsertRows();
}

void EditorModel::removeEditor(IEditor *editor)
{
mae's avatar
mae committed
102
    m_duplicateEditors.removeAll(editor);
103
104
105
106
107
108
109
110
111
    int idx = m_editors.indexOf(editor);
    if (idx < 0)
        return;
    beginRemoveRows(QModelIndex(), idx, idx);
    m_editors.removeAt(idx);
    endRemoveRows();
    disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
}

mae's avatar
mae committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
bool EditorModel::isDuplicate(IEditor *editor) const
{
    return m_duplicateEditors.contains(editor);
}

IEditor *EditorModel::originalForDuplicate(IEditor *duplicate) const
{
    IFile *file = duplicate->file();
    foreach(IEditor *e, m_editors)
        if (e->file() == file)
            return e;
    return 0;
}

QList<IEditor *> EditorModel::duplicatesFor(IEditor *editor) const
{
    QList<IEditor *> result;
    IFile *file = editor->file();
    foreach(IEditor *e, m_duplicateEditors)
        if (e->file() == file)
            result += e;
    return result;
}
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216

void EditorModel::emitDataChanged(IEditor *editor)
{
    int idx = m_editors.indexOf(editor);
    if (idx < 0)
        return;
    QModelIndex mindex = index(idx, 0);
    emit dataChanged(mindex, mindex);
}

QModelIndex EditorModel::index(int row, int column, const QModelIndex &parent) const
{
    Q_UNUSED(parent);
    if (column != 0 || row < 0 || row >= m_editors.count())
        return QModelIndex();
    return createIndex(row, column);
}

QVariant EditorModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();
    IEditor *editor = m_editors.at(index.row());
    QTC_ASSERT(editor, return QVariant());
    switch (role) {
    case Qt::DisplayRole:
        return editor->file()->isModified()
                ? editor->displayName() + QLatin1String("*")
                : editor->displayName();
    case Qt::DecorationRole:
        return editor->file()->isReadOnly()
                ? QIcon(QLatin1String(":/core/images/locked.png"))
                : QIcon();
    case Qt::ToolTipRole:
        return editor->file()->fileName().isEmpty()
                ? editor->displayName()
                : QDir::toNativeSeparators(editor->file()->fileName());
    case Qt::UserRole:
        return qVariantFromValue(editor);
    default:
        return QVariant();
    }
    return QVariant();
}

QModelIndex EditorModel::indexOf(IEditor *editor) const
{
    int idx = m_editors.indexOf(editor);
    if (idx < 0)
        return indexOf(editor->file()->fileName());
    return createIndex(idx, 0);
}

QModelIndex EditorModel::indexOf(const QString &fileName) const
{
    for (int i = 0; i < m_editors.count(); ++i)
        if (m_editors.at(i)->file()->fileName() == fileName)
            return createIndex(i, 0);
    return QModelIndex();
}


void EditorModel::itemChanged()
{
    emitDataChanged(qobject_cast<IEditor*>(sender()));
}



//================EditorView====================

EditorView::EditorView(EditorModel *model, QWidget *parent) :
    QWidget(parent),
    m_toolBar(new QWidget),
    m_container(new QStackedWidget(this)),
    m_editorList(new QComboBox),
    m_closeButton(new QToolButton),
    m_lockButton(new QToolButton),
    m_defaultToolBar(new QToolBar(this)),
    m_infoWidget(new QFrame(this)),
    m_editorForInfoWidget(0)
{
217
    QVBoxLayout *tl = new QVBoxLayout(this);
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
    tl->setSpacing(0);
    tl->setMargin(0);
    {
        m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        m_editorList->setMinimumContentsLength(20);
        m_editorList->setModel(model);
        m_editorList->setMaxVisibleItems(40);

        QToolBar *editorListToolBar = new QToolBar;

        editorListToolBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
        editorListToolBar->addWidget(m_editorList);

        m_defaultToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
        m_activeToolBar = m_defaultToolBar;

        QHBoxLayout *toolBarLayout = new QHBoxLayout;
        toolBarLayout->setMargin(0);
        toolBarLayout->setSpacing(0);
        toolBarLayout->addWidget(m_defaultToolBar);
        m_toolBar->setLayout(toolBarLayout);

        m_lockButton->setAutoRaise(true);
        m_lockButton->setProperty("type", QLatin1String("dockbutton"));

        m_closeButton->setAutoRaise(true);
        m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
        m_closeButton->setProperty("type", QLatin1String("dockbutton"));

        QToolBar *rightToolBar = new QToolBar;
        rightToolBar->setLayoutDirection(Qt::RightToLeft);
        rightToolBar->addWidget(m_closeButton);
        rightToolBar->addWidget(m_lockButton);

        QHBoxLayout *toplayout = new QHBoxLayout;
        toplayout->setSpacing(0);
        toplayout->setMargin(0);
        toplayout->addWidget(editorListToolBar);
        toplayout->addWidget(m_toolBar, 1); // Custom toolbar stretches
        toplayout->addWidget(rightToolBar);

        QWidget *top = new QWidget;
        QVBoxLayout *vlayout = new QVBoxLayout(top);
        vlayout->setSpacing(0);
        vlayout->setMargin(0);
        vlayout->addLayout(toplayout);
        tl->addWidget(top);

mae's avatar
mae committed
266
        connect(m_editorList, SIGNAL(activated(int)), this, SLOT(listSelectionActivated(int)));
267
        connect(m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable()));
mae's avatar
mae committed
268
        connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeView()));
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
    }
    {
        m_infoWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
        m_infoWidget->setLineWidth(1);
        m_infoWidget->setForegroundRole(QPalette::ToolTipText);
        m_infoWidget->setBackgroundRole(QPalette::ToolTipBase);
        m_infoWidget->setAutoFillBackground(true);


        QHBoxLayout *hbox = new QHBoxLayout(m_infoWidget);
        hbox->setMargin(2);
        m_infoWidgetLabel = new QLabel("Placeholder");
        m_infoWidgetLabel->setForegroundRole(QPalette::ToolTipText);
        hbox->addWidget(m_infoWidgetLabel);
        hbox->addStretch(1);

        m_infoWidgetButton = new QToolButton;
        m_infoWidgetButton->setText(tr("Placeholder"));
        hbox->addWidget(m_infoWidgetButton);

        QToolButton *closeButton = new QToolButton;
        closeButton->setAutoRaise(true);
        closeButton->setIcon(QIcon(":/core/images/clear.png"));
        closeButton->setToolTip(tr("Close"));
        connect(closeButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide()));

        hbox->addWidget(closeButton);


        m_infoWidget->setVisible(false);
        tl->addWidget(m_infoWidget);
    }
    tl->addWidget(m_container);

}

void EditorView::showEditorInfoBar(const QString &kind,
                                           const QString &infoText,
                                           const QString &buttonText,
                                           QObject *object, const char *member)
{
    m_infoWidgetKind = kind;
    m_infoWidgetLabel->setText(infoText);
    m_infoWidgetButton->setText(buttonText);
    m_infoWidgetButton->disconnect();
    if (object && member)
        connect(m_infoWidgetButton, SIGNAL(clicked()), object, member);
    m_infoWidget->setVisible(true);
    m_editorForInfoWidget = currentEditor();
}

void EditorView::hideEditorInfoBar(const QString &kind)
{
    if (kind == m_infoWidgetKind)
        m_infoWidget->setVisible(false);
}


EditorView::~EditorView()
{
}

void EditorView::addEditor(IEditor *editor)
{
    if (m_container->indexOf(editor->widget()) != -1)
        return;

mae's avatar
mae committed
336
    m_container->addWidget(editor->widget());
337
338
339
340
341
342
343
344
    m_widgetEditorMap.insert(editor->widget(), editor);

    QToolBar *toolBar = editor->toolBar();
    if (toolBar) {
        toolBar->setVisible(false); // will be made visible in setCurrentEditor
        m_toolBar->layout()->addWidget(toolBar);
    }
    connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
mae's avatar
mae committed
345
346

    if (m_container->count() == 1) {
347
        m_editorList->setCurrentIndex(qobject_cast<EditorModel*>(m_editorList->model())->indexOf(editor->file()->fileName()).row());
mae's avatar
mae committed
348
        updateEditorStatus(editor);
349
        updateToolBar(editor);
mae's avatar
mae committed
350
    }
351
352
}

353
354
355
356
357
bool EditorView::hasEditor(IEditor *editor) const
{
    return (m_container->indexOf(editor->widget()) != -1);
}

mae's avatar
mae committed
358
void EditorView::closeView()
359
{
mae's avatar
mae committed
360
361
    if (editorCount() == 0)
        return;
362
    EditorManager *em = CoreImpl::instance()->editorManager();
mae's avatar
mae committed
363
    em->closeView(this);
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
}

void EditorView::removeEditor(IEditor *editor)
{
    QTC_ASSERT(editor, return);
    const int index = m_container->indexOf(editor->widget());
    if (index != -1) {
        m_container->removeWidget(editor->widget());
        m_widgetEditorMap.remove(editor->widget());
        editor->widget()->setParent(0);
        disconnect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
        QToolBar *toolBar = editor->toolBar();
        if (toolBar != 0) {
            if (m_activeToolBar == toolBar) {
                m_activeToolBar = m_defaultToolBar;
                m_activeToolBar->setVisible(true);
            }
            m_toolBar->layout()->removeWidget(toolBar);
            toolBar->setVisible(false);
            toolBar->setParent(0);
        }
    }
}

IEditor *EditorView::currentEditor() const
{
    if (m_container->count() > 0)
        return m_widgetEditorMap.value(m_container->currentWidget());
    return 0;
}

mae's avatar
mae committed
395
void EditorView::setCurrentEditor(IEditor *editor)
396
397
398
399
{
    if (!editor || m_container->count() <= 0
        || m_container->indexOf(editor->widget()) == -1)
        return;
mae's avatar
mae committed
400
    if (editor)
mae's avatar
mae committed
401
        qDebug() << "EditorView::setCurrentEditor" << editor << editor->file()->fileName();
402

403
404
    const int idx = m_container->indexOf(editor->widget());
    QTC_ASSERT(idx >= 0, return);
405
406
    m_container->setCurrentIndex(idx);
    m_editorList->setCurrentIndex(qobject_cast<EditorModel*>(m_editorList->model())->indexOf(editor->file()->fileName()).row());
407
408
    updateEditorStatus(editor);
    updateToolBar(editor);
mae's avatar
mae committed
409
410


411
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
    if (editor != m_editorForInfoWidget) {
        m_infoWidget->hide();
        m_editorForInfoWidget = 0;
    }
}

void EditorView::checkEditorStatus()
{
        IEditor *editor = qobject_cast<IEditor *>(sender());
        if (editor == currentEditor())
            updateEditorStatus(editor);
}

void EditorView::updateEditorStatus(IEditor *editor)
{
    static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png"));
    static const QIcon unlockedIcon(QLatin1String(":/core/images/unlocked.png"));

    if (editor->file()->isReadOnly()) {
        m_lockButton->setIcon(lockedIcon);
        m_lockButton->setEnabled(!editor->file()->fileName().isEmpty());
        m_lockButton->setToolTip(tr("Make writable"));
    } else {
        m_lockButton->setIcon(unlockedIcon);
        m_lockButton->setEnabled(false);
        m_lockButton->setToolTip(tr("File is writable"));
    }
    if (currentEditor() == editor)
        m_editorList->setToolTip(
                editor->file()->fileName().isEmpty()
                ? editor->displayName()
                    : QDir::toNativeSeparators(editor->file()->fileName())
                    );

}

void EditorView::updateToolBar(IEditor *editor)
{
    QToolBar *toolBar = editor->toolBar();
    if (!toolBar)
        toolBar = m_defaultToolBar;
    if (m_activeToolBar == toolBar)
        return;
    toolBar->setVisible(true);
    m_activeToolBar->setVisible(false);
    m_activeToolBar = toolBar;
}

int EditorView::editorCount() const
{
    return m_container->count();
}

QList<IEditor *> EditorView::editors() const
{
    return m_widgetEditorMap.values();
}


void EditorView::makeEditorWritable()
{
    CoreImpl::instance()->editorManager()->makeEditorWritable(currentEditor());
}

mae's avatar
mae committed
475
void EditorView::listSelectionActivated(int index)
476
477
{
    QAbstractItemModel *model = m_editorList->model();
mae's avatar
mae committed
478
479
    IEditor *editor = model->data(model->index(index, 0), Qt::UserRole).value<IEditor*>();
    CoreImpl::instance()->editorManager()->activateEditor(this, editor);
480
481
482
}


mae's avatar
mae committed
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
SplitterOrView::SplitterOrView(EditorView *view, QWidget *parent)
        : QWidget(parent)
{
    m_isRoot = true;
    m_layout = new QStackedLayout(this);
    m_view = view;
    m_splitter = 0;
    m_layout->addWidget(m_view);
}

SplitterOrView::SplitterOrView(Core::IEditor *editor, QWidget *parent)
        : QWidget(parent)
{
    m_isRoot = false;
    m_layout = new QStackedLayout(this);
    m_view = new EditorView(CoreImpl::instance()->editorManager()->openedEditorsModel());
    m_view->addEditor(editor);
    m_splitter = 0;
mae's avatar
mae committed
501
    m_layout->addWidget(m_view);
mae's avatar
mae committed
502
503
}

504
505
506
507
508
509
510
511
512
513
514
515
516
517

SplitterOrView *SplitterOrView::findFirstView()
{
    if (m_splitter) {
        for (int i = 0; i < m_splitter->count(); ++i) {
            if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
                if (SplitterOrView *result = splitterOrView->findFirstView())
                    return result;
        }
        return 0;
    }
    return this;
}

mae's avatar
mae committed
518
519
SplitterOrView *SplitterOrView::findView(Core::IEditor *editor)
{
520
    if (!editor || hasEditor(editor))
mae's avatar
mae committed
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
        return this;
    if (m_splitter) {
        for (int i = 0; i < m_splitter->count(); ++i) {
            if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
                if (SplitterOrView *result = splitterOrView->findView(editor))
                    return result;
        }
    }
    return 0;
}

SplitterOrView *SplitterOrView::findSplitter(Core::IEditor *editor)
{
    if (m_splitter) {
        for (int i = 0; i < m_splitter->count(); ++i) {
            if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
                if (splitterOrView->hasEditor(editor))
                    return this;
                if (SplitterOrView *result = splitterOrView->findSplitter(editor))
                    return result;
            }
        }
    }
    return 0;
}

mae's avatar
mae committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
SplitterOrView *SplitterOrView::findSplitter(SplitterOrView *child)
{
    if (m_splitter) {
        for (int i = 0; i < m_splitter->count(); ++i) {
            if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
                if (splitterOrView == child)
                    return this;
                if (SplitterOrView *result = splitterOrView->findSplitter(child))
                    return result;
            }
        }
    }
    return 0;
}

562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
SplitterOrView *SplitterOrView::findNextView(Core::IEditor *editor)
{
    bool found = false;
    return findNextView_helper(editor, &found);
}

SplitterOrView *SplitterOrView::findNextView_helper(Core::IEditor *editor, bool *found)
{
    if (*found && m_view) {
        return this;
    }

    if (hasEditor(editor)) {
        *found = true;
        return 0;
    }

    if (m_splitter) {
        for (int i = 0; i < m_splitter->count(); ++i) {
            if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
                if (SplitterOrView *result = splitterOrView->findNextView_helper(editor, found))
                    return result;
            }
        }
    }
    return 0;
}

mae's avatar
mae committed
590
591
592
593
594
595
596
void SplitterOrView::split(Qt::Orientation orientation)
{
    Q_ASSERT(m_view && m_splitter == 0);
    m_splitter = new QSplitter(this);
    m_splitter->setOrientation(orientation);
    Core::IEditor *e = m_view->currentEditor();

597
598
    SplitterOrView *focusView = 0;

mae's avatar
mae committed
599
600
601
    m_view->removeEditor(e);
    m_splitter->addWidget((focusView = new SplitterOrView(e)));

mae's avatar
mae committed
602
603
604
605
606
607
608
609
610
611
612
    Core::IEditor *duplicate = CoreImpl::instance()->editorManager()->duplicateEditor(e);
    m_splitter->addWidget(new SplitterOrView(duplicate));
    m_layout->addWidget(m_splitter);

    if (!m_isRoot) {
        delete m_view;
        m_view = 0;
    } else {
        m_layout->setCurrentWidget(m_splitter);
    }

mae's avatar
mae committed
613
    CoreImpl::instance()->editorManager()->activateEditor(e);
mae's avatar
mae committed
614
615
616
617
}

void SplitterOrView::close()
{
mae's avatar
mae committed
618
619
620
621
622
623
    Q_ASSERT(!m_isRoot);
    if (m_view) {
        m_view->closeView();
        delete m_view;
        m_view = 0;
    }
mae's avatar
mae committed
624
625
626
627
628
629
630
631
632
633
634
635
636
637
    closeSplitterEditors();
}

void SplitterOrView::closeSplitterEditors()
{
    if (!m_splitter)
        return;
    for (int i = 0; i < m_splitter->count(); ++i) {
        if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
            splitterOrView->close();
        }
    }
}

mae's avatar
mae committed
638
void SplitterOrView::unsplit(Core::IEditor *editor)
mae's avatar
mae committed
639
640
641
{
    if (!m_splitter)
        return;
mae's avatar
mae committed
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657

    qDebug() << "unsplit" << this << m_splitter;
#if 0
    SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
    Q_ASSERT(splitterOrView != 0);

    qDebug() << "splitter or view is" << splitterOrView;

    if (editor) { // pick the other side
        if (SplitterOrView *view = findView(editor)) {
            qDebug() << "view to close is" << view;
            view->close();
            delete view;
        }
        splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
        qDebug() << "other splitter or view is" << splitterOrView;
mae's avatar
mae committed
658
    }
mae's avatar
mae committed
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675

    QSplitter *old_splitter = m_splitter;
    EditorView *old_view = m_view;

    m_splitter = splitterOrView->splitter();
    m_view = splitterOrView->view();

    qDebug() << "new splitter/view" << m_splitter << m_view;

    if (m_splitter)
        m_layout->addWidget(m_splitter);
    if (m_view)
        m_layout->addWidget(m_view);

//    delete old_view;
//    delete old_splitter;
#endif
mae's avatar
mae committed
676
}