Moved some more functions into MUtilities libraries.

This commit is contained in:
LoRd_MuldeR 2015-02-01 21:05:17 +01:00
parent 07fdd97f97
commit 24e2b93d68
16 changed files with 345 additions and 1877 deletions

518
src/3rd_party/blake2.c vendored
View File

@ -1,518 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "blake2.h"
/*------------------------------------*/
/* blake2-impl.h */
/*------------------------------------*/
static inline uint32_t load32( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
return *( uint32_t * )( src );
#else
const uint8_t *p = ( uint8_t * )src;
uint32_t w = *p++;
w |= ( uint32_t )( *p++ ) << 8;
w |= ( uint32_t )( *p++ ) << 16;
w |= ( uint32_t )( *p++ ) << 24;
return w;
#endif
}
static inline uint64_t load64( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
return *( uint64_t * )( src );
#else
const uint8_t *p = ( uint8_t * )src;
uint64_t w = *p++;
w |= ( uint64_t )( *p++ ) << 8;
w |= ( uint64_t )( *p++ ) << 16;
w |= ( uint64_t )( *p++ ) << 24;
w |= ( uint64_t )( *p++ ) << 32;
w |= ( uint64_t )( *p++ ) << 40;
w |= ( uint64_t )( *p++ ) << 48;
w |= ( uint64_t )( *p++ ) << 56;
return w;
#endif
}
static inline void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
*( uint32_t * )( dst ) = w;
#else
uint8_t *p = ( uint8_t * )dst;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w;
#endif
}
static inline void store64( void *dst, uint64_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
*( uint64_t * )( dst ) = w;
#else
uint8_t *p = ( uint8_t * )dst;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w;
#endif
}
static inline uint64_t load48( const void *src )
{
const uint8_t *p = ( const uint8_t * )src;
uint64_t w = *p++;
w |= ( uint64_t )( *p++ ) << 8;
w |= ( uint64_t )( *p++ ) << 16;
w |= ( uint64_t )( *p++ ) << 24;
w |= ( uint64_t )( *p++ ) << 32;
w |= ( uint64_t )( *p++ ) << 40;
return w;
}
static inline void store48( void *dst, uint64_t w )
{
uint8_t *p = ( uint8_t * )dst;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w;
}
static inline uint32_t rotl32( const uint32_t w, const unsigned c )
{
return ( w << c ) | ( w >> ( 32 - c ) );
}
static inline uint64_t rotl64( const uint64_t w, const unsigned c )
{
return ( w << c ) | ( w >> ( 64 - c ) );
}
static inline uint32_t rotr32( const uint32_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 32 - c ) );
}
static inline uint64_t rotr64( const uint64_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 64 - c ) );
}
/* prevents compiler optimizing out memset() */
static inline void secure_zero_memory( void *v, size_t n )
{
volatile uint8_t *p = ( volatile uint8_t * )v;
while( n-- ) *p++ = 0;
}
/*------------------------------------*/
/* blake2b-ref.c */
/*------------------------------------*/
static const uint64_t blake2b_IV[8] =
{
0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
};
static const uint8_t blake2b_sigma[12][16] =
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
};
static inline int blake2b_set_lastnode( blake2b_state *S )
{
S->f[1] = ~0ULL;
return 0;
}
static inline int blake2b_clear_lastnode( blake2b_state *S )
{
S->f[1] = 0ULL;
return 0;
}
/* Some helper functions, not necessarily useful */
static inline int blake2b_set_lastblock( blake2b_state *S )
{
if( S->last_node ) blake2b_set_lastnode( S );
S->f[0] = ~0ULL;
return 0;
}
static inline int blake2b_clear_lastblock( blake2b_state *S )
{
if( S->last_node ) blake2b_clear_lastnode( S );
S->f[0] = 0ULL;
return 0;
}
static inline int blake2b_increment_counter( blake2b_state *S, const uint64_t inc )
{
S->t[0] += inc;
S->t[1] += ( S->t[0] < inc );
return 0;
}
// Parameter-related functions
static inline int blake2b_param_set_digest_length( blake2b_param *P, const uint8_t digest_length )
{
P->digest_length = digest_length;
return 0;
}
static inline int blake2b_param_set_fanout( blake2b_param *P, const uint8_t fanout )
{
P->fanout = fanout;
return 0;
}
static inline int blake2b_param_set_max_depth( blake2b_param *P, const uint8_t depth )
{
P->depth = depth;
return 0;
}
static inline int blake2b_param_set_leaf_length( blake2b_param *P, const uint32_t leaf_length )
{
store32( &P->leaf_length, leaf_length );
return 0;
}
static inline int blake2b_param_set_node_offset( blake2b_param *P, const uint64_t node_offset )
{
store64( &P->node_offset, node_offset );
return 0;
}
static inline int blake2b_param_set_node_depth( blake2b_param *P, const uint8_t node_depth )
{
P->node_depth = node_depth;
return 0;
}
static inline int blake2b_param_set_inner_length( blake2b_param *P, const uint8_t inner_length )
{
P->inner_length = inner_length;
return 0;
}
static inline int blake2b_param_set_salt( blake2b_param *P, const uint8_t salt[BLAKE2B_SALTBYTES] )
{
memcpy( P->salt, salt, BLAKE2B_SALTBYTES );
return 0;
}
static inline int blake2b_param_set_personal( blake2b_param *P, const uint8_t personal[BLAKE2B_PERSONALBYTES] )
{
memcpy( P->personal, personal, BLAKE2B_PERSONALBYTES );
return 0;
}
static inline int blake2b_init0( blake2b_state *S )
{
int i;
memset( S, 0, sizeof( blake2b_state ) );
for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
return 0;
}
/* init xors IV with input parameter block */
int blake2b_init_param( blake2b_state *S, const blake2b_param *P )
{
uint8_t *p;
size_t i;
blake2b_init0( S );
p = ( uint8_t * )( P );
/* IV XOR ParamBlock */
for( i = 0; i < 8; ++i )
S->h[i] ^= load64( p + sizeof( S->h[i] ) * i );
return 0;
}
int blake2b_init( blake2b_state *S, const uint8_t outlen )
{
blake2b_param P[1];
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
P->digest_length = outlen;
P->key_length = 0;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store64( &P->node_offset, 0 );
P->node_depth = 0;
P->inner_length = 0;
memset( P->reserved, 0, sizeof( P->reserved ) );
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
return blake2b_init_param( S, P );
}
int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen )
{
blake2b_param P[1];
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
P->digest_length = outlen;
P->key_length = keylen;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store64( &P->node_offset, 0 );
P->node_depth = 0;
P->inner_length = 0;
memset( P->reserved, 0, sizeof( P->reserved ) );
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
if( blake2b_init_param( S, P ) < 0 ) return -1;
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset( block, 0, BLAKE2B_BLOCKBYTES );
memcpy( block, key, keylen );
blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
}
return 0;
}
static int blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] )
{
uint64_t m[16];
uint64_t v[16];
int i;
for( i = 0; i < 16; ++i )
m[i] = load64( block + i * sizeof( m[i] ) );
for( i = 0; i < 8; ++i )
v[i] = S->h[i];
v[ 8] = blake2b_IV[0];
v[ 9] = blake2b_IV[1];
v[10] = blake2b_IV[2];
v[11] = blake2b_IV[3];
v[12] = S->t[0] ^ blake2b_IV[4];
v[13] = S->t[1] ^ blake2b_IV[5];
v[14] = S->f[0] ^ blake2b_IV[6];
v[15] = S->f[1] ^ blake2b_IV[7];
#define G(r,i,a,b,c,d) \
do { \
a = a + b + m[blake2b_sigma[r][2*i+0]]; \
d = rotr64(d ^ a, 32); \
c = c + d; \
b = rotr64(b ^ c, 24); \
a = a + b + m[blake2b_sigma[r][2*i+1]]; \
d = rotr64(d ^ a, 16); \
c = c + d; \
b = rotr64(b ^ c, 63); \
} while(0)
#define ROUND(r) \
do { \
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
ROUND( 0 );
ROUND( 1 );
ROUND( 2 );
ROUND( 3 );
ROUND( 4 );
ROUND( 5 );
ROUND( 6 );
ROUND( 7 );
ROUND( 8 );
ROUND( 9 );
ROUND( 10 );
ROUND( 11 );
for( i = 0; i < 8; ++i )
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
#undef G
#undef ROUND
return 0;
}
/* inlen now in bytes */
int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen )
{
while( inlen > 0 )
{
size_t left = S->buflen;
size_t fill = 2 * BLAKE2B_BLOCKBYTES - left;
if( inlen > fill )
{
memcpy( S->buf + left, in, fill ); // Fill buffer
S->buflen += fill;
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf ); // Compress
memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); // Shift buffer left
S->buflen -= BLAKE2B_BLOCKBYTES;
in += fill;
inlen -= fill;
}
else // inlen <= fill
{
memcpy( S->buf + left, in, (size_t) inlen );
S->buflen = (size_t)(S->buflen + inlen); // Be lazy, do not compress
in += inlen;
inlen -= inlen;
}
}
return 0;
}
/* Is this correct? */
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
{
int i;
uint8_t buffer[BLAKE2B_OUTBYTES];
if( S->buflen > BLAKE2B_BLOCKBYTES )
{
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf );
S->buflen -= BLAKE2B_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
}
blake2b_increment_counter( S, S->buflen );
blake2b_set_lastblock( S );
memset( S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
blake2b_compress( S, S->buf );
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );
return 0;
}
/* inlen, at least, should be uint64_t. Others can be size_t. */
int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
{
blake2b_state S[1];
/* Verify parameters */
if ( NULL == in ) return -1;
if ( NULL == out ) return -1;
if( NULL == key ) keylen = 0;
if( keylen > 0 )
{
if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
}
else
{
if( blake2b_init( S, outlen ) < 0 ) return -1;
}
blake2b_update( S, ( uint8_t * )in, inlen );
blake2b_final( S, out, outlen );
return 0;
}
#if defined(BLAKE2B_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
int main( int argc, char **argv )
{
uint8_t key[BLAKE2B_KEYBYTES];
uint8_t buf[KAT_LENGTH];
for( size_t i = 0; i < BLAKE2B_KEYBYTES; ++i )
key[i] = ( uint8_t )i;
for( size_t i = 0; i < KAT_LENGTH; ++i )
buf[i] = ( uint8_t )i;
for( size_t i = 0; i < KAT_LENGTH; ++i )
{
uint8_t hash[BLAKE2B_OUTBYTES];
blake2b( hash, buf, key, BLAKE2B_OUTBYTES, i, BLAKE2B_KEYBYTES );
if( 0 != memcmp( hash, blake2b_keyed_kat[i], BLAKE2B_OUTBYTES ) )
{
puts( "error" );
return -1;
}
}
puts( "ok" );
return 0;
}
#endif

View File

@ -1,89 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#pragma once
#ifndef __BLAKE2_H__
#define __BLAKE2_H__
#include <stddef.h>
#include <stdint.h>
#if defined(_MSC_VER)
#define ALIGN(x) __declspec(align(x))
#ifndef __cplusplus
#define inline __inline
#endif
#else
#define ALIGN(x) __attribute__((aligned(x)))
#endif
#if defined(__cplusplus)
extern "C" {
#endif
enum blake2b_constant
{
BLAKE2B_BLOCKBYTES = 128,
BLAKE2B_OUTBYTES = 64,
BLAKE2B_KEYBYTES = 64,
BLAKE2B_SALTBYTES = 16,
BLAKE2B_PERSONALBYTES = 16
};
#pragma pack(push, 1)
typedef struct __blake2b_param
{
uint8_t digest_length; // 1
uint8_t key_length; // 2
uint8_t fanout; // 3
uint8_t depth; // 4
uint32_t leaf_length; // 8
uint64_t node_offset; // 16
uint8_t node_depth; // 17
uint8_t inner_length; // 18
uint8_t reserved[14]; // 32
uint8_t salt[BLAKE2B_SALTBYTES]; // 48
uint8_t personal[BLAKE2B_PERSONALBYTES]; // 64
} blake2b_param;
ALIGN( 64 ) typedef struct __blake2b_state
{
uint64_t h[8];
uint64_t t[2];
uint64_t f[2];
uint8_t buf[2 * BLAKE2B_BLOCKBYTES];
size_t buflen;
uint8_t last_node;
} blake2b_state;
#pragma pack(pop)
// Streaming API
int blake2b_init( blake2b_state *S, const uint8_t outlen );
int blake2b_init_key( blake2b_state *S, const uint8_t outlen, const void *key, const uint8_t keylen );
int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen );
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen );
// Simple API
int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen );
static inline int blake2( uint8_t *out, const void *in, const void *key, const uint8_t outlen, const uint64_t inlen, uint8_t keylen )
{
return blake2b( out, in, key, outlen, inlen, keylen );
}
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -1,141 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
/*
BLAKE2 reference source code package - reference C implementations
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include "checksum.h"
#include "global.h"
#include "3rd_party/blake2.h"
#include <malloc.h>
#include <string.h>
#include <stdexcept>
static const size_t HASH_SIZE = 64;
class QBlake2ChecksumContext
{
friend QBlake2Checksum;
QBlake2ChecksumContext(void)
{
if(!(state = (blake2b_state*) _aligned_malloc(sizeof(blake2b_state), 64)))
{
THROW("Aligend malloc has failed!");
}
memset(state, 0, sizeof(blake2b_state));
}
~QBlake2ChecksumContext(void)
{
memset(state, 0, sizeof(blake2b_state));
_aligned_free(state);
}
private:
blake2b_state *state;
};
QBlake2Checksum::QBlake2Checksum(const char* key)
:
m_hash(HASH_SIZE, '\0'),
m_context(new QBlake2ChecksumContext()),
m_finalized(false)
{
if(key && key[0])
{
blake2b_init_key(m_context->state, HASH_SIZE, key, strlen(key));
}
else
{
blake2b_init(m_context->state, HASH_SIZE);
}
}
QBlake2Checksum::~QBlake2Checksum(void)
{
delete m_context;
}
void QBlake2Checksum::update(const QByteArray &data)
{
if(m_finalized)
{
THROW("BLAKE2 was already finalized!");
}
if(data.size() > 0)
{
if(blake2b_update(m_context->state, (const uint8_t*) data.constData(), data.size()) != 0)
{
THROW("BLAKE2 internal error!");
}
}
}
void QBlake2Checksum::update(QFile &file)
{
bool okay = false;
for(;;)
{
QByteArray data = file.read(16384);
if(data.size() > 0)
{
okay = true;
update(data);
continue;
}
break;
}
if(!okay)
{
qWarning("[QBlake2Checksum] Could not ready any data from file!");
}
}
QByteArray QBlake2Checksum::finalize(const bool bAsHex)
{
if(!m_finalized)
{
if(blake2b_final(m_context->state, (uint8_t*) m_hash.data(), m_hash.size()) != 0)
{
THROW("BLAKE2 internal error!");
}
m_finalized = true;
}
return bAsHex ? m_hash.toHex() : m_hash;
}

View File

@ -21,22 +21,12 @@
#pragma once
#include <QThread>
#include <QMutex>
class QSharedMemory;
class QStringList;
class QSystemSemaphore;
class IPCCore;
class IPCReceiveThread;
class IPCSendThread;
//IPC Commands
static const quint32 IPC_OPCODE_PING = 0;
static const quint32 IPC_OPCODE_ADD_FILE = 1;
static const quint32 IPC_OPCODE_ADD_JOB = 2;
static const quint32 IPC_OPCODE_MAX = 3;
static const quint32 IPC_OPCODE_NOOP = 0;
static const quint32 IPC_OPCODE_PING = 1;
static const quint32 IPC_OPCODE_ADD_FILE = 2;
static const quint32 IPC_OPCODE_ADD_JOB = 3;
static const quint32 IPC_OPCODE_MAX = 4;
//IPC Flags
static const quint32 IPC_FLAG_FORCE_START = 0x00000001;

View File

@ -178,7 +178,7 @@ static int simple_x264_main(int &argc, char **argv)
}
//Create Main Window
QScopedPointer<MainWindow> mainWindow(new MainWindow(cpuFeatures));
QScopedPointer<MainWindow> mainWindow(new MainWindow(cpuFeatures, ipcChannel.data()));
mainWindow->show();
//Run application

103
src/thread_ipc_recv.cpp Normal file
View File

@ -0,0 +1,103 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version, but always including the *additional*
// restrictions defined in the "License.txt" file.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#include "thread_ipc_recv.h"
//Internal
#include "Global.h"
#include "cli.h"
#include "ipc.h"
//MUtils
#include <MUtils/Global.h>
#include <MUtils/IPCChannel.h>
#include <MUtils/OSSupport.h>
//Qt
#include <QStringList>
#include <QApplication>
#include <QFileInfo>
#include <QDir>
//CRT
#include <limits.h>
////////////////////////////////////////////////////////////
// Constructor & Destructor
////////////////////////////////////////////////////////////
IPCThread_Recv::IPCThread_Recv(MUtils::IPCChannel *const ipcChannel)
:
m_ipcChannel(ipcChannel)
{
m_stopFlag = false;
}
IPCThread_Recv::~IPCThread_Recv(void)
{
}
////////////////////////////////////////////////////////////
// Thread Main
////////////////////////////////////////////////////////////
void IPCThread_Recv::run()
{
setTerminationEnabled(true);
QStringList params;
quint32 command, flags;
while(!m_stopFlag)
{
if(m_ipcChannel->read(command, flags, params))
{
if(command != IPC_OPCODE_NOOP)
{
emit receivedCommand(command, params, flags);
}
}
else
{
qWarning("Failed to read next IPC message!");
break;
}
}
}
////////////////////////////////////////////////////////////
// Public Methods
////////////////////////////////////////////////////////////
void IPCThread_Recv::stop(void)
{
if(!m_stopFlag)
{
m_stopFlag = true;
m_ipcChannel->send(0, 0, QStringList());
}
}
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
/*NONE*/

View File

@ -5,7 +5,8 @@
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// (at your option) any later version, but always including the *additional*
// restrictions defined in the "License.txt" file.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -19,38 +20,31 @@
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
/*
BLAKE2 reference source code package - reference C implementations
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#pragma once
#include <QByteArray>
#include <QFile>
#include <QThread>
class QBlake2ChecksumContext;
class QBlake2Checksum
namespace MUtils
{
class IPCChannel;
}
class IPCThread_Recv: public QThread
{
Q_OBJECT
public:
QBlake2Checksum(const char* key = NULL);
~QBlake2Checksum(void);
IPCThread_Recv(MUtils::IPCChannel *const ipcChannel);
~IPCThread_Recv(void);
void update(const QByteArray &data);
void update(QFile &file);
QByteArray finalize(const bool bAsHex = true);
void stop(void);
private:
QByteArray m_hash;
QBlake2ChecksumContext *const m_context;
bool m_finalized;
signals:
void receivedCommand(const int &command, const QStringList &args, const quint32 &flags);
protected:
volatile bool m_stopFlag;
MUtils::IPCChannel *const m_ipcChannel;
void run();
};

View File

@ -1,755 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#include "thread_updater.h"
#include "global.h"
#include <QStringList>
#include <QFile>
#include <QFileInfo>
#include <QProcess>
#include <QUrl>
#include <QEventLoop>
#include <QTimer>
///////////////////////////////////////////////////////////////////////////////
// CONSTANTS
///////////////////////////////////////////////////////////////////////////////
static const char *header_id = "!Update";
static const char *section_id = "Simple x264 Launcher";
static const char *mirror_url_postfix[] =
{
"update.ver",
"update_beta.ver",
NULL
};
static const char *update_mirrors_prim[] =
{
"http://muldersoft.com/",
"http://mulder.bplaced.net/",
"http://mulder.cwsurf.de/",
"http://mulder.6te.net/",
"http://mulder.webuda.com/",
"http://mulder.byethost13.com/",
"http://muldersoft.kilu.de/",
"http://mulder.pe.hu/",
"http://muldersoft.zxq.net/",
"http://lamexp.sourceforge.net/",
"http://lordmulder.github.io/LameXP/",
"http://lord_mulder.bitbucket.org/",
"http://www.tricksoft.de/",
NULL
};
static const char *update_mirrors_back[] =
{
"http://mplayer.savedonthe.net/",
NULL
};
static const char *known_hosts[] = //Taken form: http://www.alexa.com/topsites !!!
{
"http://www.163.com/",
"http://www.7-zip.org/",
"http://www.ac3filter.net/",
"http://www.amazon.com/",
"http://antergos.com/",
"http://www.aol.com/",
"http://www.apache.org/",
"http://www.apple.com/",
"http://www.adobe.com/",
"http://www.avidemux.org/",
"http://www.babylon.com/",
"http://www.baidu.com/",
"http://bandcamp.com/",
"http://www.bbc.co.uk/",
"http://www.berlios.de/",
"http://www.bing.com/",
"http://www.bucketheadpikes.com/",
"http://www.ccc.de/",
"http://www.cnet.com/",
"http://cnzz.com/",
"http://www.codeplex.com/",
"http://www.ebay.com/",
"http://www.equation.com/",
"http://fc2.com/",
"http://fedoraproject.org/wiki/Fedora_Project_Wiki",
"http://blog.fefe.de/",
"http://www.ffmpeg.org/",
"http://blog.flickr.net/en",
"http://free-codecs.com/",
"http://blog.gitorious.org/",
"http://git-scm.com/",
"http://www.gmx.net/",
"http://www.gnome.org/",
"http://www.gnu.org/",
"http://go.com/",
"http://code.google.com/",
"http://www.heise.de/",
"http://www.huffingtonpost.co.uk/",
"http://www.iana.org/",
"http://www.imdb.com/",
"http://www.imgburn.com/",
"http://imgur.com/",
"http://en.jd.com/",
"http://kannmanumdieuhrzeitschonnbierchentrinken.de/",
"http://mirrors.kernel.org/",
"http://lame.sourceforge.net/",
"http://www.libav.org/",
"http://blog.linkedin.com/",
"http://www.linuxmint.com/",
"http://www.livedoor.com/",
"http://www.livejournal.com/",
"http://go.mail.ru/",
"http://www.mediafire.com/",
"http://ftp.mozilla.org/",
"http://mplayerhq.hu/",
"http://www.msn.com/en-us/",
"http://oss.netfarm.it/",
"http://www.nytimes.com/",
"http://www.opera.com/",
"http://pastie.org/",
"http://www.portablefreeware.com/",
"http://www.qt.io/",
"http://qt-project.org/",
"http://www.quakelive.com/",
"http://www.seamonkey-project.org/",
"http://www.sina.com.cn/",
"http://www.sohu.com/",
"http://www.soso.com/",
"http://sourceforge.net/",
"http://www.spiegel.de/",
"http://tdm-gcc.tdragon.net/",
"http://www.tdrsmusic.com/",
"http://www.ubuntu.com/",
"http://status.twitter.com/",
"http://www.uol.com.br/",
"http://www.videohelp.com/",
"http://www.videolan.org/",
"http://virtualdub.org/",
"http://blog.virustotal.com/",
"http://www.weibo.com/login.php",
"http://www.wikipedia.org/",
"http://www.winamp.com/",
"http://en.support.wordpress.com/",
"http://xiph.org/",
"http://us.mail.yahoo.com/",
"http://www.yandex.ru/",
"http://www.youtube.com/yt/about/",
"http://www.zedo.com/",
"http://ffmpeg.zeranoe.com/",
NULL
};
static const int MIN_CONNSCORE = 8;
static const int VERSION_INFO_EXPIRES_MONTHS = 6;
static char *USER_AGENT_STR = "Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111106 IceCat/7.0.1";
//Helper function
static int getMaxProgress(void)
{
int counter = MIN_CONNSCORE + 2;
for(int i = 0; update_mirrors_prim[i]; i++) counter++;
for(int i = 0; update_mirrors_back[i]; i++) counter++;
return counter;
}
////////////////////////////////////////////////////////////
// Update Info Class
////////////////////////////////////////////////////////////
UpdateInfo::UpdateInfo(void)
{
resetInfo();
}
void UpdateInfo::resetInfo(void)
{
m_buildNo = 0;
m_buildDate.setDate(1900, 1, 1);
m_downloadSite.clear();
m_downloadAddress.clear();
m_downloadFilename.clear();
m_downloadFilecode.clear();
}
////////////////////////////////////////////////////////////
// Constructor & Destructor
////////////////////////////////////////////////////////////
UpdateCheckThread::UpdateCheckThread(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const bool betaUpdates, const bool testMode)
:
m_updateInfo(new UpdateInfo()),
m_binaryWGet(binWGet),
m_binaryGnuPG(binGnuPG),
m_binaryKeys(binKeys),
m_betaUpdates(betaUpdates),
m_testMode(testMode),
m_maxProgress(getMaxProgress())
{
m_success = false;
m_status = UpdateStatus_NotStartedYet;
m_progress = 0;
if(m_binaryWGet.isEmpty() || m_binaryGnuPG.isEmpty() || m_binaryKeys.isEmpty())
{
THROW("Tools not initialized correctly!");
}
}
UpdateCheckThread::~UpdateCheckThread(void)
{
delete m_updateInfo;
}
////////////////////////////////////////////////////////////
// Protected functions
////////////////////////////////////////////////////////////
void UpdateCheckThread::run(void)
{
qDebug("Update checker thread started!");
try
{
m_testMode ? testKnownHosts() : checkForUpdates();
}
catch(const std::exception &error)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
x264_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
catch(...)
{
fflush(stdout); fflush(stderr);
fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
x264_fatal_exit(L"Unhandeled C++ exception error, application will exit!");
}
qDebug("Update checker thread completed.");
}
void UpdateCheckThread::checkForUpdates(void)
{
// ----- Initialization ----- //
m_success = false;
m_updateInfo->resetInfo();
setProgress(0);
// ----- Test Internet Connection ----- //
int connectionScore = 0;
int maxConnectTries = (3 * MIN_CONNSCORE) / 2;
log("Checking internet connection...");
setStatus(UpdateStatus_CheckingConnection);
const int networkStatus = x264_network_status();
if(networkStatus == x264_network_non)
{
log("", "Operating system reports that the computer is currently offline !!!");
setProgress(m_maxProgress);
setStatus(UpdateStatus_ErrorNoConnection);
return;
}
setProgress(1);
// ----- Test Known Hosts Connectivity ----- //
QStringList hostList;
for(int i = 0; known_hosts[i]; i++)
{
hostList << QString::fromLatin1(known_hosts[i]);
}
x264_seed_rand();
while(!(hostList.isEmpty() || (connectionScore >= MIN_CONNSCORE) || (maxConnectTries < 1)))
{
switch(tryContactHost(hostList.takeAt(x264_rand() % hostList.count())))
{
case 01: connectionScore += 1; break;
case 02: connectionScore += 2; break;
default: maxConnectTries -= 1; break;
}
setProgress(qBound(1, connectionScore + 1, MIN_CONNSCORE + 1));
x264_sleep(64);
}
if(connectionScore < MIN_CONNSCORE)
{
log("", "Connectivity test has failed: Internet connection appears to be broken!");
setProgress(m_maxProgress);
setStatus(UpdateStatus_ErrorConnectionTestFailed);
return;
}
// ----- Build Mirror List ----- //
log("", "----", "", "Checking for updates online...");
setStatus(UpdateStatus_FetchingUpdates);
QStringList mirrorList;
for(int index = 0; update_mirrors_prim[index]; index++)
{
mirrorList << QString::fromLatin1(update_mirrors_prim[index]);
}
x264_seed_rand();
if(const int len = mirrorList.count())
{
const int rounds = len * 1097;
for(int i = 0; i < rounds; i++)
{
mirrorList.swap(i % len, x264_rand() % len);
}
}
for(int index = 0; update_mirrors_back[index]; index++)
{
mirrorList << QString::fromLatin1(update_mirrors_back[index]);
}
// ----- Fetch Update Info From Server ----- //
while(!mirrorList.isEmpty())
{
QString currentMirror = mirrorList.takeFirst();
setProgress(m_progress + 1);
if(!m_success)
{
if(tryUpdateMirror(m_updateInfo, currentMirror))
{
m_success = true;
}
}
else
{
x264_sleep(64);
}
}
setProgress(m_maxProgress);
if(m_success)
{
if(m_updateInfo->m_buildNo > x264_version_build())
{
setStatus(UpdateStatus_CompletedUpdateAvailable);
}
else if(m_updateInfo->m_buildNo == x264_version_build())
{
setStatus(UpdateStatus_CompletedNoUpdates);
}
else
{
setStatus(UpdateStatus_CompletedNewVersionOlder);
}
}
else
{
setStatus(UpdateStatus_ErrorFetchUpdateInfo);
}
}
void UpdateCheckThread::testKnownHosts(void)
{
QStringList hostList;
for(int i = 0; known_hosts[i]; i++)
{
hostList << QString::fromLatin1(known_hosts[i]);
}
qDebug("\n[Known Hosts]");
log("Testing all known hosts...", "", "---");
int hostCount = hostList.count();
while(!hostList.isEmpty())
{
QString currentHost = hostList.takeFirst();
qDebug("Testing: %s", currentHost.toLatin1().constData());
log("", "Testing:", currentHost, "");
QString outFile = QString("%1/%2.htm").arg(x264_temp_directory(), x264_rand_str());
bool httpOk = false;
if(!getFile(currentHost, outFile, 0, &httpOk))
{
if(httpOk)
{
qWarning("\nConnectivity test was SLOW on the following site:\n%s\n", currentHost.toLatin1().constData());
}
else
{
qWarning("\nConnectivity test FAILED on the following site:\n%s\n", currentHost.toLatin1().constData());
}
}
log("", "---");
QFile::remove(outFile);
}
}
////////////////////////////////////////////////////////////
// PRIVATE FUNCTIONS
////////////////////////////////////////////////////////////
void UpdateCheckThread::setStatus(const int status)
{
if(m_status != status)
{
m_status = status;
emit statusChanged(status);
}
}
void UpdateCheckThread::setProgress(const int progress)
{
if(m_progress != progress)
{
m_progress = progress;
emit progressChanged(progress);
}
}
void UpdateCheckThread::log(const QString &str1, const QString &str2, const QString &str3, const QString &str4)
{
if(!str1.isNull()) emit messageLogged(str1);
if(!str2.isNull()) emit messageLogged(str2);
if(!str3.isNull()) emit messageLogged(str3);
if(!str4.isNull()) emit messageLogged(str4);
}
int UpdateCheckThread::tryContactHost(const QString &url)
{
int result = -1; bool httpOkay = false;
const QString outFile = QString("%1/%2.htm").arg(x264_temp_directory(), x264_rand_str());
log("", "Testing host:", url);
if(getFile(url, outFile, 0, &httpOkay))
{
log("Connection to host was established successfully.");
result = 2;
}
else
{
if(httpOkay)
{
log("Connection to host timed out after HTTP OK was received.");
result = 1;
}
else
{
log("Connection failed: The host could not be reached!");
result = 0;
}
}
QFile::remove(outFile);
return result;
}
bool UpdateCheckThread::tryUpdateMirror(UpdateInfo *updateInfo, const QString &url)
{
bool success = false;
log("", "Trying mirror:", url);
const QString randPart = x264_rand_str();
const QString outFileVers = QString("%1/%2.ver").arg(x264_temp_directory(), randPart);
const QString outFileSign = QString("%1/%2.sig").arg(x264_temp_directory(), randPart);
if(getUpdateInfo(url, outFileVers, outFileSign))
{
log("", "Download okay, checking signature:");
if(checkSignature(outFileVers, outFileSign))
{
log("", "Signature okay, parsing info:");
success = parseVersionInfo(outFileVers, updateInfo);
}
else
{
log("", "Bad signature, take care!");
}
}
else
{
log("", "Download has failed!");
}
QFile::remove(outFileVers);
QFile::remove(outFileSign);
return success;
}
bool UpdateCheckThread::getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign)
{
log("", "Downloading update info:");
if(!getFile(QString("%1%2" ).arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileVers))
{
return false;
}
log("", "Downloading signature:");
if(!getFile(QString("%1%2.sig").arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileSign))
{
return false;
}
return true;
}
bool UpdateCheckThread::getFile(const QString &url, const QString &outFile, unsigned int maxRedir, bool *httpOk)
{
QFileInfo output(outFile);
output.setCaching(false);
if(httpOk) *httpOk = false;
if(output.exists())
{
QFile::remove(output.canonicalFilePath());
if(output.exists())
{
return false;
}
}
QProcess process;
x264_init_process(process, output.absolutePath());
QStringList args;
args << "-T" << "15" << "--no-cache" << "--no-dns-cache" << QString().sprintf("--max-redirect=%u", maxRedir);
args << QString("--referer=%1://%2/").arg(QUrl(url).scheme(), QUrl(url).host()) << "-U" << USER_AGENT_STR;
args << "-O" << output.fileName() << url;
QEventLoop loop;
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit()));
connect(&process, SIGNAL(readyRead()), &loop, SLOT(quit()));
QTimer timer;
timer.setSingleShot(true);
timer.setInterval(25000);
connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
const QRegExp httpResponseOK("200 OK$");
process.start(m_binaryWGet, args);
if(!process.waitForStarted())
{
return false;
}
timer.start();
while(process.state() != QProcess::NotRunning)
{
loop.exec();
const bool bTimeOut = (!timer.isActive());
while(process.canReadLine())
{
QString line = QString::fromLatin1(process.readLine()).simplified();
if(line.contains(httpResponseOK))
{
line.append(" [OK]");
if(httpOk) *httpOk = true;
}
log(line);
}
if(bTimeOut)
{
qWarning("WGet process timed out <-- killing!");
process.kill();
process.waitForFinished();
log("!!! TIMEOUT !!!");
return false;
}
}
timer.stop();
timer.disconnect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
log(QString().sprintf("Exited with code %d", process.exitCode()));
return (process.exitCode() == 0) && output.exists() && output.isFile();
}
bool UpdateCheckThread::checkSignature(const QString &file, const QString &signature)
{
if(QFileInfo(file).absolutePath().compare(QFileInfo(signature).absolutePath(), Qt::CaseInsensitive) != 0)
{
qWarning("CheckSignature: File and signature should be in same folder!");
return false;
}
if(QFileInfo(file).absolutePath().compare(QFileInfo(m_binaryKeys).absolutePath(), Qt::CaseInsensitive) != 0)
{
qWarning("CheckSignature: File and keyring should be in same folder!");
return false;
}
QProcess process;
x264_init_process(process, QFileInfo(file).absolutePath());
QEventLoop loop;
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit()));
connect(&process, SIGNAL(readyRead()), &loop, SLOT(quit()));
process.start(m_binaryGnuPG, QStringList() << "--homedir" << "." << "--keyring" << QFileInfo(m_binaryKeys).fileName() << QFileInfo(signature).fileName() << QFileInfo(file).fileName());
if(!process.waitForStarted())
{
return false;
}
while(process.state() == QProcess::Running)
{
loop.exec();
while(process.canReadLine())
{
log(QString::fromLatin1(process.readLine()).simplified());
}
}
log(QString().sprintf("Exited with code %d", process.exitCode()));
return (process.exitCode() == 0);
}
bool UpdateCheckThread::parseVersionInfo(const QString &file, UpdateInfo *updateInfo)
{
QRegExp value("^(\\w+)=(.+)$");
QRegExp section("^\\[(.+)\\]$");
QDate updateInfoDate;
updateInfo->resetInfo();
QFile data(file);
if(!data.open(QIODevice::ReadOnly))
{
qWarning("Cannot open update info file for reading!");
return false;
}
bool inHeader = false;
bool inSection = false;
while(!data.atEnd())
{
QString line = QString::fromLatin1(data.readLine()).trimmed();
if(section.indexIn(line) >= 0)
{
log(QString("Sec: [%1]").arg(section.cap(1)));
inSection = (section.cap(1).compare(section_id, Qt::CaseInsensitive) == 0);
inHeader = (section.cap(1).compare(header_id, Qt::CaseInsensitive) == 0);
continue;
}
if(inSection && (value.indexIn(line) >= 0))
{
log(QString("Val: '%1' ==> '%2").arg(value.cap(1), value.cap(2)));
if(value.cap(1).compare("BuildNo", Qt::CaseInsensitive) == 0)
{
bool ok = false;
unsigned int temp = value.cap(2).toUInt(&ok);
if(ok) updateInfo->m_buildNo = temp;
}
else if(value.cap(1).compare("BuildDate", Qt::CaseInsensitive) == 0)
{
QDate temp = QDate::fromString(value.cap(2).trimmed(), Qt::ISODate);
if(temp.isValid()) updateInfo->m_buildDate = temp;
}
else if(value.cap(1).compare("DownloadSite", Qt::CaseInsensitive) == 0)
{
updateInfo->m_downloadSite = value.cap(2).trimmed();
}
else if(value.cap(1).compare("DownloadAddress", Qt::CaseInsensitive) == 0)
{
updateInfo->m_downloadAddress = value.cap(2).trimmed();
}
else if(value.cap(1).compare("DownloadFilename", Qt::CaseInsensitive) == 0)
{
updateInfo->m_downloadFilename = value.cap(2).trimmed();
}
else if(value.cap(1).compare("DownloadFilecode", Qt::CaseInsensitive) == 0)
{
updateInfo->m_downloadFilecode = value.cap(2).trimmed();
}
}
if(inHeader && (value.indexIn(line) >= 0))
{
log(QString("Val: '%1' ==> '%2").arg(value.cap(1), value.cap(2)));
if(value.cap(1).compare("TimestampCreated", Qt::CaseInsensitive) == 0)
{
QDate temp = QDate::fromString(value.cap(2).trimmed(), Qt::ISODate);
if(temp.isValid()) updateInfoDate = temp;
}
}
}
if(!updateInfoDate.isValid())
{
updateInfo->resetInfo();
log("WARNING: Version info timestamp is missing!");
return false;
}
else if(updateInfoDate.addMonths(VERSION_INFO_EXPIRES_MONTHS) < x264_current_date_safe())
{
updateInfo->resetInfo();
log(QString::fromLatin1("WARNING: This version info has expired at %1!").arg(updateInfoDate.addMonths(VERSION_INFO_EXPIRES_MONTHS).toString(Qt::ISODate)));
return false;
}
else if(x264_current_date_safe() < updateInfoDate)
{
log("Version info is from the future, take care!");
qWarning("Version info is from the future, take care!");
}
bool complete = true;
if(!(updateInfo->m_buildNo > 0)) complete = false;
if(!(updateInfo->m_buildDate.year() >= 2010)) complete = false;
if(updateInfo->m_downloadSite.isEmpty()) complete = false;
if(updateInfo->m_downloadAddress.isEmpty()) complete = false;
if(updateInfo->m_downloadFilename.isEmpty()) complete = false;
if(updateInfo->m_downloadFilecode.isEmpty()) complete = false;
if(!complete)
{
log("WARNING: Version info is incomplete!");
}
return complete;
}
////////////////////////////////////////////////////////////
// SLOTS
////////////////////////////////////////////////////////////
/*NONE*/
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
/*NONE*/

View File

@ -1,109 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QThread>
#include <QDate>
///////////////////////////////////////////////////////////////////////////////
class UpdateInfo
{
public:
UpdateInfo(void);
void resetInfo(void);
unsigned int m_buildNo;
QDate m_buildDate;
QString m_downloadSite;
QString m_downloadAddress;
QString m_downloadFilename;
QString m_downloadFilecode;
};
///////////////////////////////////////////////////////////////////////////////
class UpdateCheckThread : public QThread
{
Q_OBJECT
public:
enum
{
UpdateStatus_NotStartedYet = 0,
UpdateStatus_CheckingConnection = 1,
UpdateStatus_FetchingUpdates = 2,
UpdateStatus_CompletedUpdateAvailable = 3,
UpdateStatus_CompletedNoUpdates = 4,
UpdateStatus_CompletedNewVersionOlder = 5,
UpdateStatus_ErrorNoConnection = 6,
UpdateStatus_ErrorConnectionTestFailed = 7,
UpdateStatus_ErrorFetchUpdateInfo = 8
}
update_status_t;
UpdateCheckThread(const QString &binWGet, const QString &binGnuPG, const QString &binKeys, const bool betaUpdates, const bool testMode = false);
~UpdateCheckThread(void);
const int getUpdateStatus(void) const { return m_status; }
const bool getSuccess(void) const { return m_success; };
const int getMaximumProgress(void) const { return m_maxProgress; };
const int getCurrentProgress(void) const { return m_progress; };
const UpdateInfo *getUpdateInfo(void) const { return m_updateInfo; }
protected:
void run(void);
void checkForUpdates(void);
void testKnownHosts(void);
signals:
void statusChanged(const int status);
void progressChanged(const int progress);
void messageLogged(const QString &text);
private:
const int m_maxProgress;
UpdateInfo *const m_updateInfo;
const bool m_betaUpdates;
const bool m_testMode;
const QString m_binaryWGet;
const QString m_binaryGnuPG;
const QString m_binaryKeys;
volatile bool m_success;
int m_status;
int m_progress;
inline void setStatus(const int status);
inline void setProgress(const int progress);
inline void log(const QString &str1, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString());
bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5, bool *httpOk = NULL);
bool getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign);
int tryContactHost(const QString &url);
bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
bool checkSignature(const QString &file, const QString &signature);
bool parseVersionInfo(const QString &file, UpdateInfo *updateInfo);
};

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 4
#define VER_X264_PATCH 6
#define VER_X264_BUILD 907
#define VER_X264_BUILD 911
#define VER_X264_PORTABLE_EDITION (0)

View File

@ -35,6 +35,7 @@
#include "thread_avisynth.h"
#include "thread_vapoursynth.h"
#include "thread_encode.h"
#include "thread_ipc_recv.h"
#include "taskbar7.h"
#include "input_filter.h"
#include "win_addJob.h"
@ -47,6 +48,7 @@
//MUtils
#include <MUtils/OSSupport.h>
#include <MUtils/CPUFeatures.h>
#include <MUtils/IPCChannel.h>
//Qt
#include <QDate>
@ -93,9 +95,9 @@ static const int vsynth_rev = 24;
/*
* Constructor
*/
MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel)
:
m_ipc(NULL),
m_ipcChannel(ipcChannel),
m_sysinfo(NULL),
m_options(NULL),
m_jobList(NULL),
@ -103,7 +105,6 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
m_preferences(NULL),
m_recentlyUsed(NULL),
m_initialized(false),
m_sysTray(new QSystemTrayIcon(this)),
ui(new Ui::MainWindow())
{
//Init the dialog, from the .ui file
@ -116,23 +117,23 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
qRegisterMetaType<JobStatus>("JobStatus");
//Create and initialize the sysinfo object
m_sysinfo = new SysinfoModel();
m_sysinfo.reset(new SysinfoModel());
m_sysinfo->setAppPath(QApplication::applicationDirPath());
m_sysinfo->setMMXSupport(cpuFeatures.features && MUtils::CPUFetaures::FLAG_MMX);
m_sysinfo->setSSESupport(cpuFeatures.features && MUtils::CPUFetaures::FLAG_SSE); //SSE implies MMX2
m_sysinfo->setX64Support(cpuFeatures.x64 && (cpuFeatures.features && MUtils::CPUFetaures::FLAG_SSE2)); //X64 implies SSE2
//Load preferences
m_preferences = new PreferencesModel();
PreferencesModel::loadPreferences(m_preferences);
m_preferences.reset(new PreferencesModel());
PreferencesModel::loadPreferences(m_preferences.data());
//Load recently used
m_recentlyUsed = new RecentlyUsed();
RecentlyUsed::loadRecentlyUsed(m_recentlyUsed);
m_recentlyUsed.reset(new RecentlyUsed());
RecentlyUsed::loadRecentlyUsed(m_recentlyUsed.data());
//Create options object
m_options = new OptionsModel(m_sysinfo);
OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last));
m_options.reset(new OptionsModel(m_sysinfo.data()));
OptionsModel::loadTemplate(m_options.data(), QString::fromLatin1(tpl_last));
//Freeze minimum size
setMinimumSize(size());
@ -152,9 +153,9 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
}
//Create model
m_jobList = new JobListModel(m_preferences);
connect(m_jobList, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(jobChangedData(QModelIndex, QModelIndex)));
ui->jobsView->setModel(m_jobList);
m_jobList.reset(new JobListModel(m_preferences.data()));
connect(m_jobList.data(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(jobChangedData(QModelIndex, QModelIndex)));
ui->jobsView->setModel(m_jobList.data());
//Setup view
ui->jobsView->horizontalHeader()->setSectionHidden(3, true);
@ -167,16 +168,16 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
connect(ui->jobsView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(jobSelected(QModelIndex, QModelIndex)));
//Setup key listener
m_inputFilter_jobList = new InputEventFilter(ui->jobsView);
m_inputFilter_jobList.reset(new InputEventFilter(ui->jobsView));
m_inputFilter_jobList->addKeyFilter(Qt::ControlModifier | Qt::Key_Up, 1);
m_inputFilter_jobList->addKeyFilter(Qt::ControlModifier | Qt::Key_Down, 2);
connect(m_inputFilter_jobList, SIGNAL(keyPressed(int)), this, SLOT(jobListKeyPressed(int)));
connect(m_inputFilter_jobList.data(), SIGNAL(keyPressed(int)), this, SLOT(jobListKeyPressed(int)));
//Setup mouse listener
m_inputFilter_version = new InputEventFilter(ui->labelBuildDate);
m_inputFilter_version.reset(new InputEventFilter(ui->labelBuildDate));
m_inputFilter_version->addMouseFilter(Qt::LeftButton, 0);
m_inputFilter_version->addMouseFilter(Qt::RightButton, 0);
connect(m_inputFilter_version, SIGNAL(mouseClicked(int)), this, SLOT(versionLabelMouseClicked(int)));
connect(m_inputFilter_version.data(), SIGNAL(mouseClicked(int)), this, SLOT(versionLabelMouseClicked(int)));
//Create context menu
QAction *actionClipboard = new QAction(QIcon(":/buttons/page_paste.png"), tr("Copy to Clipboard"), ui->logView);
@ -227,7 +228,7 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
SETUP_WEBLINK(ui->actionWebSecret, "http://www.youtube.com/watch_popup?v=AXIeHY-OYNI");
//Create floating label
m_label = new QLabel(ui->jobsView->viewport());
m_label.reset(new QLabel(ui->jobsView->viewport()));
m_label->setText(tr("No job created yet. Please click the 'Add New Job' button!"));
m_label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
SET_TEXT_COLOR(m_label, Qt::darkGray);
@ -239,25 +240,26 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
updateLabelPos();
//Init system tray icon
m_sysTray.reset(new QSystemTrayIcon(this));
m_sysTray->setToolTip(this->windowTitle());
m_sysTray->setIcon(this->windowIcon());
connect(m_sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActived()));
connect(m_sysTray.data(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActived()));
//Create corner widget
QLabel *checkUp = new QLabel(ui->menubar);
checkUp->setText(QString("<nobr><img src=\":/buttons/exclamation_small.png\">&nbsp;<b style=\"color:darkred\">%1</b>&nbsp;&nbsp;&nbsp;</nobr>").arg(tr("Check for Updates")));
checkUp->setFixedHeight(ui->menubar->height());
checkUp->setCursor(QCursor(Qt::PointingHandCursor));
m_inputFilter_checkUp = new InputEventFilter(checkUp);
m_inputFilter_checkUp.reset(new InputEventFilter(checkUp));
m_inputFilter_checkUp->addMouseFilter(Qt::LeftButton, 0);
m_inputFilter_checkUp->addMouseFilter(Qt::RightButton, 0);
connect(m_inputFilter_checkUp, SIGNAL(mouseClicked(int)), this, SLOT(checkUpdates()));
connect(m_inputFilter_checkUp.data(), SIGNAL(mouseClicked(int)), this, SLOT(checkUpdates()));
checkUp->hide();
ui->menubar->setCornerWidget(checkUp);
//Create timer
m_fileTimer = new QTimer(this);
connect(m_fileTimer, SIGNAL(timeout()), this, SLOT(handlePendingFiles()));
m_fileTimer.reset(new QTimer(this));
connect(m_fileTimer.data(), SIGNAL(timeout()), this, SLOT(handlePendingFiles()));
}
/*
@ -265,37 +267,27 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures)
*/
MainWindow::~MainWindow(void)
{
OptionsModel::saveTemplate(m_options, QString::fromLatin1(tpl_last));
OptionsModel::saveTemplate(m_options.data(), QString::fromLatin1(tpl_last));
X264_DELETE(m_jobList);
X264_DELETE(m_options);
X264_DELETE(m_pendingFiles);
X264_DELETE(m_label);
X264_DELETE(m_inputFilter_jobList);
X264_DELETE(m_inputFilter_version);
X264_DELETE(m_inputFilter_checkUp);
while(!m_toolsList.isEmpty())
while(!m_toolsList->isEmpty())
{
QFile *temp = m_toolsList.takeFirst();
QFile *temp = m_toolsList->takeFirst();
X264_DELETE(temp);
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//if(m_ipc->isListening())
//{
// m_ipc->stopListening();
//}
X264_DELETE(m_preferences);
X264_DELETE(m_recentlyUsed);
X264_DELETE(m_sysinfo);
X264_DELETE(m_fileTimer);
if(!m_ipcThread.isNull())
{
m_ipcThread->stop();
if(!m_ipcThread->wait(5000))
{
m_ipcThread->terminate();
m_ipcThread->wait();
}
}
VapourSynthCheckThread::unload();
AvisynthCheckThread::unload();
delete m_sysTray;
delete ui;
}
@ -314,9 +306,9 @@ void MainWindow::addButtonPressed()
bool runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
QString sourceFileName, outputFileName;
if(createJob(sourceFileName, outputFileName, m_options, runImmediately))
if(createJob(sourceFileName, outputFileName, m_options.data(), runImmediately))
{
appendJob(sourceFileName, outputFileName, m_options, runImmediately);
appendJob(sourceFileName, outputFileName, m_options.data(), runImmediately);
}
}
@ -339,9 +331,9 @@ void MainWindow::openActionTriggered()
{
bool runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
QString sourceFileName(fileList.first()), outputFileName;
if(createJob(sourceFileName, outputFileName, m_options, runImmediately))
if(createJob(sourceFileName, outputFileName, m_options.data(), runImmediately))
{
appendJob(sourceFileName, outputFileName, m_options, runImmediately);
appendJob(sourceFileName, outputFileName, m_options.data(), runImmediately);
}
}
}
@ -610,7 +602,7 @@ void MainWindow::showPreferences(void)
{
ENSURE_APP_IS_READY();
PreferencesDialog *preferences = new PreferencesDialog(this, m_preferences, m_sysinfo);
PreferencesDialog *preferences = new PreferencesDialog(this, m_preferences.data(), m_sysinfo.data());
preferences->exec();
X264_DELETE(preferences);
@ -766,17 +758,6 @@ void MainWindow::init(void)
updateLabelPos();
const MUtils::OS::ArgumentMap &arguments = MUtils::OS::arguments();
//---------------------------------------
// Create the IPC listener thread
//---------------------------------------
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//if(m_ipc->isInitialized())
//{
// connect(m_ipc, SIGNAL(receivedCommand(int,QStringList,quint32)), this, SLOT(handleCommand(int,QStringList,quint32)), Qt::QueuedConnection);
// m_ipc->startListening();
//}
//---------------------------------------
// Check required binaries
//---------------------------------------
@ -788,10 +769,10 @@ void MainWindow::init(void)
{
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_LoBit; varnt <= OptionsModel::EncVariant_HiBit; NEXT(varnt))
{
binFiles << ENC_BINARY(m_sysinfo, encdr, arch, varnt);
binFiles << ENC_BINARY(m_sysinfo.data(), encdr, arch, varnt);
}
}
binFiles << AVS_BINARY(m_sysinfo, arch == OptionsModel::EncArch_x64);
binFiles << AVS_BINARY(m_sysinfo.data(), arch == OptionsModel::EncArch_x64);
}
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
{
@ -816,7 +797,11 @@ void MainWindow::init(void)
X264_DELETE(file);
INIT_ERROR_EXIT();
}
m_toolsList << file;
if(m_toolsList.isNull())
{
m_toolsList.reset(new QFileList());
}
m_toolsList->append(file);
}
else
{
@ -921,7 +906,7 @@ void MainWindow::init(void)
if(val == 1)
{
m_preferences->setDisableWarnings(true);
PreferencesModel::savePreferences(m_preferences);
PreferencesModel::savePreferences(m_preferences.data());
}
}
@ -963,13 +948,13 @@ void MainWindow::init(void)
if(val == 1)
{
m_preferences->setDisableWarnings(true);
PreferencesModel::savePreferences(m_preferences);
PreferencesModel::savePreferences(m_preferences.data());
}
}
}
qDebug(" ");
}
//---------------------------------------
// Finish initialization
//---------------------------------------
@ -1019,7 +1004,7 @@ void MainWindow::init(void)
{
qWarning("First run -> resetting update check now!");
m_recentlyUsed->setLastUpdateCheck(0);
RecentlyUsed::saveRecentlyUsed(m_recentlyUsed);
RecentlyUsed::saveRecentlyUsed(m_recentlyUsed.data());
}
else if(m_recentlyUsed->lastUpdateCheck() + 14 < x264_current_date_safe().toJulianDay())
{
@ -1035,8 +1020,19 @@ void MainWindow::init(void)
}
}
//---------------------------------------
// Create the IPC listener thread
//---------------------------------------
if(m_ipcChannel)
{
m_ipcThread.reset(new IPCThread_Recv(m_ipcChannel));
connect(m_ipcThread.data(), SIGNAL(receivedCommand(int,QStringList,quint32)), this, SLOT(handleCommand(int,QStringList,quint32)), Qt::QueuedConnection);
m_ipcThread->start();
}
//Load queued jobs
if(m_jobList->loadQueuedJobs(m_sysinfo) > 0)
if(m_jobList->loadQueuedJobs(m_sysinfo.data()) > 0)
{
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
m_jobList->clearQueuedJobs();
@ -1141,7 +1137,7 @@ void MainWindow::handleCommand(const int &command, const QStringList &args, cons
{
if(QFileInfo(args[0]).exists() && QFileInfo(args[0]).isFile())
{
OptionsModel options(m_sysinfo);
OptionsModel options(m_sysinfo.data());
bool runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
if(!(args[2].isEmpty() || X264_STRCMP(args[2], "-")))
{
@ -1178,13 +1174,13 @@ void MainWindow::checkUpdates(void)
return;
}
UpdaterDialog *updater = new UpdaterDialog(this, m_sysinfo, update_url);
UpdaterDialog *updater = new UpdaterDialog(this, m_sysinfo.data(), update_url);
const int ret = updater->exec();
if(updater->getSuccess())
{
m_recentlyUsed->setLastUpdateCheck(x264_current_date_safe().toJulianDay());
RecentlyUsed::saveRecentlyUsed(m_recentlyUsed);
RecentlyUsed::saveRecentlyUsed(m_recentlyUsed.data());
if(QWidget *cornerWidget = ui->menubar->cornerWidget()) cornerWidget->hide();
}
@ -1273,7 +1269,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
if(QMessageBox::warning(this, tr("Jobs Are Running"), tr("<nobr>You still have running jobs, application will be minimized to notification area!<nobr>"), tr("OK"), tr("Don't Show Again")) == 1)
{
m_preferences->setNoSystrayWarning(true);
PreferencesModel::savePreferences(m_preferences);
PreferencesModel::savePreferences(m_preferences.data());
}
}
hide();
@ -1400,7 +1396,7 @@ void MainWindow::dropEvent(QDropEvent *event)
bool MainWindow::createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart, int fileNo, int fileTotal, bool *applyToAll)
{
bool okay = false;
AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed, m_sysinfo, m_preferences);
AddJobDialog *addDialog = new AddJobDialog(this, options, m_recentlyUsed.data(), m_sysinfo.data(), m_preferences.data());
addDialog->setRunImmediately(runImmediately);
if(!sourceFileName.isEmpty()) addDialog->setSourceFile(sourceFileName);
@ -1445,9 +1441,9 @@ bool MainWindow::createJobMultiple(const QStringList &filePathIn)
{
runImmediately = (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
QString sourceFileName(*iter), outputFileName;
if(createJob(sourceFileName, outputFileName, m_options, runImmediately, false, counter++, filePathIn.count(), &applyToAll))
if(createJob(sourceFileName, outputFileName, m_options.data(), runImmediately, false, counter++, filePathIn.count(), &applyToAll))
{
if(appendJob(sourceFileName, outputFileName, m_options, runImmediately))
if(appendJob(sourceFileName, outputFileName, m_options.data(), runImmediately))
{
continue;
}
@ -1461,7 +1457,7 @@ bool MainWindow::createJobMultiple(const QStringList &filePathIn)
const bool runImmediatelyTmp = runImmediately && (countRunningJobs() < (m_preferences->getAutoRunNextJob() ? m_preferences->getMaxRunningJobCount() : 1));
const QString sourceFileName = *iter;
const QString outputFileName = AddJobDialog::generateOutputFileName(sourceFileName, m_recentlyUsed->outputDirectory(), m_recentlyUsed->filterIndex(), m_preferences->getSaveToSourcePath());
if(!appendJob(sourceFileName, outputFileName, m_options, runImmediatelyTmp))
if(!appendJob(sourceFileName, outputFileName, m_options.data(), runImmediatelyTmp))
{
return false;
}
@ -1477,7 +1473,7 @@ bool MainWindow::createJobMultiple(const QStringList &filePathIn)
bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately)
{
bool okay = false;
EncodeThread *thrd = new EncodeThread(sourceFileName, outputFileName, options, m_sysinfo, m_preferences);
EncodeThread *thrd = new EncodeThread(sourceFileName, outputFileName, options, m_sysinfo.data(), m_preferences.data());
QModelIndex newIndex = m_jobList->insertJob(thrd);
if(newIndex.isValid())

View File

@ -27,7 +27,6 @@
//Qt
#include <QMainWindow>
class IPC;
class JobListModel;
class OptionsModel;
class SysinfoModel;
@ -39,6 +38,7 @@ class InputEventFilter;
class QModelIndex;
class QLabel;
class QSystemTrayIcon;
class IPCThread_Recv;
enum JobStatus;
namespace Ui
@ -50,9 +50,11 @@ namespace MUtils
{
namespace CPUFetaures
{
struct _stuctName;
struct _cpu_info_t;
typedef struct _cpu_info_t cpu_info_t;
}
class IPCChannel;
}
class MainWindow: public QMainWindow
@ -60,9 +62,11 @@ class MainWindow: public QMainWindow
Q_OBJECT
public:
MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures);
MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel);
~MainWindow(void);
typedef QList<QFile*> QFileList;
protected:
virtual void closeEvent(QCloseEvent *e);
virtual void showEvent(QShowEvent *e);
@ -75,24 +79,25 @@ private:
Ui::MainWindow *const ui;
bool m_initialized;
QLabel *m_label;
QTimer *m_fileTimer;
QScopedPointer<QLabel> m_label;
QScopedPointer<QTimer> m_fileTimer;
IPC *const m_ipc;
QSystemTrayIcon *const m_sysTray;
MUtils::IPCChannel *const m_ipcChannel;
QScopedPointer<IPCThread_Recv> m_ipcThread;
QScopedPointer<QSystemTrayIcon> m_sysTray;
InputEventFilter *m_inputFilter_jobList;
InputEventFilter *m_inputFilter_version;
InputEventFilter *m_inputFilter_checkUp;
QScopedPointer<InputEventFilter> m_inputFilter_jobList;
QScopedPointer<InputEventFilter> m_inputFilter_version;
QScopedPointer<InputEventFilter> m_inputFilter_checkUp;
JobListModel *m_jobList;
OptionsModel *m_options;
QStringList *m_pendingFiles;
QList<QFile*> m_toolsList;
QScopedPointer<JobListModel> m_jobList;
QScopedPointer<OptionsModel> m_options;
QScopedPointer<QStringList> m_pendingFiles;
QScopedPointer<QFileList> m_toolsList;
SysinfoModel *m_sysinfo;
PreferencesModel *m_preferences;
RecentlyUsed *m_recentlyUsed;
QScopedPointer<SysinfoModel> m_sysinfo;
QScopedPointer<PreferencesModel> m_preferences;
QScopedPointer<RecentlyUsed> m_recentlyUsed;
bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
bool createJobMultiple(const QStringList &filePathIn);

View File

@ -22,10 +22,13 @@
#include "win_updater.h"
#include "UIC_win_updater.h"
//Internal
#include "global.h"
#include "model_sysinfo.h"
#include "thread_updater.h"
#include "checksum.h"
//MUtils
#include <MUtils/UpdateChecker.h>
#include <MUtils/Hash_Blake2.h>
#include <QMovie>
#include <QCloseEvent>
@ -73,7 +76,7 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const
ui(new Ui::UpdaterDialog()),
m_sysinfo(sysinfo),
m_updateUrl(updateUrl),
m_status(UpdateCheckThread::UpdateStatus_NotStartedYet),
m_status(MUtils::UpdateChecker::UpdateStatus_NotStartedYet),
m_thread(NULL),
m_updaterProcess(NULL),
m_success(false),
@ -95,8 +98,8 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const
connect(ui->labelUrl, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
//Init animation
m_animator = new QMovie(":/images/loading.gif");
ui->labelLoadingCenter->setMovie(m_animator);
m_animator.reset(new QMovie(":/images/loading.gif"));
ui->labelLoadingCenter->setMovie(m_animator.data());
//Init buttons
ui->buttonCancel->setEnabled(false);
@ -109,25 +112,16 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const
UpdaterDialog::~UpdaterDialog(void)
{
if(m_thread)
if(!m_thread.isNull())
{
if(!m_thread->wait(1000))
if(!m_thread->wait(5000))
{
m_thread->terminate();
m_thread->wait();
}
}
if((!m_keysFile.isEmpty()) && QFile::exists(m_keysFile))
{
QFile::setPermissions(m_keysFile, QFile::ReadOwner | QFile::WriteOwner);
QFile::remove(m_keysFile);
m_keysFile.clear();
}
X264_DELETE(m_thread);
X264_DELETE(m_animator);
cleanFiles();
delete ui;
}
@ -192,6 +186,12 @@ void UpdaterDialog::keyPressEvent(QKeyEvent *event)
void UpdaterDialog::initUpdate(void)
{
//Clean up files from previous attempt
if(!m_binaries.isEmpty())
{
cleanFiles();
}
//Check binary files
QString wgetBin, gpgvBin;
if(!checkBinaries(wgetBin, gpgvBin))
@ -222,11 +222,11 @@ void UpdaterDialog::initUpdate(void)
//Create and setup thread
if(!m_thread)
{
m_thread = new UpdateCheckThread(wgetBin, gpgvBin, m_keysFile, false);
connect(m_thread, SIGNAL(statusChanged(int)), this, SLOT(threadStatusChanged(int)));
connect(m_thread, SIGNAL(finished()), this, SLOT(threadFinished()));
connect(m_thread, SIGNAL(terminated()), this, SLOT(threadFinished()));
connect(m_thread, SIGNAL(messageLogged(QString)), this, SLOT(threadMessageLogged(QString)));
m_thread.reset(new MUtils::UpdateChecker(m_binaries.value("wget.exe"), m_binaries.value("gpgv.exe"), m_binaries.value("gpgv.gpg"), "Simple x264 Launcher", x264_version_build(), false));
connect(m_thread.data(), SIGNAL(statusChanged(int)), this, SLOT(threadStatusChanged(int)));
connect(m_thread.data(), SIGNAL(finished()), this, SLOT(threadFinished()));
connect(m_thread.data(), SIGNAL(terminated()), this, SLOT(threadFinished()));
connect(m_thread.data(), SIGNAL(messageLogged(QString)), this, SLOT(threadMessageLogged(QString)));
}
//Begin updater run
@ -254,7 +254,7 @@ void UpdaterDialog::checkForUpdates(void)
ui->labelUrl->hide();
//Update status
threadStatusChanged(UpdateCheckThread::UpdateStatus_NotStartedYet);
threadStatusChanged(MUtils::UpdateChecker::UpdateStatus_NotStartedYet);
//Start animation
SHOW_ANIMATION(true);
@ -267,46 +267,46 @@ void UpdaterDialog::checkForUpdates(void)
m_logFile.clear();
//Start the updater thread
QTimer::singleShot(250, m_thread, SLOT(start()));
QTimer::singleShot(250, m_thread.data(), SLOT(start()));
}
void UpdaterDialog::threadStatusChanged(int status)
{
switch(m_status = status)
{
case UpdateCheckThread::UpdateStatus_NotStartedYet:
case MUtils::UpdateChecker::UpdateStatus_NotStartedYet:
UPDATE_ICON(1, "clock");
UPDATE_ICON(2, "clock");
UPDATE_ICON(3, "clock");
break;
case UpdateCheckThread::UpdateStatus_CheckingConnection:
case MUtils::UpdateChecker::UpdateStatus_CheckingConnection:
UPDATE_ICON(1, "play");
break;
case UpdateCheckThread::UpdateStatus_FetchingUpdates:
case MUtils::UpdateChecker::UpdateStatus_FetchingUpdates:
UPDATE_ICON(1, "shield_green");
UPDATE_TEXT(1, tr("Internet connection is working."));
UPDATE_ICON(2, "play");
break;
case UpdateCheckThread::UpdateStatus_ErrorNoConnection:
case MUtils::UpdateChecker::UpdateStatus_ErrorNoConnection:
UPDATE_ICON(1, "shield_error");
UPDATE_TEXT(1, tr("Computer is currently offline!"));
UPDATE_ICON(2, "shield_grey");
UPDATE_ICON(3, "shield_grey");
break;
case UpdateCheckThread::UpdateStatus_ErrorConnectionTestFailed:
case MUtils::UpdateChecker::UpdateStatus_ErrorConnectionTestFailed:
UPDATE_ICON(1, "shield_error");
UPDATE_TEXT(1, tr("Internet connectivity test failed!"));
UPDATE_ICON(2, "shield_grey");
UPDATE_ICON(3, "shield_grey");
break;
case UpdateCheckThread::UpdateStatus_ErrorFetchUpdateInfo:
case MUtils::UpdateChecker::UpdateStatus_ErrorFetchUpdateInfo:
UPDATE_ICON(2, "shield_error");
UPDATE_TEXT(2, tr("Failed to download the update information!"));
UPDATE_ICON(3, "shield_grey");
break;
case UpdateCheckThread::UpdateStatus_CompletedUpdateAvailable:
case UpdateCheckThread::UpdateStatus_CompletedNoUpdates:
case UpdateCheckThread::UpdateStatus_CompletedNewVersionOlder:
case MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable:
case MUtils::UpdateChecker::UpdateStatus_CompletedNoUpdates:
case MUtils::UpdateChecker::UpdateStatus_CompletedNewVersionOlder:
UPDATE_ICON(2, "shield_green");
UPDATE_TEXT(2, tr("Update information received successfully."));
UPDATE_ICON(3, "play");
@ -332,16 +332,16 @@ void UpdaterDialog::updateFinished(void)
{
switch(m_status)
{
case UpdateCheckThread::UpdateStatus_CompletedUpdateAvailable:
case MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable:
UPDATE_ICON(3, "shield_exclamation");
UPDATE_TEXT(3, tr("A newer version is available!"));
ui->buttonDownload->show();
break;
case UpdateCheckThread::UpdateStatus_CompletedNoUpdates:
case MUtils::UpdateChecker::UpdateStatus_CompletedNoUpdates:
UPDATE_ICON(3, "shield_green");
UPDATE_TEXT(3, tr("Your version is up-to-date."));
break;
case UpdateCheckThread::UpdateStatus_CompletedNewVersionOlder:
case MUtils::UpdateChecker::UpdateStatus_CompletedNewVersionOlder:
UPDATE_ICON(3, "shield_blue");
UPDATE_TEXT(3, tr("You are using a pre-release version!"));
break;
@ -353,16 +353,16 @@ void UpdaterDialog::updateFinished(void)
//Show update info or retry button
switch(m_status)
{
case UpdateCheckThread::UpdateStatus_CompletedUpdateAvailable:
case UpdateCheckThread::UpdateStatus_CompletedNoUpdates:
case UpdateCheckThread::UpdateStatus_CompletedNewVersionOlder:
case MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable:
case MUtils::UpdateChecker::UpdateStatus_CompletedNoUpdates:
case MUtils::UpdateChecker::UpdateStatus_CompletedNewVersionOlder:
SHOW_ANIMATION(false);
ui->labelBuildNo->setText(tr("Installed build is #%1 | Latest build is #%2").arg(QString::number(x264_version_build()), QString::number(m_thread->getUpdateInfo()->m_buildNo)));
ui->labelUrl->setText(QString("<a href=\"%1\">%1</a>").arg(m_thread->getUpdateInfo()->m_downloadSite));
ui->labelBuildNo->setText(tr("Installed build is #%1 | Latest build is #%2").arg(QString::number(x264_version_build()), QString::number(m_thread->getUpdateInfo()->getBuildNo())));
ui->labelUrl->setText(QString("<a href=\"%1\">%1</a>").arg(m_thread->getUpdateInfo()->getDownloadSite()));
break;
case UpdateCheckThread::UpdateStatus_ErrorNoConnection:
case UpdateCheckThread::UpdateStatus_ErrorConnectionTestFailed:
case UpdateCheckThread::UpdateStatus_ErrorFetchUpdateInfo:
case MUtils::UpdateChecker::UpdateStatus_ErrorNoConnection:
case MUtils::UpdateChecker::UpdateStatus_ErrorConnectionTestFailed:
case MUtils::UpdateChecker::UpdateStatus_ErrorFetchUpdateInfo:
m_animator->stop();
ui->buttonRetry->show();
break;
@ -399,7 +399,7 @@ void UpdaterDialog::installUpdate(void)
ui->buttonCancel->setEnabled(false);
SHOW_ANIMATION(true);
const UpdateInfo *updateInfo = m_thread->getUpdateInfo();
const MUtils::UpdateCheckerInfo *updateInfo = m_thread->getUpdateInfo();
QProcess process;
QStringList args;
@ -410,14 +410,14 @@ void UpdaterDialog::installUpdate(void)
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit()));
args << QString("/Location=%1").arg(updateInfo->m_downloadAddress);
args << QString("/Filename=%1").arg(updateInfo->m_downloadFilename);
args << QString("/TicketID=%1").arg(updateInfo->m_downloadFilecode);
args << QString("/Location=%1").arg(updateInfo->getDownloadAddress());
args << QString("/Filename=%1").arg(updateInfo->getDownloadFilename());
args << QString("/TicketID=%1").arg(updateInfo->getDownloadFilecode());
args << QString("/ToFolder=%1").arg(QDir::toNativeSeparators(QDir(QApplication::applicationDirPath()).canonicalPath()));
args << QString("/ToExFile=%1.exe").arg(QFileInfo(QFileInfo(QApplication::applicationFilePath()).canonicalFilePath()).completeBaseName());
args << QString("/AppTitle=Simple x264 Launcher (Build #%1)").arg(QString::number(updateInfo->m_buildNo));
args << QString("/AppTitle=Simple x264 Launcher (Build #%1)").arg(QString::number(updateInfo->getBuildNo()));
process.start(m_wupdFile, args);
process.start(m_binaries.value("wupd.exe"), args);
if(!process.waitForStarted())
{
QApplication::restoreOverrideCursor();
@ -456,47 +456,37 @@ void UpdaterDialog::installUpdate(void)
bool UpdaterDialog::checkBinaries(QString &wgetBin, QString &gpgvBin)
{
qDebug("[File Verification]");
QMap<QString, QString> binaries;
m_keysFile.clear();
m_wupdFile.clear();
wgetBin.clear();
gpgvBin.clear();
bool okay = true;
m_binaries.clear();
//Validate hashes first
const QString tempPath = MUtils::temp_folder();
for(size_t i = 0; BINARIES[i].name; i++)
{
const QString binPath = QString("%1/toolset/common/%2").arg(m_sysinfo->getAppPath(), QString::fromLatin1(BINARIES[i].name));
if(okay = okay && checkFileHash(binPath, BINARIES[i].hash))
const QString orgName = QString::fromLatin1(BINARIES[i].name);
const QString binPath = QString("%1/toolset/common/%2").arg(m_sysinfo->getAppPath(), orgName);
const QString outPath = QString("%1/%2_%3.%4").arg(tempPath, QFileInfo(orgName).baseName(), MUtils::rand_str(), QFileInfo(orgName).suffix());
if(!checkFileHash(binPath, BINARIES[i].hash))
{
binaries.insert(BINARIES[i].name, binPath);
qWarning("Verification of '%s' has failed!", MUTILS_UTF8(orgName));
return false;
}
if(!QFile::copy(binPath, outPath))
{
qWarning("Copying of '%s' has failed!", MUTILS_UTF8(orgName));
return false;
}
QFile::setPermissions(outPath, QFile::ReadOwner);
m_binaries.insert(BINARIES[i].name, outPath);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
if(okay)
{
wgetBin = binaries.value("wget.exe");
gpgvBin = binaries.value("gpgv.exe");
m_wupdFile = binaries.value("wupd.exe");
m_keysFile = QString("%1/%2.gpg").arg(x264_temp_directory(), x264_rand_str());
if(okay = QFile::copy(binaries.value("gpgv.gpg"), m_keysFile))
{
QFile::setPermissions(m_keysFile, QFile::ReadOwner);
}
qDebug("%s\n", okay ? "Completed." : "Failed to copy GPG file!");
}
return okay;
return true;
}
bool UpdaterDialog::checkFileHash(const QString &filePath, const char *expectedHash)
{
qDebug("Checking file: %s", filePath.toUtf8().constData());
QBlake2Checksum checksum2;
MUtils::Hash::Blake2 checksum2;
QFile file(filePath);
if(file.open(QIODevice::ReadOnly))
{
@ -516,3 +506,18 @@ bool UpdaterDialog::checkFileHash(const QString &filePath, const char *expectedH
return false;
}
}
void UpdaterDialog::cleanFiles(void)
{
const QStringList keys = m_binaries.keys();
foreach(const QString &key, keys)
{
const QString fileName = m_binaries.value(key);
QFile::setPermissions(fileName, QFile::ReadOwner | QFile::WriteOwner);
if(!QFile::remove(fileName))
{
qWarning("Failed to remove file: %s", MUTILS_UTF8(fileName));
}
m_binaries.remove(key);
}
}

View File

@ -22,9 +22,9 @@
#pragma once
#include <QDialog>
#include <QMap>
class QMovie;
class UpdateCheckThread;
class SysinfoModel;
namespace Ui
@ -32,6 +32,11 @@ namespace Ui
class UpdaterDialog;
}
namespace MUtils
{
class UpdateChecker;
}
class UpdaterDialog : public QDialog
{
Q_OBJECT
@ -74,6 +79,7 @@ private:
bool checkBinaries(QString &wgetBin, QString &gpgvBin);
bool checkFileHash(const QString &filePath, const char *expectedHash);
void cleanFiles(void);
const SysinfoModel *const m_sysinfo;
const char *const m_updateUrl;
@ -81,11 +87,11 @@ private:
bool m_firstShow;
bool m_success;
QMovie *m_animator;
UpdateCheckThread *m_thread;
QScopedPointer<QMovie> m_animator;
QScopedPointer<MUtils::UpdateChecker> m_thread;
unsigned long m_updaterProcess;
QStringList m_logFile;
QString m_keysFile;
QString m_wupdFile;
QMap<QString,QString> m_binaries;
int m_status;
};

View File

@ -266,6 +266,14 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\thread_ipc_recv.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="tmp\x264_launcher\UIC_win_about.h" />
<ClInclude Include="tmp\x264_launcher\UIC_win_addJob.h" />
<ClInclude Include="tmp\x264_launcher\UIC_win_editor.h" />
@ -331,9 +339,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
</CustomBuild>
<ClInclude Include="resource.h" />
<ClInclude Include="src\3rd_party\avisynth_c.h" />
<ClInclude Include="src\3rd_party\blake2.h" />
<ClInclude Include="src\binaries.h" />
<ClInclude Include="src\checksum.h" />
<ClInclude Include="src\cli.h" />
<ClInclude Include="src\encoder_abstract.h" />
<ClInclude Include="src\encoder_factory.h" />
@ -392,14 +398,6 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\thread_updater.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\tool_abstract.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
@ -419,9 +417,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\3rd_party\blake2.c" />
<ClCompile Include="src\binaries.cpp" />
<ClCompile Include="src\checksum.cpp" />
<ClCompile Include="src\encoder_abstract.cpp" />
<ClCompile Include="src\encoder_factory.cpp" />
<ClCompile Include="src\encoder_x264.cpp" />
@ -442,8 +438,8 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
<ClCompile Include="src\thread_encode.cpp" />
<ClCompile Include="src\global.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\thread_ipc_recv.cpp" />
<ClCompile Include="src\thread_ipc_send.cpp" />
<ClCompile Include="src\thread_updater.cpp" />
<ClCompile Include="src\thread_vapoursynth.cpp" />
<ClCompile Include="src\tool_abstract.cpp" />
<ClCompile Include="src\win_about.cpp" />
@ -459,8 +455,8 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
<ClCompile Include="tmp\x264_launcher\MOC_model_logFile.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_avisynth.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_encode.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_recv.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_send.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_updater.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_vapoursynth.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_tool_abstract.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_win_about.cpp" />

View File

@ -22,9 +22,6 @@
<Filter Include="Assembly">
<UniqueIdentifier>{2c9c8836-2259-4412-894e-7cc32bef99de}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\3rd Party">
<UniqueIdentifier>{d2b38527-adfe-4b94-bfa5-3b108540b99c}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\3rd Party">
<UniqueIdentifier>{96b6acbb-5482-407a-8c18-381ec99d13e5}</UniqueIdentifier>
</Filter>
@ -69,12 +66,6 @@
<ClInclude Include="src\3rd_party\avisynth_c.h">
<Filter>Header Files\3rd Party</Filter>
</ClInclude>
<ClInclude Include="src\3rd_party\blake2.h">
<Filter>Header Files\3rd Party</Filter>
</ClInclude>
<ClInclude Include="src\checksum.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\cli.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -129,7 +120,7 @@
<ClInclude Include="tmp\x264_launcher\UIC_win_updater.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="src\thread_ipc_send.h">
<ClInclude Include="src\thread_ipc_recv.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
@ -188,15 +179,6 @@
<ClCompile Include="src\win_updater.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\checksum.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\3rd_party\blake2.c">
<Filter>Source Files\3rd Party</Filter>
</ClCompile>
<ClCompile Include="src\thread_updater.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\binaries.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -245,12 +227,6 @@
<ClCompile Include="tmp\x264_launcher\MOC_thread_encode.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="tmp\x264_launcher\MOC_thread_updater.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="tmp\x264_launcher\MOC_thread_vapoursynth.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="tmp\x264_launcher\MOC_tool_abstract.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
@ -290,6 +266,15 @@
<ClCompile Include="tmp\x264_launcher\MOC_model_jobList.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="src\thread_ipc_recv.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_recv.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="tmp\x264_launcher\MOC_thread_vapoursynth.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\win_main.h">
@ -346,9 +331,6 @@
<CustomBuild Include="src\win_updater.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="src\thread_updater.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="src\tool_abstract.h">
<Filter>Header Files</Filter>
</CustomBuild>
@ -361,6 +343,9 @@
<CustomBuild Include="src\input_filter.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="src\thread_ipc_send.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="x264_launcher.rc">