2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Group and channel create box photo select button improved.

This commit is contained in:
John Preston
2016-11-19 17:47:28 +03:00
parent 2ada4d841f
commit 8a0c275658
55 changed files with 185 additions and 351 deletions

View File

@@ -284,7 +284,6 @@ QString Generator::typeToString(structure::Type type) const {
case Tag::Color: return "style::color";
case Tag::Point: return "style::point";
case Tag::Size: return "style::size";
case Tag::Cursor: return "style::cursor";
case Tag::Align: return "style::align";
case Tag::Margins: return "style::margins";
case Tag::Font: return "style::font";
@@ -305,7 +304,6 @@ QString Generator::typeToDefaultValue(structure::Type type) const {
case Tag::Color: return "{ Qt::Uninitialized }";
case Tag::Point: return "{ 0, 0 }";
case Tag::Size: return "{ 0, 0 }";
case Tag::Cursor: return "style::cur_default";
case Tag::Align: return "style::al_topleft";
case Tag::Margins: return "{ 0, 0, 0, 0 }";
case Tag::Font: return "{ Qt::Uninitialized }";
@@ -355,7 +353,6 @@ QString Generator::valueAssignmentCode(structure::Value value) const {
auto v(value.Size());
return QString("{ %1, %2 }").arg(pxValueName(v.width)).arg(pxValueName(v.height));
} break;
case Tag::Cursor: return QString("style::cur_%1").arg(value.String().c_str());
case Tag::Align: return QString("style::al_%1").arg(value.String().c_str());
case Tag::Margins: {
auto v(value.Margins());
@@ -1120,7 +1117,6 @@ bool Generator::collectUniqueValues() {
case Tag::Double:
case Tag::String:
case Tag::Color:
case Tag::Cursor:
case Tag::Align: break;
case Tag::Pixels: pxValues_.insert(value.Int(), true); break;
case Tag::Point: {

View File

@@ -120,7 +120,6 @@ std::string logType(const structure::Type &type) {
{ structure::TypeTag::Color , "color" },
{ structure::TypeTag::Point , "point" },
{ structure::TypeTag::Size , "size" },
{ structure::TypeTag::Cursor , "cursor" },
{ structure::TypeTag::Align , "align" },
{ structure::TypeTag::Margins , "margins" },
{ structure::TypeTag::Font , "font" },
@@ -137,10 +136,6 @@ bool validateAnsiString(const QString &value) {
return true;
}
bool validateCursorString(const QString &value) {
return QRegularExpression("^[a-z_]+$").match(value).hasMatch();
}
bool validateAlignString(const QString &value) {
return QRegularExpression("^[a-z_]+$").match(value).hasMatch();
}
@@ -308,8 +303,6 @@ structure::Value ParsedFile::readValue() {
return pointValue;
} else if (auto sizeValue = readSizeValue()) {
return sizeValue;
} else if (auto cursorValue = readCursorValue()) {
return cursorValue;
} else if (auto alignValue = readAlignValue()) {
return alignValue;
} else if (auto marginsValue = readMarginsValue()) {
@@ -599,26 +592,6 @@ structure::Value ParsedFile::readSizeValue() {
return {};
}
structure::Value ParsedFile::readCursorValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "cursor") {
assertNextToken(BasicType::LeftParenthesis);
auto cursor = tokenValue(assertNextToken(BasicType::Name));
assertNextToken(BasicType::RightParenthesis);
if (validateCursorString(cursor)) {
return { structure::TypeTag::Cursor, cursor.toStdString() };
} else {
logError(kErrorBadString) << "bad cursor string";
}
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readAlignValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "align") {

View File

@@ -93,7 +93,6 @@ private:
structure::Value readColorValue();
structure::Value readPointValue();
structure::Value readSizeValue();
structure::Value readCursorValue();
structure::Value readAlignValue();
structure::Value readMarginsValue();
structure::Value readFontValue();
@@ -130,7 +129,6 @@ private:
{ "color" , { structure::TypeTag::Color } },
{ "point" , { structure::TypeTag::Point } },
{ "size" , { structure::TypeTag::Size } },
{ "cursor" , { structure::TypeTag::Cursor } },
{ "align" , { structure::TypeTag::Align } },
{ "margins" , { structure::TypeTag::Margins } },
{ "font" , { structure::TypeTag::Font } },

View File

@@ -179,7 +179,6 @@ Value::Value(TypeTag type, int value) : Value(type, std::make_shared<DataTypes::
Value::Value(TypeTag type, std::string value) : Value(type, std::make_shared<DataTypes::TString>(value)) {
if (type_.tag != TypeTag::String &&
type_.tag != TypeTag::Cursor &&
type_.tag != TypeTag::Align) {
type_.tag = TypeTag::Invalid;
data_ = std::make_shared<DataBase>();
@@ -196,7 +195,6 @@ Value::Value(Type type, Qt::Initialization) : type_(type) {
case TypeTag::Color: data_ = std::make_shared<DataTypes::TColor>(data::color { 0, 0, 0, 255 }); break;
case TypeTag::Point: data_ = std::make_shared<DataTypes::TPoint>(data::point { 0, 0 }); break;
case TypeTag::Size: data_ = std::make_shared<DataTypes::TSize>(data::size { 0, 0 }); break;
case TypeTag::Cursor: data_ = std::make_shared<DataTypes::TString>("default"); break;
case TypeTag::Align: data_ = std::make_shared<DataTypes::TString>("topleft"); break;
case TypeTag::Margins: data_ = std::make_shared<DataTypes::TMargins>(data::margins { 0, 0, 0, 0 }); break;
case TypeTag::Font: data_ = std::make_shared<DataTypes::TFont>(data::font { "", 13, 0 }); break;

View File

@@ -48,7 +48,6 @@ enum class TypeTag {
Color,
Point,
Size,
Cursor,
Align,
Margins,
Font,
@@ -135,7 +134,7 @@ public:
// Can be int / pixels.
Value(TypeTag type, int value);
// Can be string / transition / cursor / align.
// Can be string / align.
Value(TypeTag type, std::string value);
// Default constructed value (uninitialized).