Skip to content

Commit

Permalink
v0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lexxai committed Dec 30, 2017
1 parent cc2bc45 commit ad484e2
Show file tree
Hide file tree
Showing 129 changed files with 17,679 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "shaders"]
path = shaders
url = git://github.com/Xuno/mpv-prescalers.git
44 changes: 44 additions & 0 deletions ClickableMenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/******************************************************************************
QtAV Player Demo: this file is part of QtAV examples
Copyright (C) 2012-2014 Wang Bin <wbsecg1@gmail.com>
* This file is part of QtAV
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/>.
******************************************************************************/


#include "ClickableMenu.h"
#include <QMouseEvent>

ClickableMenu::ClickableMenu(QWidget *parent) :
QMenu(parent)
{
}

ClickableMenu::ClickableMenu(const QString &title, QWidget *parent) :
QMenu(title, parent)
{
}

void ClickableMenu::mouseReleaseEvent(QMouseEvent *e)
{
QAction *action = actionAt(e->pos());
if (action) {
action->activate(QAction::Trigger);
return;
}
QMenu::mouseReleaseEvent(e);
}

39 changes: 39 additions & 0 deletions ClickableMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/******************************************************************************
QtAV Player Demo: this file is part of QtAV examples
Copyright (C) 2012-2014 Wang Bin <wbsecg1@gmail.com>
* This file is part of QtAV
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 CLICKABLEMENU_H
#define CLICKABLEMENU_H

#include <QMenu>

class ClickableMenu : public QMenu
{
Q_OBJECT
public:
explicit ClickableMenu(QWidget *parent = 0);
explicit ClickableMenu(const QString& title, QWidget *parent = 0);

protected:
virtual void mouseReleaseEvent(QMouseEvent *);

};

#endif // CLICKABLEMENU_H
65 changes: 65 additions & 0 deletions DarkStyle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "DarkStyle.h"

DarkStyle::DarkStyle():
DarkStyle(styleBase())
{ }

DarkStyle::DarkStyle(QStyle *style):
QProxyStyle(style)
{ }

QStyle *DarkStyle::styleBase(QStyle *style) const {
static QStyle *base = !style ? QStyleFactory::create("Fusion") : style;
return base;
}

QStyle *DarkStyle::baseStyle() const
{
return styleBase();
}

void DarkStyle::polish(QPalette &palette)
{
// modify palette to dark
palette.setColor(QPalette::Window,QColor(53,53,53));
palette.setColor(QPalette::WindowText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::WindowText,QColor(127,127,127));
palette.setColor(QPalette::Base,QColor(42,42,42));
palette.setColor(QPalette::AlternateBase,QColor(66,66,66));
palette.setColor(QPalette::ToolTipBase,Qt::white);
palette.setColor(QPalette::ToolTipText,Qt::white);
palette.setColor(QPalette::Text,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::Text,QColor(127,127,127));
palette.setColor(QPalette::Dark,QColor(35,35,35));
palette.setColor(QPalette::Shadow,QColor(20,20,20));
palette.setColor(QPalette::Button,QColor(53,53,53));
palette.setColor(QPalette::ButtonText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::ButtonText,QColor(127,127,127));
palette.setColor(QPalette::BrightText,Qt::red);
palette.setColor(QPalette::Link,QColor(42,130,218));
palette.setColor(QPalette::Highlight,QColor(42,130,218));
palette.setColor(QPalette::Disabled,QPalette::Highlight,QColor(80,80,80));
palette.setColor(QPalette::HighlightedText,Qt::white);
palette.setColor(QPalette::Disabled,QPalette::HighlightedText,QColor(127,127,127));
}

void DarkStyle::polish(QApplication *app)
{
if (!app) return;

// increase font size for better reading,
// setPointSize was reduced from +2 because when applied this way in Qt5, the font is larger than intended for some reason
QFont defaultFont = QApplication::font();
defaultFont.setPointSize(defaultFont.pointSize()+1);
app->setFont(defaultFont);

// loadstylesheet
QFile qfDarkstyle(QString(":/darkstyle/darkstyle.qss"));
if (qfDarkstyle.open(QIODevice::ReadOnly | QIODevice::Text))
{
// set stylesheet
QString qsStylesheet = QString(qfDarkstyle.readAll());
app->setStyleSheet(qsStylesheet);
qfDarkstyle.close();
}
}
54 changes: 54 additions & 0 deletions DarkStyle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
###############################################################################
# #
# The MIT License #
# #
# Copyright (C) 2017 by Juergen Skrotzky (JorgenVikingGod@gmail.com) #
# >> https://github.com/Jorgen-VikingGod #
# #
# Sources: https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle #
# #
###############################################################################
*/

#ifndef _DarkStyle_HPP
#define _DarkStyle_HPP

/* INCLUDE FILES **************************************************************/
#include <QApplication>
#include <QProxyStyle>
#include <QStyleFactory>
#include <QFont>
#include <QFile>

/* CLASS DECLARATION **********************************************************/
/** CMainWindow class is a simple singleton to adjust style/palette/stylesheets
*******************************************************************************/
class DarkStyle : public QProxyStyle
{
Q_OBJECT
// PUBLIC MEMBERS *************************************************************
// PROTECTED MEMBERS **********************************************************
// PRIVATE MEMBERS ************************************************************
// CONSTRUCTOR/DESTRUCTOR *****************************************************
// PUBLIC METHODS *************************************************************
public:
DarkStyle();
explicit DarkStyle(QStyle *style);

QStyle *baseStyle() const;

void polish(QPalette &palette) override;
void polish(QApplication *app) override;

// PROTECTED METHODS **********************************************************
// PRIVATE METHODS ************************************************************
private:
QStyle *styleBase(QStyle *style=Q_NULLPTR) const;
};

#endif // _DarkStyle_HPP

//*****************************************************************************
// END OF FILE
//*****************************************************************************
Loading

0 comments on commit ad484e2

Please sign in to comment.