Fix indentation & other minor fixes (#5)

This commit is contained in:
ilya-fedin 2020-01-20 22:34:01 +00:00 committed by RadRussianRus
parent f923f63429
commit 371ba03f2c
25 changed files with 66 additions and 65 deletions

View file

@ -174,7 +174,7 @@ jobs:
build_linux:
name: Linux
runs-on: ubuntu-16.04
steps:
- name: Install packages
run: |

View file

@ -53,10 +53,10 @@ void RemoveQuarantineAttribute(NSString *path) {
}
void RemoveQuarantineFromBundle(NSString *path) {
RemoveQuarantineAttribute(path);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/MacOS/Kotatogram"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Helpers/crashpad_handler"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Frameworks/Updater"]);
RemoveQuarantineAttribute(path);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/MacOS/Kotatogram"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Helpers/crashpad_handler"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Frameworks/Updater"]);
}
void delFolder() {

View file

@ -927,4 +927,3 @@ fontsBoxTextStyle: TextStyle(defaultTextStyle) {
linkFont: font(13px);
linkFontOver: font(13px underline);
}

View file

@ -48,7 +48,7 @@ void FontsBox::prepare() {
_about.setText(st::fontsBoxTextStyle, tr::ktg_fonts_about(tr::now));
_aboutHeight = _about.countHeight(st::boxWidth - st::boxPadding.left() * 1.5);
setDimensions(st::boxWidth, _mainFontName->height() + _semiboldFontName->height() + _semiboldIsBold->height() + _monospacedFontName->height() + _aboutHeight + st::boxLittleSkip * 2);
}

View file

@ -29,5 +29,5 @@ private:
object_ptr<Ui::FlatLabel> _description = { nullptr };
std::shared_ptr<Ui::RadiobuttonGroup> _boostGroup;
};

View file

@ -178,9 +178,9 @@ bool Manager::readCustomFile() {
}
const auto settingsNetSpeedIt = settings.constFind(qsl("net_speed_boost"));
if (settingsNetSpeedIt != settings.constEnd()) {
if (settingsNetSpeedIt != settings.constEnd()) {
if ((*settingsNetSpeedIt).isString()) {
const auto option = (*settingsNetSpeedIt).toString();
if (option == "high") {
SetNetworkBoost(3);
@ -294,7 +294,7 @@ void Manager::writeCurrentSettings() {
auto settings = QJsonObject();
auto settingsFonts = QJsonObject();
if (!cMainFont().isEmpty()) {
settingsFonts.insert(qsl("main"), cMainFont());
}

View file

@ -87,8 +87,8 @@ void PaintNarrowCounter(
const auto allowDigits = displayMentionBadge ? 1 : 3;
auto unreadRight = st::dialogsPadding.x() + (DialogListLines() == 1 ? st::dialogsUnreadHeight : st::dialogsPhotoSize);
auto unreadTop = (lines == 1
? st::dialogsPadding.y()
: st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight);
? st::dialogsPadding.y()
: st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight);
auto unreadWidth = 0;
UnreadBadgeStyle st;
@ -101,8 +101,8 @@ void PaintNarrowCounter(
auto counter = qsl("@");
auto unreadRight = st::dialogsPadding.x() + (DialogListLines() == 1 ? st::dialogsUnreadHeight : st::dialogsPhotoSize) - skipBeforeMention;
auto unreadTop = (lines == 1
? st::dialogsPadding.y()
: st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight);
? st::dialogsPadding.y()
: st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight);
auto unreadWidth = 0;
UnreadBadgeStyle st;
@ -866,11 +866,11 @@ void RowPainter::paint(
| (peer && peer->isSelf() ? Flag::SavedMessages : Flag(0));
const auto paintItemCallback = [&](int nameleft, int namewidth) {
const auto texttop = (DialogListLines() == 1
? st::dialogsPadding.y()
: st::dialogsPadding.y()
+ st::msgNameFont->height
+ st::dialogsSkip);
? st::dialogsPadding.y()
: st::dialogsPadding.y()
+ st::msgNameFont->height
+ st::dialogsSkip);
const auto availableWidth = PaintWideCounter(
p,
texttop,
@ -1030,10 +1030,10 @@ void RowPainter::paint(
| (row->searchInChat().feed() ? Flag::FeedSearchResult : Flag(0))*/;
const auto paintItemCallback = [&](int nameleft, int namewidth) {
const auto texttop = (DialogListLines() == 1
? st::dialogsPadding.y()
: st::dialogsPadding.y()
+ st::msgNameFont->height
+ st::dialogsSkip);
? st::dialogsPadding.y()
: st::dialogsPadding.y()
+ st::msgNameFont->height
+ st::dialogsSkip);
const auto availableWidth = PaintWideCounter(
p,
texttop,
@ -1151,7 +1151,7 @@ void PaintCollapsedRow(
: st::dialogsPadding.x();
p.drawText(left, textBaseline, text);
} else if (!narrow) {
const auto textBaseline = unreadTop
+ (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2
+ st::dialogsUnreadFont->ascent;

View file

@ -139,7 +139,7 @@ void HistoryMessageForwarded::create() const {
lt_user,
textcmdLink(1, phrase));
}
TextParseOptions opts = {
TextParseRichText,
0,

View file

@ -1038,7 +1038,7 @@ void HistoryWidget::start() {
void HistoryWidget::onMentionInsert(UserData *user, FieldAutocomplete::ChooseMethod method) {
QString replacement, entityTag;
if (user->username.isEmpty()
|| method == FieldAutocomplete::ChooseMethod::ByRightClick
|| method == FieldAutocomplete::ChooseMethod::ByRightClick
|| method == FieldAutocomplete::ChooseMethod::ByCtrlEnter
|| method == FieldAutocomplete::ChooseMethod::ByCtrlClick) {
replacement = user->firstName;
@ -3173,7 +3173,6 @@ MsgId HistoryWidget::highlightOrigId() const {
return _highlightedOriginalMessageId;
}
void HistoryWidget::showAnimated(
Window::SlideDirection direction,
const Window::SectionSlideParams &params) {

View file

@ -113,8 +113,8 @@ QSize Gif::countOptimalSize() {
}
const auto captionWithPaddings = _caption.maxWidth()
+ st::msgPadding.left()
+ st::msgPadding.right();
+ st::msgPadding.left()
+ st::msgPadding.right();
const auto maxSize = _data->isVideoFile()
? st::maxMediaSize
: _data->isVideoMessage()
@ -173,8 +173,8 @@ QSize Gif::countCurrentSize(int newWidth) {
auto availableWidth = newWidth;
const auto captionWithPaddings = _caption.maxWidth()
+ st::msgPadding.left()
+ st::msgPadding.right();
+ st::msgPadding.left()
+ st::msgPadding.right();
const auto maxSize = _data->isVideoFile()
? st::maxMediaSize
: _data->isVideoMessage()
@ -925,7 +925,7 @@ void Gif::drawGrouped(
const auto mainWidget = App::main();
const auto highlightedRealId = mainWidget->highlightedOriginalId();
if (realId != highlightedRealId
&& animms
&& animms
&& animms < st::activeFadeInDuration + st::activeFadeOutDuration) {
const auto dt = (animms <= st::activeFadeInDuration)
? ((animms / float64(st::activeFadeInDuration)))
@ -975,7 +975,7 @@ void Gif::drawGrouped(
drawHighlighted([&]() {
p.drawImage(geometry, streamed->frame(request));
});
if (!paused) {
streamed->markFrameShown();
}

View file

@ -77,8 +77,8 @@ QSize GroupedMedia::countOptimalSize() {
}
const auto captionWithPaddings = _caption.maxWidth()
+ st::msgPadding.left()
+ st::msgPadding.right();
+ st::msgPadding.left()
+ st::msgPadding.right();
auto groupMaxWidth = st::historyGroupWidthMax;
if (cAdaptiveBubbles()) {
accumulate_max(groupMaxWidth, captionWithPaddings);

View file

@ -72,8 +72,8 @@ QSize Photo::countOptimalSize() {
auto minHeight = 0;
const auto captionWithPaddings = _caption.maxWidth()
+ st::msgPadding.left()
+ st::msgPadding.right();
+ st::msgPadding.left()
+ st::msgPadding.right();
auto inWebPage = (_parent->media() != this);
auto tw = style::ConvertScale(_data->width());
auto th = style::ConvertScale(_data->height());
@ -117,8 +117,8 @@ QSize Photo::countCurrentSize(int newWidth) {
auto availableWidth = newWidth;
const auto captionWithPaddings = _caption.maxWidth()
+ st::msgPadding.left()
+ st::msgPadding.right();
+ st::msgPadding.left()
+ st::msgPadding.right();
auto inWebPage = (_parent->media() != this);
auto tw = style::ConvertScale(_data->width());
auto th = style::ConvertScale(_data->height());
@ -399,7 +399,7 @@ void Photo::drawGrouped(
const auto mainWidget = App::main();
const auto highlightedRealId = mainWidget->highlightedOriginalId();
if (realId != highlightedRealId
&& animms
&& animms
&& animms < st::activeFadeInDuration + st::activeFadeOutDuration) {
const auto dt = (animms <= st::activeFadeInDuration)
? ((animms / float64(st::activeFadeInDuration)))

View file

@ -269,7 +269,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
tr::ktg_profile_copy_id(tr::now));
}
}
if (user->session().supportMode()) {
addInfoLineGeneric(
user->session().supportHelper().infoLabelValue(user),

View file

@ -79,8 +79,8 @@ void MemberListRow::paintAdminRank(
bool selected) {
p.setPen(_type.rights == Rights::Creator
? st::defaultPeerListItem.statusFgActive
: selected
? st::defaultPeerListItem.statusFgOver
: selected
? st::defaultPeerListItem.statusFgOver
: st::defaultPeerListItem.statusFg);
p.drawTextLeft(x, y, outerWidth, _type.adminRank, adminRankWidth());
}

View file

@ -101,11 +101,13 @@ rpl::producer<TextWithEntities> UsernameValue(not_null<UserData*> user) {
}
rpl::producer<QString> PlainAboutValue(not_null<PeerData*> peer) {
/*if (const auto user = peer->asUser()) {
/*
if (const auto user = peer->asUser()) {
if (!user->isBot()) {
return rpl::single(QString());
}
}*/
}
*/
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::AboutChanged

View file

@ -576,7 +576,7 @@ void Instance::fillDefaultJson() {
output.write(inputData);
output.close();
}
if (outputRaw.open(QIODevice::WriteOnly)) {
outputRaw.write(inputData);
outputRaw.close();
@ -592,7 +592,7 @@ void Instance::fillFromJson() {
const auto langBaseDir = jsonLangDir() + (qsl("%1.json").arg(baseId()));
loadFromJson(langBaseDir);
}
const auto langDefCustomDir = jsonLangDir() + (qsl("%1.default.json").arg(id()));
loadFromJson(langDefCustomDir);
const auto langCustomDir = jsonLangDir() + (qsl("%1.json").arg(id()));
@ -635,14 +635,14 @@ void Instance::loadFromJson(const QString &filename) {
const auto value = langKeys.constFind(key);
if ((*value).isString()) {
const auto name = QByteArray().append(key);
const auto translation = QByteArray().append((*value).toString());
applyValue(name, translation);
} else if ((*value).isObject()) {
const auto keyPlurals = (*value).toObject();
const auto pluralList = keyPlurals.keys();
@ -651,8 +651,8 @@ void Instance::loadFromJson(const QString &filename) {
const auto pluralValue = keyPlurals.constFind(plural);
if (!(*pluralValue).isString()) {
LOG(("Lang Info: wrong value for key %1 in %2 in file %3, string expected"
).arg(plural).arg(key).arg(filename));
LOG(("Lang Info: wrong value for key %1 in %2 in file %3, string expected")
.arg(plural).arg(key).arg(filename));
continue;
}
@ -665,8 +665,8 @@ void Instance::loadFromJson(const QString &filename) {
}
}
} else {
LOG(("Lang Info: wrong value for key %1 in file %2, string or object expected"
).arg(key).arg(filename));
LOG(("Lang Info: wrong value for key %1 in file %2, string or object expected")
.arg(key).arg(filename));
}
if (--limit <= 0) {
break;

View file

@ -188,7 +188,7 @@ QString getHomeDir() {
QString psAppDataPath() {
// We should not use ~/.TelegramDesktop, since it's a fork.
// auto home = getHomeDir();
// if (!home.isEmpty()) {
// auto oldPath = home + qsl(".TelegramDesktop/");

View file

@ -104,8 +104,8 @@ void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool select
p.setFont(st::normalFont);
p.setPen(item->adminState == Item::AdminState::Creator
? _st.statusFgActive
: selected
? _st.statusFgOver
: selected
? _st.statusFgOver
: _st.statusFg);
p.drawTextLeft(nameLeft + nameWidth - item->adminRankWidth, nameTop, width(), item->adminRank, item->adminRankWidth);
nameWidth -= item->adminRankWidth + skip;

View file

@ -272,4 +272,4 @@ rpl::producer<int> DialogListLinesChanges() {
return gDialogListLines.changes();
}
bool gDisableUpEdit = false;
bool gDisableUpEdit = false;

View file

@ -163,7 +163,7 @@ void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
st::settingsButton
)->addClickHandler([=] {
Ui::show(Box<NetBoostBox>());
});
});
AddSkip(container);
}

View file

@ -896,9 +896,11 @@ rpl::producer<QString> ProfilePhotoPrivacyController::title() {
return tr::lng_edit_privacy_profile_photo_title();
}
/*bool ProfilePhotoPrivacyController::hasOption(Option option) {
/*
bool ProfilePhotoPrivacyController::hasOption(Option option) {
return (option != Option::Nobody);
}*/
}
*/
rpl::producer<QString> ProfilePhotoPrivacyController::optionsTitleKey() {
return tr::lng_edit_privacy_profile_photo_header();

View file

@ -209,7 +209,7 @@ MainMenu::MainMenu(
_telegram->setLinksTrusted();
_version->setRichText(textcmdLink(1, currentVersionText()));
_version->setLink(1, std::make_shared<UrlClickHandler>(qsl("https://github.com/kotatogram/kotatogram-desktop")));
subscribe(_controller->session().downloaderTaskFinished(), [=] { update(); });
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserPhoneChanged, [this](const Notify::PeerUpdate &update) {
if (update.peer->isSelf()) {
@ -444,7 +444,7 @@ void MainMenu::paintEvent(QPaintEvent *e) {
st::mainMenuCoverNameOnlyTop,
widthText,
width());
}
if (_cloudButton) {
Ui::EmptyUserpic::PaintSavedMessages(

View file

@ -678,7 +678,6 @@ void FolderFiller::addTogglesForArchive() {
} // namespace
void PeerMenuHidePinnedMessage(not_null<PeerData*> peer) {
auto hidden = HistoryWidget::switchPinnedHidden(peer, true);
if (hidden) {

View file

@ -262,7 +262,7 @@ Go to ***BuildPath*** and run
### Building the project
Before refreshing, you can set build defines (skip this step if you don't need to disable anything):
export TDESKTOP_BUILD_DEFINES=TDESKTOP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE
Go to ***BuildPath*/tdesktop/Telegram** and run (using [your **api_id** and **api_hash**](#obtain-your-api-credentials))