1 /************************************************************************
2 **
3 **  Copyright (C) 2019-2020 Kevin B. Hendricks, Stratford, Ontario Canada
4 **  Copyright (C) 2012      John Schember <john@nachtimwald.com>
5 **
6 **  This file is part of Sigil.
7 **
8 **  Sigil is free software: you can redistribute it and/or modify
9 **  it under the terms of the GNU General Public License as published by
10 **  the Free Software Foundation, either version 3 of the License, or
11 **  (at your option) any later version.
12 **
13 **  Sigil is distributed in the hope that it will be useful,
14 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 **  GNU General Public License for more details.
17 **
18 **  You should have received a copy of the GNU General Public License
19 **  along with Sigil.  If not, see <http://www.gnu.org/licenses/>.
20 **
21 *************************************************************************/
22 
23 #include <QtCore/QString>
24 #include <QtCore/QUrl>
25 #include <QtWidgets/QLayout>
26 #include <QGuiApplication>
27 #include <QApplication>
28 #include "MainUI/MainWindow.h"
29 #include "Misc/Utility.h"
30 #include "sigil_constants.h"
31 #include "Widgets/AVView.h"
32 #include "Tabs/AVTab.h"
33 
AVTab(Resource * resource,QWidget * parent)34 AVTab::AVTab(Resource *resource, QWidget *parent)
35     : ContentTab(resource, parent),
36       m_av(new AVView(this))
37 {
38     m_Layout->addWidget(m_av);
39     ConnectSignalsToSlots();
40     ShowAV();
41 }
42 
ShowAV()43 void AVTab::ShowAV()
44 {
45     m_av->ShowAV(m_Resource->GetFullPath());
46 }
47 
RefreshContent()48 void AVTab::RefreshContent()
49 {
50     m_av->ReloadViewer();
51 }
52 
ConnectSignalsToSlots()53 void AVTab::ConnectSignalsToSlots()
54 {
55     connect(m_Resource, SIGNAL(ResourceUpdatedOnDisk()), this, SLOT(RefreshContent()));
56     connect(m_Resource, SIGNAL(Deleted(const Resource*)), this, SLOT(Close()));
57 }
58