Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/bin/mytetra.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@
<file>resource/standartconfig/any/conf.ini</file>
<file>resource/standartconfig/any/editorconf.ini</file>
<file>resource/standartconfig/any/stylesheet.css</file>
<file>resource/standartconfig/any/styles/dark/pic/branch-closed.png</file>
<file>resource/standartconfig/any/styles/dark/pic/branch-end.png</file>
<file>resource/standartconfig/any/styles/dark/pic/branch-more.png</file>
<file>resource/standartconfig/any/styles/dark/pic/branch-open.png</file>
<file>resource/standartconfig/any/styles/dark/pic/vline.png</file>
<file>resource/standartconfig/any/styles/dark/stylesheet.css</file>
<file>resource/standartconfig/any/styles/light/stylesheet.css</file>
<file>resource/standartconfig/meego/conf.ini</file>
<file>resource/standartconfig/meego/editorconf.ini</file>
<file>resource/standartconfig/meego/stylesheet.css</file>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions app/bin/resource/standartconfig/any/styles/dark/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
QWidget {
font: 10pt 'DejaVu Sans';
outline: 0;
color: white;
background-color: #373e4d; }
QWidget::item:hover {
color: white;
background: #383C4A; }
QWidget::item:selected {
color: white;
background: #383C4A; }
QWidget::item:selected:active {
color: white;
background: #2d2f36; }
QTreeView::item:open {
color: white; }
QComboBox::drop-down:hover{
border-left-color: #ff80ff; }
QComboBox:hover{
border: 1px solid #ff80ff; }
QToolTip {
border: 1px solid #80ff80;
padding: 2px;
border-radius: 5px;
color: white;
background: #373e4d; }
QTextEdit:focus,
QTreeView:focus,
QTableView:focus {
border: 1px solid #3e7c3e; }
QTextEdit {
border: 1px solid #2f343f;
color: white;
background: #404759;
selection-color: #ff80ff;
selection-background-color: #2d2f36;
}
QProgressBar {
border: solid;
color: grey;
background: #404759;
selection-background-color: #80ff80; }
QCheckBox {
color: grey;
font-weight: bold;
border: 0px solid grey; }
QCheckBox::indicator {
width: 0px;
background-color: transparent; }
QCheckBox:unchecked {
color: gray;
background: #373e4d; }
QCheckBox:checked {
color: #80ffff; }
QToolBar,
QLabel,
QMenuBar,
QDialog,
QComboBox{
border-style: solid;
color: #80ff80;
background: #373e4d; }
QComboBox:editable {
background: #404759; }
QComboBox {
border: 1px solid gray;
border-radius: 3px;
padding: 1px 18px 1px 3px;
min-width: 6em; }
QComboBox:!editable,
QComboBox::drop-down:editable {
background: #373e4d; }
QComboBox::drop-down {
width: 15px;
border-left-width: 1px;
border-left-color: darkgray;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px; }
QLineEdit {
border: 1px solid grey;
background: #404759; }
QLineEdit:hover,
QLineEdit:focus {
border: 1px solid #80ff80; }
QPushButton:disabled{
color: grey;
background-color: #373e4d; }
QPushButton {
background-color: #373e4d;
color: #80ff80;
font-weight: bold;
border-style: solid;
padding: 5px; }
QToolButton {
background-color: #373e4d;
font-weight: bold;
border-style: solid;
padding: 5px; }
QToolButton::hover,
QToolButton:checked {
background-color: #404759; }
QToolButton::pressed {
background-color: #2d2f36; }
QToolBar {
icon-size: 14px;
padding: 1; }
QTreeView::item,
QTableView {
border: 1px solid #2f343f;
color: white;
background: #404759;
}
QTableView QTableCornerButton::section,
QHeaderView::section:horizontal {
color: #5bf235;
border-style: solid;
height: 18px;
padding: 0px 3px 0px 6px;
background: #2f343f; }
QHeaderView::section:vertical {
color: #5bf235;
border-style: solid;
width: 18px;
padding: 0px 3px 0px 6px;
background: #373e4d; }
QTreeView::item {
border: 0px solid #2f343f; }
QTreeView {
border: 1px solid #2f343f;
color: #5bf235;
background: #404759;
selection-background-color: transparent; }
QTreeView::branch:has-siblings:!adjoins-item {
border-image: url(style/pic/vline.png) 0; }
QTreeView::branch:has-siblings:adjoins-item {
border-image: url(style/pic/branch-more.png) 0; }
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
border-image: url(style/pic/branch-end.png) 0; }
QTreeView::branch:closed:has-children:has-siblings,
QTreeView::branch:has-children:!has-siblings:closed {
border-image: none;
image: url(style/pic/branch-closed.png); }
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings{
border-image: none;
image: url(style/pic/branch-open.png); }
QScrollBar:horizontal,
QScrollBar:vertical {
background-color: transparent;
height: 8px;
width: 8px;
margin: 0px;
padding: 0px; }
QScrollBar::handle:horizontal,
QScrollBar::handle:vertical {
border: none;
min-width: 100px;
background-color: #2b2f36; }
QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal,
QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal,
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical,
QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical {
width: 0px;
background-color: transparent; }
13 changes: 13 additions & 0 deletions app/bin/resource/standartconfig/any/styles/light/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* CSS style for any desktop OS */
/* Set your Qt CSS style in this file */

QToolBar, QToolButton, QPushButton
{
icon-size: 16px; /* maximum icon size */
}

/*
QToolButton {
padding: 0;
}
*/
37 changes: 36 additions & 1 deletion app/bin/resource/translations/mytetra_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,42 @@ Please enable action logging in Tools -&gt; Preferences -&gt; Misc</source>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigDialog.cpp" line="38"/>
<source>Misc</source>
<translation>Разное</translation>
<context>
<name>AppConfigPage_Appearance</name>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="35"/>
<source>Interface theme</source>
<translation>Тема</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="39"/>
<source>Light</source>
<translation>Светлая</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="40"/>
<source>Dark</source>
<translation>Темная</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="45"/>
<source>Run MyTetra in a minimized window</source>
<translation>Запускать MyTetra в свернутом окне</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="51"/>
<source>Hide detached windows if close main window</source>
<translation>Сворачивать открепляемые окна при закрытии главного окна</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="66"/>
<source>Interface</source>
<translation>Интерфейс</translation>
</message>
<message>
<location filename="../../../src/views/appConfigWindow/AppConfigPage_Appearance.cpp" line="81"/>
<source>Windows behavior</source>
<translation>Поведение</translation>
</message>
</context>
<context>
Expand Down
19 changes: 16 additions & 3 deletions app/src/libraries/GlobalParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "libraries/WindowSwitcher.h"
#include "libraries/FixedParameters.h"
#include "libraries/helpers/DebugHelper.h"
#include "libraries/helpers/DiskHelper.h"

#ifdef Q_OS_WIN32
#include "windows.h"
Expand Down Expand Up @@ -268,11 +269,23 @@ void GlobalParameters::createFirstProgramFiles(QString dirName)
}


void GlobalParameters::createStyleSheetFile(QString dirName)
void GlobalParameters::createStyleSheetFile(QString dirName, QString themeName)
{
QString targetOs=getTargetOs();
QFile::copy(":/resource/standartconfig/"+targetOs+"/stylesheet.css", dirName+"/stylesheet.css");
QFile::setPermissions(dirName+"/stylesheet.css", QFile::ReadUser | QFile::WriteUser);
if (targetOs == "any" && !themeName.isNull() && !themeName.isEmpty())
{
QString fromDir=":/resource/standartconfig/any/styles/"+themeName;
QString toDir=dirName+"/style";
DiskHelper::removeDirectory(toDir);
DiskHelper::copyDirectoryRecursively(fromDir, toDir, QFile::ReadUser | QFile::WriteUser);
}
else
{
QDir styleDir(dirName);
styleDir.mkdir("style");
QFile::copy(":/resource/standartconfig/"+targetOs+"/stylesheet.css", dirName+"/style/stylesheet.css");
QFile::setPermissions(dirName+"/style/stylesheet.css", QFile::ReadUser | QFile::WriteUser);
}
}


Expand Down
2 changes: 1 addition & 1 deletion app/src/libraries/GlobalParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class GlobalParameters : public QObject

// Файл стилей может создаваться и после развертывания начальных файлов MyTetra
// Так как в более старых версиях MyTetra его еще не было
void createStyleSheetFile(QString dirName);
void createStyleSheetFile(QString dirName, QString themeName=NULL);

public:
// Указание на обрабатываемую панель инструментов редактора текста
Expand Down
24 changes: 22 additions & 2 deletions app/src/libraries/helpers/CssHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
#include "CssHelper.h"

#include "libraries/GlobalParameters.h"
#include "models/appConfig/AppConfig.h"


extern GlobalParameters globalParameters;
extern AppConfig mytetraConfig;


CssHelper::CssHelper()
Expand Down Expand Up @@ -54,7 +56,18 @@ QString CssHelper::replaceCssMetaIconSize(QString styleText)

void CssHelper::setCssStyle()
{
QString csspath = globalParameters.getWorkDirectory()+"/stylesheet.css";
QString dirName=globalParameters.getWorkDirectory();

// Если файл стилей есть по старому пути, переносим его в каталог style
QFile file(dirName+"/stylesheet.css");
if (file.exists())
{
QDir styleDir(dirName);
styleDir.mkdir("style");
file.rename(dirName+"/style/stylesheet.css");
}

QString csspath = dirName+"/style/stylesheet.css";

QFile css(csspath);

Expand All @@ -64,7 +77,14 @@ void CssHelper::setCssStyle()
if(!openResult)
{
qDebug() << "Stylesheet not found in " << csspath << ". Create new css file.";
globalParameters.createStyleSheetFile( globalParameters.getWorkDirectory() );

QString themeName;
switch (mytetraConfig.getInterfaceTheme())
{
case AppConfig::Light: themeName="light"; break;
case AppConfig::Dark: themeName="dark"; break;
}
globalParameters.createStyleSheetFile( globalParameters.getWorkDirectory(), themeName);
}
css.close();

Expand Down
26 changes: 26 additions & 0 deletions app/src/libraries/helpers/DiskHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,32 @@ bool DiskHelper::copyDirectory(const QString &fromName, const QString &toName)
}


// Копирование содержимого директории
// Рекурсивно вместе с подкаталогами
bool DiskHelper::copyDirectoryRecursively(const QString &fromName, const QString &toName, QFile::Permissions permissionSpec)
{
QDir fromDir(fromName);
if (!fromDir.exists())
return false;
QDir toDir(toName);
if (!toDir.exists())
toDir.mkpath(".");

foreach (QString dirName, fromDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
QString destPath = toName + QDir::separator() + dirName;
fromDir.mkpath(destPath);
copyDirectoryRecursively(fromName+ QDir::separator() + dirName, destPath, permissionSpec);
}

foreach (QString fileName, fromDir.entryList(QDir::Files)) {
QString destPath = toName + QDir::separator() + fileName;
QFile::copy(fromName + QDir::separator() + fileName, destPath);
QFile::setPermissions(destPath, permissionSpec);
}
return true;
}


// Получение списка файлов с их содержимым в указанной директории
QMap<QString, QByteArray> DiskHelper::getFilesFromDirectory(QString dirName, QString fileMask)
{
Expand Down
2 changes: 2 additions & 0 deletions app/src/libraries/helpers/DiskHelper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DISKHELPER_H
#define DISKHELPER_H

#include <QFile>
#include <QString>
#include <QStringList>
#include <QMap>
Expand All @@ -19,6 +20,7 @@ class DiskHelper
static QString createTempDirectory(void);
static bool removeDirectory(const QString &dirName);
static bool copyDirectory(const QString &fromName, const QString &toName);
static bool copyDirectoryRecursively(const QString &fromName, const QString &toName, QFile::Permissions permissionSpec);
static QMap<QString, QByteArray> getFilesFromDirectory(QString dirName, QString fileMask);
static bool saveFilesToDirectory(QString dirName, QMap<QString, QByteArray> fileList);

Expand Down
Loading