Exemplo n.º 1
0
/**
 * @brief   HAL initialization.
 */
void halInit(void) {

  hal_lld_init();

#if CH_HAL_USE_PAL
  palInit(&pal_default_config);
#endif
#if CH_HAL_USE_ADC
  adcInit();
#endif
#if CH_HAL_USE_CAN
  canInit();
#endif
#if CH_HAL_USE_MAC
  macInit();
#endif
#if CH_HAL_USE_PWM
  pwmInit();
#endif
#if CH_HAL_USE_SERIAL
  sdInit();
#endif
#if CH_HAL_USE_SPI
  spiInit();
#endif
#if CH_HAL_USE_MMC_SPI
  mmcInit();
#endif
}
Exemplo n.º 2
0
/**
 * @brief   HAL initialization.
 * @details This function invokes the low level initialization code then
 *          initializes all the drivers enabled in the HAL. Finally the
 *          board-specific initialization is performed by invoking
 *          @p boardInit() (usually defined in @p board.c).
 *
 * @init
 */
void halInit(void) {

  hal_lld_init();

#if HAL_USE_TM || defined(__DOXYGEN__)
  tmInit();
#endif
#if HAL_USE_PAL || defined(__DOXYGEN__)
  palInit(&pal_default_config);
#endif
#if HAL_USE_ADC || defined(__DOXYGEN__)
  adcInit();
#endif
#if HAL_USE_CAN || defined(__DOXYGEN__)
  canInit();
#endif
#if HAL_USE_EXT || defined(__DOXYGEN__)
  extInit();
#endif
#if HAL_USE_GPT || defined(__DOXYGEN__)
  gptInit();
#endif
#if HAL_USE_I2C || defined(__DOXYGEN__)
  i2cInit();
#endif
#if HAL_USE_ICU || defined(__DOXYGEN__)
  icuInit();
#endif
#if HAL_USE_MAC || defined(__DOXYGEN__)
  macInit();
#endif
#if HAL_USE_PWM || defined(__DOXYGEN__)
  pwmInit();
#endif
#if HAL_USE_SERIAL || defined(__DOXYGEN__)
  sdInit();
#endif
#if HAL_USE_SDC || defined(__DOXYGEN__)
  //KL All in Kl_sdc sdcInit();
#endif
#if HAL_USE_SPI || defined(__DOXYGEN__)
  spiInit();
#endif
#if HAL_USE_UART || defined(__DOXYGEN__)
  uartInit();
#endif
#if HAL_USE_USB || defined(__DOXYGEN__)
  usbInit();
#endif
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
  mmcInit();
#endif
#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
  sduInit();
#endif
#if HAL_USE_RTC || defined(__DOXYGEN__)
  rtcInit();
#endif
}
Exemplo n.º 3
0
/**
 * @brief   HAL initialization.
 * @details This function invokes the low level initialization code then
 *          initializes all the drivers enabled in the HAL. Finally the
 *          board-specific initialization is performed by invoking
 *          @p boardInit() (usually defined in @p board.c).
 *
 * @init
 */
void halInit(void) {

  /* Initializes the OS Abstraction Layer.*/
  osalInit();

  /* Platform low level initializations.*/
  hal_lld_init();

#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
  palInit(&pal_default_config);
#endif
#if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
  adcInit();
#endif
#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
  canInit();
#endif
#if (HAL_USE_DAC == TRUE) || defined(__DOXYGEN__)
  dacInit();
#endif
#if (HAL_USE_EXT == TRUE) || defined(__DOXYGEN__)
  extInit();
#endif
#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
  gptInit();
#endif
#if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__)
  i2cInit();
#endif
#if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
  i2sInit();
#endif
#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
  icuInit();
#endif
#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
  macInit();
#endif
#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
  pwmInit();
#endif
#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
  sdInit();
#endif
#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
  sdcInit();
#endif
#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
  spiInit();
#endif
#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
  uartInit();
#endif
#if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__)
  usbInit();
#endif
#if (HAL_USE_MMC_SPI == TRUE) || defined(__DOXYGEN__)
  mmcInit();
#endif
#if (HAL_USE_SERIAL_USB == TRUE) || defined(__DOXYGEN__)
  sduInit();
#endif
#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
  rtcInit();
#endif
#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
  wdgInit();
#endif

  /* Community driver overlay initialization.*/
#if defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
#if (HAL_USE_COMMUNITY == TRUE) || defined(__DOXYGEN__)
  halCommunityInit();
#endif
#endif

  /* Board specific initialization.*/
  boardInit();

/*
 *  The ST driver is a special case, it is only initialized if the OSAL is
 *  configured to require it.
 */
#if OSAL_ST_MODE != OSAL_ST_MODE_NONE
  stInit();
#endif
}
Exemplo n.º 4
0
MainWindow::MainWindow(QtSingleApplication &app)
	: QMainWindow(NULL, MAINWINDOWFLAGS), 
	  isLoggingOn(false), isShuttingDown(false), 
	  showWelcomeScreen(false), isInviteCodeNeed(false), isMousePressed(false), showClipartWindow(false),
	  widgetIndexBeforeWaiting(-1),
	  contactList(NULL), drawingWindow(NULL), historyWindow(NULL), 
	  trayIcon(0), trayMenu(NULL), trayClickTimer(-1), trayConnectingTimer(-1), 	
	  autoUpdater(this), http(NULL), reply(NULL)
{
   // AEInstallEventHandler(
    
	setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);

	TimeMeasure t("MainWindow");

	progressDialog = NULL;

	setupUi(this);

	t.showTimePassedAfterSetupUi();

	// connect signals from second copy of the application
	connect(&app, SIGNAL(messageReceived(const QString & )), this, SLOT(showWindow()));

	isPlaySounds = ProgramSettings::getPlaySouns();

	// Connect infomanager & server
	connect(INFOMANAGER, SIGNAL(userAccountUpdated()), this, SLOT(onUserAccountUpdated()));
	connect(INFOMANAGER, SIGNAL(userStatusChanged(UserStatus::UserStatusEnum)), this, SLOT(onUserStatusChanged(UserStatus::UserStatusEnum)));

	connect(SERVER, SIGNAL(serverError(ServerResponseHandler::ServerError)), this, SLOT(onServerError(ServerResponseHandler::ServerError)));
	connect(SERVER, SIGNAL(logoutCompleted()), this, SLOT(onLogoutCompleted()));

	// Connect message manager
	connect(MESSAGEMANAGER, SIGNAL(privateMessageReceived(qint32, const MessageKey &)), this, SLOT(onPrivateMessageReceived(qint32, const MessageKey &)));
	connect(MESSAGEMANAGER, SIGNAL(friendsMessageReceived(const MessageKey &)), this, SLOT(onFriendsMessageReceived(const MessageKey &)));
	connect(MESSAGEMANAGER, SIGNAL(channelMessageReceived(qint32, const MessageKey &)), this, SLOT(onChannelMessageReceived(qint32, const MessageKey &)));
	connect(MESSAGEMANAGER, SIGNAL(showExceptionDialogSendingMessage(ContactResultCode::ContactResultCodeEnum, qint32)), this, SLOT(onShowExceptionDialogSendingMessage(ContactResultCode::ContactResultCodeEnum, qint32)));
		
	// Connect logon
	connect(logonWidget, SIGNAL(registerNewUser()), this, SLOT(showRegistrationWidget()));
	connect(logonWidget, SIGNAL(inviteCodeNeeded()), this, SLOT(onInviteCodeNeeded()));
	connect(logonWidget, SIGNAL(forgotPassword()), this, SLOT(showForgotPasswordWidget()));
	connect(logonWidget, SIGNAL(logonStarted()), this, SLOT(onLogonStarted()));
	connect(logonWidget, SIGNAL(logonStopped()), this, SLOT(onLogonStopped()));
	connect(logonWidget, SIGNAL(successLogon()), this, SLOT(onLogonSuccess()));
	connect(logonWidget, SIGNAL(showSettings()), this, SLOT(showSettings()));

	// connect widgets with waiting widget
	connect(waitingWidget, SIGNAL(cancel()), this, SLOT(cancelWaitingWidget()));
	connect(logonWidget, SIGNAL(waitingStart()), this, SLOT(showWaitingWidget()));
	connect(logonWidget, SIGNAL(waitingStop()), this, SLOT(stopWaitingWidget()));
	connect(registrationWidget, SIGNAL(waitingStart()), this, SLOT(showWaitingWidget()));
	connect(registrationWidget, SIGNAL(waitingHide()), this, SLOT(cancelWaitingWidget()));
	connect(forgotPasswordWidget, SIGNAL(waitingStart()), this, SLOT(showWaitingWidget()));
	connect(forgotPasswordWidget, SIGNAL(waitingStop()), this, SLOT(cancelWaitingWidget()));
	connect(inviteCodeWidget, SIGNAL(waitingStart()), this, SLOT(showWaitingWidget()));
	connect(inviteCodeWidget, SIGNAL(waitingStop()), this, SLOT(cancelWaitingWidget()));

	// Connect invite
	connect(inviteCodeWidget, SIGNAL(next()), this, SLOT(onInviteCodeAccepted()));
	connect(inviteCodeWidget, SIGNAL(back()), this, SLOT(showLogonWidget()));

	// Connect registration
	connect(registrationWidget, SIGNAL(back()), this, SLOT(onRegistrationBack()));
	connect(registrationWidget, SIGNAL(registrationSuccess()), this, SLOT(onRegistrationSuccess()));

	// Connect info
	connect(infoWidget, SIGNAL(finished()), this, SLOT(showLogonWidget()));

	// Connect forgot password
	connect(forgotPasswordWidget, SIGNAL(finished()), this, SLOT(onResetPassword()));
	connect(forgotPasswordWidget, SIGNAL(back()), this, SLOT(showLogonWidget()));

	// Connect welcome
	connect(welcomeWidget, SIGNAL(finished()), this, SLOT(showTvWidget()));

	// Connect buttons
	connect(tvCloseButton, SIGNAL(clicked()), this, SLOT(close()));

	// Connect TVWidget
	connect(previousButton, SIGNAL(clicked()), tvWidget, SLOT(previousMessage()));
	connect(tvWidget, SIGNAL(previousMessageAvailable(bool)), previousButton, SLOT(setEnabled(bool)));
	connect(tvWidget, SIGNAL(previousMessageAvailable(bool)), this, SLOT(showTvWidget()));
	
	connect(nextButton, SIGNAL(clicked()), tvWidget, SLOT(nextMessage()));
	connect(tvWidget, SIGNAL(nextMessageAvailable(bool)), nextButton, SLOT(setEnabled(bool)));
	connect(tvWidget, SIGNAL(nextMessageAvailable(bool)), this, SLOT(showTvWidget()));

	connect(tvWidget, SIGNAL(replyRequest(const QImage &)), this, SLOT(onReply(const QImage &)));

	tvWidget->setChatLabel(tr(ALL_FRIENDS_CHAT_LABEL));

	// Init variables & windows
	autoUpdater.startCheckingPaused();
	connect(&autoUpdater, SIGNAL(downloadNewVersion()), this, SLOT(onDownloadNewVersion()));

	clipartWindow = new ClipartWindow(this);

	createChildWindows();

	loadSettings();

	// start logon
	showLogonWidget(true);
	logonWidget->start(true);

	buttonsFrame->hide();

	setupTray();
	updateWindowTitle();

	// show help by pressing F1
	QShortcut * showHelpShortCut = new QShortcut(this);
	showHelpShortCut->setKey(Qt::Key_F1);
	connect(showHelpShortCut, SIGNAL(activated()), this, SLOT(showHelp()));
    
#ifdef Q_WS_MAC
    macInit();
#endif
}