summaryrefslogtreecommitdiffstats
path: root/Common/Common.h
blob: 84991d8a34dbde2baba8255ae98c8cb883c6c1fa (plain)
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
/******************************************************************************
    QtAV Player Demo:  this file is part of QtAV examples
    Copyright (C) 2012-2017 Wang Bin <wbsecg1@gmail.com>
*   This file is part of QtAV (from 2014)
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#ifndef COMMON_H
#define COMMON_H
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QUrl>
#include "QOptions.h"
#include "Config.h"

QOptions COMMON_EXPORT get_common_options();
void COMMON_EXPORT do_common_options_before_qapp(const QOptions& options);
/// help, log file, ffmpeg log level
void COMMON_EXPORT do_common_options(const QOptions& options, const QString& appName = QString());
void COMMON_EXPORT load_qm(const QStringList& names, const QString &lang = QLatin1String("system"));
// if appname ends with 'desktop', 'es', 'angle', software', 'sw', set by appname. otherwise set by command line option glopt, or Config file
// TODO: move to do_common_options_before_qapp
void COMMON_EXPORT set_opengl_backend(const QString& glopt = QString::fromLatin1("auto"), const QString& appname = QString());

QString COMMON_EXPORT appDataDir();

class COMMON_EXPORT AppEventFilter : public QObject
{
public:
    AppEventFilter(QObject *player = 0, QObject* parent = 0);
    QUrl url() const;
    virtual bool eventFilter(QObject *obj, QEvent *ev);
private:
    QObject *m_player;
};

#endif // COMMON_H