[qt] move anonymous namespace from namespace qt {}

This commit is contained in:
Mikhail Gorbushin 2019-06-15 19:08:40 +03:00 committed by mpimenov
parent c57ed6add9
commit a9f4ff6d61

View file

@ -64,6 +64,45 @@ namespace
{
using namespace qt;
struct button_t
{
QString name;
char const * icon;
char const * slot;
};
void add_buttons(QToolBar * pBar, button_t buttons[], size_t count, QObject * pReceiver)
{
for (size_t i = 0; i < count; ++i)
{
if (buttons[i].icon)
pBar->addAction(QIcon(buttons[i].icon), buttons[i].name, pReceiver, buttons[i].slot);
else
pBar->addSeparator();
}
}
void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload)
{
int const mbInBytes = 1024 * 1024;
int const kbInBytes = 1024;
if (sizeInBytes > mbInBytes)
{
sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes;
units = "MB";
}
else if (sizeInBytes > kbInBytes)
{
sizeToDownload = (sizeInBytes + kbInBytes -1) / kbInBytes;
units = "KB";
}
else
{
sizeToDownload = sizeInBytes;
units = "B";
}
}
DrawWidget::SelectionMode ConvertFromMwmsBordersSelection(qt::MwmsBordersSelection::Response mode)
{
switch (mode)
@ -96,6 +135,14 @@ DrawWidget::SelectionMode ConvertFromMwmsBordersSelection(qt::MwmsBordersSelecti
UNREACHABLE();
}
}
bool IsMwmsBordersSelectionMode(DrawWidget::SelectionMode mode)
{
return mode == DrawWidget::SelectionMode::MwmsBordersByPolyFiles ||
mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPolyFiles ||
mode == DrawWidget::SelectionMode::MwmsBordersByPackedPolygon ||
mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPackedPolygon;
}
} // namespace
namespace qt
@ -269,56 +316,6 @@ void MainWindow::LocationStateModeChanged(location::EMyPositionMode mode)
m_pMyPositionAction->setToolTip(tr("My Position"));
}
namespace
{
struct button_t
{
QString name;
char const * icon;
char const * slot;
};
void add_buttons(QToolBar * pBar, button_t buttons[], size_t count, QObject * pReceiver)
{
for (size_t i = 0; i < count; ++i)
{
if (buttons[i].icon)
pBar->addAction(QIcon(buttons[i].icon), buttons[i].name, pReceiver, buttons[i].slot);
else
pBar->addSeparator();
}
}
void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload)
{
int const mbInBytes = 1024 * 1024;
int const kbInBytes = 1024;
if (sizeInBytes > mbInBytes)
{
sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes;
units = "MB";
}
else if (sizeInBytes > kbInBytes)
{
sizeToDownload = (sizeInBytes + kbInBytes -1) / kbInBytes;
units = "KB";
}
else
{
sizeToDownload = sizeInBytes;
units = "B";
}
}
bool IsMwmsBordersSelectionMode(DrawWidget::SelectionMode mode)
{
return mode == DrawWidget::SelectionMode::MwmsBordersByPolyFiles ||
mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPolyFiles ||
mode == DrawWidget::SelectionMode::MwmsBordersByPackedPolygon ||
mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPackedPolygon;
}
} // namespace
void MainWindow::CreateNavigationBar()
{
QToolBar * pToolBar = new QToolBar(tr("Navigation Bar"), this);