Welcome to mirror list, hosted at ThFree Co, Russian Federation.

platform_qt.cpp « platform - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e5bf38d9b7ebcce8af76fe9817f42c80ee2a2b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "platform.hpp"
#include "constants.hpp"

#include "../coding/file_reader.hpp"

#include "../base/regexp.hpp"

#include "../std/target_os.hpp"
#include "../std/algorithm.hpp"

#include <QtCore/QDir>
#include <QtCore/QFileInfo>


////////////////////////////////////////////////////////////////////////////////////////
ModelReader * Platform::GetReader(string const & file) const
{
  return new FileReader(ReadPathForFile(file),
                        READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT);
}

bool Platform::GetFileSizeByName(string const & fileName, uint64_t & size) const
{
  try
  {
    return GetFileSizeByFullPath(ReadPathForFile(fileName), size);
  }
  catch (RootException const &)
  {
    return false;
  }
}

void Platform::GetFilesByRegExp(string const & directory, string const & regexp, FilesList & outFiles)
{
  regexp::RegExpT exp;
  regexp::Create(regexp, exp);

  QDir dir(QString::fromUtf8(directory.c_str()));
  int const count = dir.count();

  for (int i = 0; i < count; ++i)
  {
    string const name = dir[i].toUtf8().data();
    if (regexp::IsExist(name, exp))
      outFiles.push_back(name);
  }
}

string Platform::DeviceName() const
{
  return OMIM_OS_NAME;
}

int Platform::PreCachingDepth() const
{
  return 3;
}

int Platform::ScaleEtalonSize() const
{
  return 512 + 256;
}

int Platform::VideoMemoryLimit() const
{
  return 20 * 1024 * 1024;
}

///////////////////////////////////////////////////////////////////////////////
extern Platform & GetPlatform()
{
  class PlatformQt : public Platform
  {
  public:
    PlatformQt()
    {
      m_isPro = true;
    }
  };

  static PlatformQt platform;
  return platform;
}