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: 25165f59d61362d46869ea2d7606975c6f80beb5 (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
#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);
  }
}

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

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


extern Platform & GetPlatform()
{
  // We need this derive class because Platform::Platform for desktop
  // has special initialization in every platform.
  class PlatformQt : public Platform
  {
  public:
    PlatformQt()
    {
      m_isPro = true;
    }
  };

  static PlatformQt platform;
  return platform;
}