mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix -Wunused-function warnings
This commit is contained in:
parent
84b1fac0c8
commit
89765340c3
19 changed files with 6 additions and 231 deletions
|
@ -246,51 +246,6 @@ void ShowEditPermissions(
|
||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowEditInviteLinks(
|
|
||||||
not_null<Window::SessionNavigation*> navigation,
|
|
||||||
not_null<PeerData*> peer) {
|
|
||||||
auto content = Box<EditPeerPermissionsBox>(navigation, peer);
|
|
||||||
const auto box = QPointer<EditPeerPermissionsBox>(content.data());
|
|
||||||
navigation->parentController()->show(
|
|
||||||
std::move(content),
|
|
||||||
Ui::LayerOption::KeepOther);
|
|
||||||
const auto saving = box->lifetime().make_state<int>(0);
|
|
||||||
const auto save = [=](
|
|
||||||
not_null<PeerData*> peer,
|
|
||||||
EditPeerPermissionsBox::Result result) {
|
|
||||||
Expects(result.slowmodeSeconds == 0 || peer->isChannel());
|
|
||||||
|
|
||||||
const auto close = crl::guard(box, [=] { box->closeBox(); });
|
|
||||||
SaveDefaultRestrictions(
|
|
||||||
peer,
|
|
||||||
result.rights,
|
|
||||||
close);
|
|
||||||
if (const auto channel = peer->asChannel()) {
|
|
||||||
SaveSlowmodeSeconds(channel, result.slowmodeSeconds, close);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
box->saveEvents(
|
|
||||||
) | rpl::start_with_next([=](EditPeerPermissionsBox::Result result) {
|
|
||||||
if (*saving) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*saving = true;
|
|
||||||
|
|
||||||
const auto saveFor = peer->migrateToOrMe();
|
|
||||||
const auto chat = saveFor->asChat();
|
|
||||||
if (!result.slowmodeSeconds || !chat) {
|
|
||||||
save(saveFor, result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto api = &peer->session().api();
|
|
||||||
api->migrateChat(chat, [=](not_null<ChannelData*> channel) {
|
|
||||||
save(channel, result);
|
|
||||||
}, [=](const MTP::Error &error) {
|
|
||||||
*saving = false;
|
|
||||||
});
|
|
||||||
}, box->lifetime());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -68,10 +68,6 @@ inline bool CanAddUrls(const QList<QUrl> &urls) {
|
||||||
return !urls.isEmpty() && ranges::all_of(urls, &QUrl::isLocalFile);
|
return !urls.isEmpty() && ranges::all_of(urls, &QUrl::isLocalFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsSingleItem(const Ui::PreparedList &list) {
|
|
||||||
return list.files.size() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileDialogCallback(
|
void FileDialogCallback(
|
||||||
FileDialog::OpenResult &&result,
|
FileDialog::OpenResult &&result,
|
||||||
Fn<bool(const Ui::PreparedList&)> checkResult,
|
Fn<bool(const Ui::PreparedList&)> checkResult,
|
||||||
|
|
|
@ -74,12 +74,6 @@ constexpr auto kMaxMediumQualities = 16; // 4 Fulls or 16 Mediums.
|
||||||
return msgId / double(1ULL << 32);
|
return msgId / double(1ULL << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::string ReadJsonString(
|
|
||||||
const QJsonObject &object,
|
|
||||||
const char *key) {
|
|
||||||
return object.value(key).toString().toStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] uint64 FindLocalRaisedHandRating(
|
[[nodiscard]] uint64 FindLocalRaisedHandRating(
|
||||||
const std::vector<Data::GroupCallParticipant> &list) {
|
const std::vector<Data::GroupCallParticipant> &list) {
|
||||||
const auto i = ranges::max_element(
|
const auto i = ranges::max_element(
|
||||||
|
|
|
@ -109,34 +109,6 @@ void StopGroupCallRecordingBox(
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto ToDurationFrom(TimeId startDate) {
|
|
||||||
return [=] {
|
|
||||||
const auto now = base::unixtime::now();
|
|
||||||
const auto elapsed = std::max(now - startDate, 0);
|
|
||||||
const auto hours = elapsed / 3600;
|
|
||||||
const auto minutes = (elapsed % 3600) / 60;
|
|
||||||
const auto seconds = (elapsed % 60);
|
|
||||||
return hours
|
|
||||||
? QString("%1:%2:%3"
|
|
||||||
).arg(hours
|
|
||||||
).arg(minutes, 2, 10, QChar('0')
|
|
||||||
).arg(seconds, 2, 10, QChar('0'))
|
|
||||||
: QString("%1:%2"
|
|
||||||
).arg(minutes
|
|
||||||
).arg(seconds, 2, 10, QChar('0'));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<QString> ToRecordDuration(TimeId startDate) {
|
|
||||||
return !startDate
|
|
||||||
? (rpl::single(QString()) | rpl::type_erased())
|
|
||||||
: rpl::single(
|
|
||||||
rpl::empty_value()
|
|
||||||
) | rpl::then(base::timer_each(
|
|
||||||
crl::time(1000)
|
|
||||||
)) | rpl::map(ToDurationFrom(startDate));
|
|
||||||
}
|
|
||||||
|
|
||||||
class JoinAsAction final : public Ui::Menu::ItemBase {
|
class JoinAsAction final : public Ui::Menu::ItemBase {
|
||||||
public:
|
public:
|
||||||
JoinAsAction(
|
JoinAsAction(
|
||||||
|
|
|
@ -63,57 +63,6 @@ struct CRYPTO_dynlock_value {
|
||||||
namespace {
|
namespace {
|
||||||
bool _sslInited = false;
|
bool _sslInited = false;
|
||||||
QMutex *_sslLocks = nullptr;
|
QMutex *_sslLocks = nullptr;
|
||||||
void _sslLockingCallback(int mode, int type, const char *file, int line) {
|
|
||||||
if (!_sslLocks) return; // not inited
|
|
||||||
|
|
||||||
if (mode & CRYPTO_LOCK) {
|
|
||||||
_sslLocks[type].lock();
|
|
||||||
} else {
|
|
||||||
_sslLocks[type].unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void _sslThreadId(CRYPTO_THREADID *id) {
|
|
||||||
CRYPTO_THREADID_set_pointer(id, QThread::currentThreadId());
|
|
||||||
}
|
|
||||||
CRYPTO_dynlock_value *_sslCreateFunction(const char *file, int line) {
|
|
||||||
return new CRYPTO_dynlock_value();
|
|
||||||
}
|
|
||||||
void _sslLockFunction(int mode, CRYPTO_dynlock_value *l, const char *file, int line) {
|
|
||||||
if (mode & CRYPTO_LOCK) {
|
|
||||||
l->mutex.lock();
|
|
||||||
} else {
|
|
||||||
l->mutex.unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void _sslDestroyFunction(CRYPTO_dynlock_value *l, const char *file, int line) {
|
|
||||||
delete l;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _ffmpegLockManager(void **mutex, AVLockOp op) {
|
|
||||||
switch (op) {
|
|
||||||
case AV_LOCK_CREATE: {
|
|
||||||
Assert(*mutex == nullptr);
|
|
||||||
*mutex = reinterpret_cast<void*>(new QMutex());
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case AV_LOCK_OBTAIN: {
|
|
||||||
Assert(*mutex != nullptr);
|
|
||||||
reinterpret_cast<QMutex*>(*mutex)->lock();
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case AV_LOCK_RELEASE: {
|
|
||||||
Assert(*mutex != nullptr);
|
|
||||||
reinterpret_cast<QMutex*>(*mutex)->unlock();
|
|
||||||
}; break;
|
|
||||||
|
|
||||||
case AV_LOCK_DESTROY: {
|
|
||||||
Assert(*mutex != nullptr);
|
|
||||||
delete reinterpret_cast<QMutex*>(*mutex);
|
|
||||||
*mutex = nullptr;
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
|
@ -33,11 +33,6 @@ constexpr auto kWaitForUpdatesTimeout = 3 * crl::time(1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] const std::string &EmptyEndpoint() {
|
|
||||||
static const auto result = std::string();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::string &GroupCallParticipant::cameraEndpoint() const {
|
const std::string &GroupCallParticipant::cameraEndpoint() const {
|
||||||
|
|
|
@ -40,12 +40,6 @@ struct LocationKey {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::tuple<const uint64 &, const uint64 &> value_ordering_helper(const LocationKey &value) {
|
|
||||||
return std::tie(
|
|
||||||
value.type,
|
|
||||||
value.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
LocationKey ComputeLocationKey(const Data::FileLocation &value) {
|
LocationKey ComputeLocationKey(const Data::FileLocation &value) {
|
||||||
auto result = LocationKey();
|
auto result = LocationKey();
|
||||||
result.type = value.dcId;
|
result.type = value.dcId;
|
||||||
|
|
|
@ -320,12 +320,6 @@ QByteArray FormatTimeText(TimeId date) {
|
||||||
+ Data::NumberToString(parsed.minute(), 2);
|
+ Data::NumberToString(parsed.minute(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray SerializeLink(
|
|
||||||
const Data::Utf8String &text,
|
|
||||||
const QString &path) {
|
|
||||||
return "<a href=\"" + path.toUtf8() + "\">" + text + "</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace details {
|
namespace details {
|
||||||
|
|
|
@ -17,15 +17,6 @@ constexpr AVSampleFormat AudioToFormat = AV_SAMPLE_FMT_S16;
|
||||||
constexpr int64_t AudioToChannelLayout = AV_CH_LAYOUT_STEREO;
|
constexpr int64_t AudioToChannelLayout = AV_CH_LAYOUT_STEREO;
|
||||||
constexpr int32 AudioToChannels = 2;
|
constexpr int32 AudioToChannels = 2;
|
||||||
|
|
||||||
bool IsPlanarFormat(int format) {
|
|
||||||
return (format == AV_SAMPLE_FMT_U8P)
|
|
||||||
|| (format == AV_SAMPLE_FMT_S16P)
|
|
||||||
|| (format == AV_SAMPLE_FMT_S32P)
|
|
||||||
|| (format == AV_SAMPLE_FMT_FLTP)
|
|
||||||
|| (format == AV_SAMPLE_FMT_DBLP)
|
|
||||||
|| (format == AV_SAMPLE_FMT_S64P);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ChildFFMpegLoader::ChildFFMpegLoader(
|
ChildFFMpegLoader::ChildFFMpegLoader(
|
||||||
|
|
|
@ -38,6 +38,7 @@ int Round(float64 value) {
|
||||||
using Context = GroupThumbs::Context;
|
using Context = GroupThumbs::Context;
|
||||||
using Key = GroupThumbs::Key;
|
using Key = GroupThumbs::Key;
|
||||||
|
|
||||||
|
#if 0
|
||||||
[[nodiscard]] QString DebugSerializeMsgId(FullMsgId itemId) {
|
[[nodiscard]] QString DebugSerializeMsgId(FullMsgId itemId) {
|
||||||
return QString("msg%1_%2").arg(itemId.channel.bare).arg(itemId.msg);
|
return QString("msg%1_%2").arg(itemId.channel.bare).arg(itemId.msg);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +74,7 @@ using Key = GroupThumbs::Key;
|
||||||
return "null";
|
return "null";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Data::FileOrigin ComputeFileOrigin(const Key &key, const Context &context) {
|
Data::FileOrigin ComputeFileOrigin(const Key &key, const Context &context) {
|
||||||
return v::match(key, [&](PhotoId photoId) {
|
return v::match(key, [&](PhotoId photoId) {
|
||||||
|
@ -511,6 +513,7 @@ void GroupThumbs::RefreshFromSlice(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
template <typename Slice>
|
template <typename Slice>
|
||||||
void ValidateSlice(
|
void ValidateSlice(
|
||||||
const Slice &slice,
|
const Slice &slice,
|
||||||
|
@ -544,6 +547,7 @@ void ValidateSlice(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename Slice>
|
template <typename Slice>
|
||||||
void GroupThumbs::fillItems(
|
void GroupThumbs::fillItems(
|
||||||
|
|
|
@ -72,15 +72,6 @@ using namespace details;
|
||||||
return idsStr + "]";
|
return idsStr + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString LogIds(const QVector<uint64> &ids) {
|
|
||||||
if (!ids.size()) return "[]";
|
|
||||||
auto idsStr = QString("[%1").arg(*ids.cbegin());
|
|
||||||
for (const auto id : ids) {
|
|
||||||
idsStr += QString(", %2").arg(id);
|
|
||||||
}
|
|
||||||
return idsStr + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] QString ComputeAppVersion() {
|
[[nodiscard]] QString ComputeAppVersion() {
|
||||||
return QString::fromLatin1(AppVersionStr) + ([] {
|
return QString::fromLatin1(AppVersionStr) + ([] {
|
||||||
#if defined OS_MAC_STORE
|
#if defined OS_MAC_STORE
|
||||||
|
|
|
@ -237,15 +237,6 @@ void SetupArchiveAndMute(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<Ui::SlideWrap<Ui::PlainShadow>*> AddSeparator(
|
|
||||||
not_null<Ui::VerticalLayout*> container) {
|
|
||||||
return container->add(
|
|
||||||
object_ptr<Ui::SlideWrap<Ui::PlainShadow>>(
|
|
||||||
container,
|
|
||||||
object_ptr<Ui::PlainShadow>(container),
|
|
||||||
st::settingsSeparatorPadding));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupLocalPasscode(
|
void SetupLocalPasscode(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<Ui::VerticalLayout*> container) {
|
not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
|
@ -92,10 +92,6 @@ enum class WriteMapWhen {
|
||||||
Soon,
|
Soon,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool _working() {
|
|
||||||
return !_basePath.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckStreamStatus(QDataStream &stream) {
|
bool CheckStreamStatus(QDataStream &stream) {
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("Bad data stream status: %1").arg(stream.status()));
|
LOG(("Bad data stream status: %1").arg(stream.status()));
|
||||||
|
|
|
@ -28,12 +28,6 @@ using namespace details;
|
||||||
return "key_" + dataName;
|
return "key_" + dataName;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString ComputeInfoName(const QString &dataName) {
|
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
|
||||||
//return "info_" + dataName + (cTestMode() ? "[test]" : "");
|
|
||||||
return "info_" + dataName;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Domain::Domain(not_null<Main::Domain*> owner, const QString &dataName)
|
Domain::Domain(not_null<Main::Domain*> owner, const QString &dataName)
|
||||||
|
|
|
@ -142,10 +142,6 @@ auto Colors() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMuted(CallMuteButtonType type) {
|
|
||||||
return (type != CallMuteButtonType::Active);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsConnecting(CallMuteButtonType type) {
|
bool IsConnecting(CallMuteButtonType type) {
|
||||||
return (type == CallMuteButtonType::Connecting);
|
return (type == CallMuteButtonType::Connecting);
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,37 +258,6 @@ CheckCaches *FrameCaches() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareCheckCaches(const style::RoundCheckbox *st, bool displayInactive, QPixmap &checkBgCache, QPixmap &checkFullCache) {
|
|
||||||
auto size = st->size;
|
|
||||||
auto wideSize = size * kWideScale;
|
|
||||||
auto cache = QImage(wideSize * cIntRetinaFactor(), wideSize * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
|
|
||||||
cache.setDevicePixelRatio(cRetinaFactor());
|
|
||||||
cache.fill(Qt::transparent);
|
|
||||||
{
|
|
||||||
Painter p(&cache);
|
|
||||||
PainterHighQualityEnabler hq(p);
|
|
||||||
|
|
||||||
if (displayInactive) {
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
} else {
|
|
||||||
auto pen = st->border->p;
|
|
||||||
pen.setWidth(st->width);
|
|
||||||
p.setPen(pen);
|
|
||||||
}
|
|
||||||
p.setBrush(st->bgActive);
|
|
||||||
auto ellipse = QRect((wideSize - size) / 2, (wideSize - size) / 2, size, size);
|
|
||||||
p.drawEllipse(ellipse);
|
|
||||||
}
|
|
||||||
auto cacheIcon = cache;
|
|
||||||
{
|
|
||||||
Painter p(&cacheIcon);
|
|
||||||
auto ellipse = QRect((wideSize - size) / 2, (wideSize - size) / 2, size, size);
|
|
||||||
st->check.paint(p, ellipse.topLeft(), wideSize);
|
|
||||||
}
|
|
||||||
checkBgCache = Ui::PixmapFromImage(std::move(cache));
|
|
||||||
checkFullCache = Ui::PixmapFromImage(std::move(cacheIcon));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
RoundCheckbox::RoundCheckbox(const style::RoundCheckbox &st, Fn<void()> updateCallback)
|
RoundCheckbox::RoundCheckbox(const style::RoundCheckbox &st, Fn<void()> updateCallback)
|
||||||
|
|
|
@ -41,10 +41,6 @@ namespace Notifications {
|
||||||
namespace Default {
|
namespace Default {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int notificationMaxHeight() {
|
|
||||||
return st::notifyMinHeight + st::notifyReplyArea.heightMax + st::notifyBorderWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPoint notificationStartPosition() {
|
QPoint notificationStartPosition() {
|
||||||
const auto corner = Core::App().settings().notificationsCorner();
|
const auto corner = Core::App().settings().notificationsCorner();
|
||||||
const auto window = Core::App().activeWindow();
|
const auto window = Core::App().activeWindow();
|
||||||
|
|
|
@ -254,10 +254,6 @@ void ImportFromFile(
|
||||||
crl::guard(parent, callback));
|
crl::guard(parent, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString BytesToUTF8(QLatin1String string) {
|
|
||||||
return QString::fromUtf8(string.data(), string.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// They're duplicated in window_theme.cpp:ChatBackground::ChatBackground.
|
// They're duplicated in window_theme.cpp:ChatBackground::ChatBackground.
|
||||||
[[nodiscard]] QByteArray ReplaceAdjustableColors(QByteArray data) {
|
[[nodiscard]] QByteArray ReplaceAdjustableColors(QByteArray data) {
|
||||||
const auto &themeObject = Background()->themeObject();
|
const auto &themeObject = Background()->themeObject();
|
||||||
|
|
|
@ -96,6 +96,7 @@ void Bar::paintEvent(QPaintEvent *e) {
|
||||||
_soon ? st::outdateSoonBg : st::outdatedBg);
|
_soon ? st::outdateSoonBg : st::outdatedBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DESKTOP_APP_SPECIAL_TARGET
|
||||||
QString LastHiddenPath() {
|
QString LastHiddenPath() {
|
||||||
return cWorkingDir() + qsl("tdata/outdated_hidden");
|
return cWorkingDir() + qsl("tdata/outdated_hidden");
|
||||||
}
|
}
|
||||||
|
@ -145,6 +146,7 @@ void Closed() {
|
||||||
reinterpret_cast<const char*>(&value),
|
reinterpret_cast<const char*>(&value),
|
||||||
sizeof(qint32)));
|
sizeof(qint32)));
|
||||||
}
|
}
|
||||||
|
#endif // DESKTOP_APP_SPECIAL_TARGET
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue