misc/quazip/quazipnewinfo.cpp
author unc0rr
Thu, 01 Nov 2012 14:31:53 +0400
branch0.9.18
changeset 7916 be11c26a3a0b
parent 7889 57b117d441b9
permissions -rw-r--r--
Fix 0.9.18 desync: CreateNetGame() slot creates signal-slot connections from hwnet to hwgame. The problem is that this slot is called asynchronously using queued connection, and hwnet could send some signals to hwgame before hwgame object is created and connected. Changed this to direct connection. Also changed connections to hwgame object to queued, but this is unrelated. Sorry, it is frontend patch. Maybe a little delay on server side could help, but not much, as tcp packets could get glued on client's side, and that greately depends on pc and internet connection performance. Frontend should be reworked to be safe for queued connections, as it is extemely dangerous to have a mix of queued/direct connections.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7889
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     1
/*
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     2
Copyright (C) 2005-2011 Sergey A. Tachenov
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     3
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     4
This program is free software; you can redistribute it and/or modify it
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     5
under the terms of the GNU Lesser General Public License as published by
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     6
the Free Software Foundation; either version 2 of the License, or (at
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     7
your option) any later version.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     8
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     9
This program is distributed in the hope that it will be useful, but
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    10
WITHOUT ANY WARRANTY; without even the implied warranty of
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    12
General Public License for more details.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    13
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    14
You should have received a copy of the GNU Lesser General Public License
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    15
along with this program; if not, write to the Free Software Foundation,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    16
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    17
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    18
See COPYING file for the full LGPL text.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    19
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    20
Original ZIP package is copyrighted by Gilles Vollant, see
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    21
quazip/(un)zip.h files for details, basically it's zlib license.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    22
*/
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    23
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    24
#include <QFileInfo>
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    25
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    26
#include "quazipnewinfo.h"
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    27
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    28
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    29
QuaZipNewInfo::QuaZipNewInfo(const QString& name):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    30
  name(name), dateTime(QDateTime::currentDateTime()), internalAttr(0), externalAttr(0)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    31
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    32
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    33
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    34
QuaZipNewInfo::QuaZipNewInfo(const QString& name, const QString& file):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    35
  name(name), internalAttr(0), externalAttr(0)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    36
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    37
  QFileInfo info(file);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    38
  QDateTime lm = info.lastModified();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    39
  if (!info.exists())
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    40
    dateTime = QDateTime::currentDateTime();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    41
  else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    42
    dateTime = lm;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    43
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    44
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    45
void QuaZipNewInfo::setFileDateTime(const QString& file)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    46
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    47
  QFileInfo info(file);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    48
  QDateTime lm = info.lastModified();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    49
  if (info.exists())
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    50
    dateTime = lm;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    51
}