mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-03 21:07:53 +00:00
Some better source organization. Removed C++11 STL usage (old OS X).
This commit is contained in:
parent
3b6d0ef7c0
commit
b61c0941ef
@ -383,7 +383,7 @@ to link the code of portions of this program with the OpenSSL library.\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tout << "#pragma once\n\n#include \"ui/style.h\"\n\nnamespace style {\n";
|
||||
tout << "#pragma once\n\n#include \"ui/style_core.h\"\n\nnamespace style {\n";
|
||||
for (int i = 0, l = byIndex.size(); i < l; ++i) {
|
||||
ClassData &cls(byIndex[i]);
|
||||
classes.insert(cls.name, cls);
|
||||
@ -513,7 +513,7 @@ typedef QPair<ScalarType, ScalarValue> ScalarData;
|
||||
typedef QPair<string, ScalarData> Scalar;
|
||||
typedef QMap<string, ScalarData> Fields;
|
||||
typedef QPair<string, Fields> ObjectData;
|
||||
typedef QPair<string, ObjectData> Object;
|
||||
typedef QPair<string, ObjectData> Object;
|
||||
typedef QVector<Object> Objects;
|
||||
typedef QVector<Scalar> Scalars;
|
||||
|
||||
@ -646,7 +646,7 @@ ScalarValue prepareNumber(int variant, const string &token, const char *&text, c
|
||||
ScalarValue prepareColorRGB(int variant, const string &name, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading rgb() cons!").arg(type));
|
||||
|
||||
@ -685,7 +685,7 @@ ScalarValue prepareColorRGB(int variant, const string &name, const char *&text,
|
||||
ScalarValue prepareColorRGBA(int variant, const string &name, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading rgba() cons!").arg(type));
|
||||
|
||||
@ -731,7 +731,7 @@ ScalarValue prepareColorRGBA(int variant, const string &name, const char *&text,
|
||||
ScalarValue prepareRect(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading rect() cons!").arg(type));
|
||||
|
||||
@ -869,7 +869,7 @@ ScalarValue prepareSprite(int variant, const char *&text, const char *end) {
|
||||
ScalarValue preparePoint(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading point() cons!").arg(type));
|
||||
|
||||
@ -902,7 +902,7 @@ ScalarValue preparePoint(int variant, const char *&text, const char *end) {
|
||||
ScalarValue prepareSize(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading size() cons!").arg(type));
|
||||
|
||||
@ -935,7 +935,7 @@ ScalarValue prepareSize(int variant, const char *&text, const char *end) {
|
||||
ScalarValue prepareTransition(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading transition() cons!").arg(type));
|
||||
|
||||
@ -952,7 +952,7 @@ ScalarValue prepareTransition(int variant, const char *&text, const char *end) {
|
||||
ScalarValue prepareCursor(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading cursor() cons!").arg(type));
|
||||
|
||||
@ -969,7 +969,7 @@ ScalarValue prepareCursor(int variant, const char *&text, const char *end) {
|
||||
ScalarValue prepareAlign(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading align() cons!").arg(type));
|
||||
|
||||
@ -986,7 +986,7 @@ ScalarValue prepareAlign(int variant, const char *&text, const char *end) {
|
||||
ScalarValue prepareMargins(int variant, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
readStyleGenToken(text, end, type, token);
|
||||
if (type != stConsStart) throw Exception(QString("Unexpected token %1 while reading margins() cons!").arg(type));
|
||||
|
||||
@ -1059,7 +1059,7 @@ QMap<int, Fonts> fonts;
|
||||
ScalarValue prepareFont(int variant, const string &name, const char *&text, const char *end) {
|
||||
StyleGenTokenType type;
|
||||
string token;
|
||||
|
||||
|
||||
ScalarValue sizeScalar, familyScalar;
|
||||
|
||||
string size, family;
|
||||
@ -1544,7 +1544,7 @@ to link the code of portions of this program with the OpenSSL library.\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tout << "#pragma once\n\n#include \"ui/style.h\"\n\nnamespace st {\n";
|
||||
tout << "#pragma once\n\n#include \"ui/style_core.h\"\n\nnamespace st {\n";
|
||||
tcpp << "\
|
||||
/*\n\
|
||||
Created from \'/Resources/style.txt\' by \'/MetaStyle\' project\n\
|
||||
@ -1604,7 +1604,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
||||
tcpp << "\tColorDatas _colorsMap;\n";
|
||||
tcpp << "\tint _spriteWidth = " << spriteWidths[0] << ";\n\n";
|
||||
tcpp << "\tvoid startManager() {\n";
|
||||
|
||||
|
||||
tcpp << "\n\t\tif (cRetina()) {\n";
|
||||
tcpp << "\t\t\tcSetRealScale(dbisOne);\n";
|
||||
tcpp << "\t\t\t_spriteWidth = " << spriteWidths[variantsCount - 1] << ";\n\n";
|
||||
|
@ -53,7 +53,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "mtproto/facade.h"
|
||||
|
||||
#include "ui/style_core.h"
|
||||
#include "ui/style.h"
|
||||
#include "ui/twidget.h"
|
||||
#include "ui/animation.h"
|
||||
#include "ui/flatinput.h"
|
||||
|
@ -20,5 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../GeneratedFiles/style_classes.h"
|
||||
#include "../GeneratedFiles/style_auto.h"
|
||||
#include "ui/style_core.h"
|
||||
#include "GeneratedFiles/style_classes.h"
|
||||
#include "GeneratedFiles/style_auto.h"
|
||||
|
@ -134,24 +134,13 @@ namespace style {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Color::set(const QColor &newv) {
|
||||
if (!owner) {
|
||||
ptr = new ColorData(*ptr);
|
||||
owner = true;
|
||||
}
|
||||
ptr->set(newv);
|
||||
namespace {
|
||||
inline uint32 colorKey(uchar r, uchar g, uchar b, uchar a) {
|
||||
return (((((uint32(r) << 8) | uint32(g)) << 8) | uint32(b)) << 8) | uint32(a);
|
||||
}
|
||||
|
||||
void Color::set(uchar r, uchar g, uchar b, uchar a) {
|
||||
if (!owner) {
|
||||
ptr = new ColorData(*ptr);
|
||||
owner = true;
|
||||
}
|
||||
ptr->set(QColor(r, g, b, a));
|
||||
}
|
||||
|
||||
void Color::init(uchar r, uchar g, uchar b, uchar a) {
|
||||
uint32 key = _colorKey(r, g, b, a);
|
||||
uint32 key = colorKey(r, g, b, a);
|
||||
ColorDatas::const_iterator i = _colorsMap.constFind(key);
|
||||
if (i == _colorsMap.cend()) {
|
||||
i = _colorsMap.insert(key, new ColorData(r, g, b, a));
|
||||
|
@ -46,7 +46,7 @@ inline QRect centerrect(const QRect &inRect, const QRect &rect) {
|
||||
}
|
||||
|
||||
namespace style {
|
||||
|
||||
|
||||
class FontData;
|
||||
class Font {
|
||||
public:
|
||||
@ -189,7 +189,7 @@ namespace style {
|
||||
bool owner;
|
||||
|
||||
void init(uchar r, uchar g, uchar b, uchar a);
|
||||
|
||||
|
||||
friend void startManager();
|
||||
|
||||
Color(ColorData *p) : ptr(p) {
|
||||
@ -213,7 +213,7 @@ namespace style {
|
||||
|
||||
ColorData(uchar r, uchar g, uchar b, uchar a);
|
||||
void set(const QColor &c);
|
||||
|
||||
|
||||
friend class Color;
|
||||
|
||||
};
|
||||
|
@ -1591,7 +1591,7 @@ public:
|
||||
if (_wLeft < si.width) {
|
||||
lineText = lineText.mid(0, currentBlock->from() - _localFrom) + _Elide;
|
||||
lineLength = currentBlock->from() + _Elide.size() - _lineStart;
|
||||
_selection.to = std::min({ _selection.to, currentBlock->from() });
|
||||
_selection.to = _selection.to = qMin(_selection.to, currentBlock->from());
|
||||
setElideBidi(currentBlock->from(), _Elide.size());
|
||||
elideSaveBlock(blockIndex - 1, _endBlock, currentBlock->from(), elideWidth);
|
||||
return;
|
||||
@ -1623,7 +1623,7 @@ public:
|
||||
if (lineText.size() <= pos || repeat > 3) {
|
||||
lineText += _Elide;
|
||||
lineLength = _localFrom + pos + _Elide.size() - _lineStart;
|
||||
_selection.to = std::min({ _selection.to, uint16(_localFrom + pos) });
|
||||
_selection.to = qMin(_selection.to, uint16(_localFrom + pos));
|
||||
setElideBidi(_localFrom + pos, _Elide.size());
|
||||
_blocksSize = blockIndex;
|
||||
_endBlock = nextBlock;
|
||||
@ -1643,7 +1643,7 @@ public:
|
||||
}
|
||||
|
||||
int32 elideStart = _localFrom + lineText.size();
|
||||
_selection.to = std::min({ _selection.to, uint16(elideStart) });
|
||||
_selection.to = qMin(_selection.to, uint16(elideStart));
|
||||
setElideBidi(elideStart, _Elide.size());
|
||||
|
||||
lineText += _Elide;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user