#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Copyright (c) 2012, Tarek Galal <tarek@wazapp.im>

This file is part of Wazapp, an IM application for Meego Harmattan platform that
allows communication with Whatsapp users

Wazapp 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.

Wazapp 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 
Wazapp. If not, see http://www.gnu.org/licenses/.
'''
import os
import sys
from PySide.QtGui import QApplication
from wamanager import WAManager
from constants import WAConstants
from PySide import QtCore

#from waxmpp import WAXMPP
#from utilities import Utilities


	
if __name__ == "__main__":

	if os.path.isfile(WAConstants.STORE_PATH + "/log.txt"):
		os.rename(WAConstants.STORE_PATH +"/log.txt",WAConstants.STORE_PATH + "previews-log.txt")

	linuxCodec = QtCore.QTextCodec.codecForName("UTF-8")
	QtCore.QTextCodec.setCodecForTr(linuxCodec)
	QtCore.QTextCodec.setCodecForCStrings(linuxCodec)
	QtCore.QTextCodec.setCodecForLocale(linuxCodec)
	
	app = QApplication(sys.argv)

	translator = QtCore.QTranslator()
	if os.path.isfile(WAConstants.STORE_PATH + "/language.qm"):
		translator.load(WAConstants.STORE_PATH + "/language.qm")
		app.installTranslator(translator)

	#PySide.QtGui.QErrorMessage.qtHandler().show()
	wam = WAManager(app)

	
	sys.exit(app.exec_())
