Example #1
0
TextToSpeech::TextToSpeech(QObject *) {
	enabled = true;
	d = NULL;

	/* Determine which release of OS X we're running on. Tiger has a buggy implementation, and
	 * therefore we'll just disable ourselves when we're running on that.
	 *
	 * What it comes down to, is that calling DisposeSpeechChannel() on Tiger will crash in certain
	 * situations.
	 *
	 * For more information, see this thread on Apple's speech mailing list:
	 * http://lists.apple.com/archives/speech-dev/2005/Aug/msg00000.html
	 */

	int version = qMacVersion();
	if (version != QSysInfo::MV_Unknown && version < QSysInfo::MV_LEOPARD) {
		qWarning("Mac OS X 10.4 (Tiger) detected. Disabling Text-to-Speech because of a buggy implementation in 10.4.");
		return;
	}

	d = new TextToSpeechPrivate();
}
Example #2
0
QString UBExportAdaptor::askForFileName(UBDocumentProxy* pDocument, const QString& pDialogTitle)
{
    QString defaultName;

    defaultName += pDocument->metaData(UBSettings::documentName).toString() + exportExtention();

    defaultName = UBFileSystemUtils::cleanName(defaultName);

    QString defaultPath = UBSettings::settings()->lastExportFilePath->get().toString() + "/" + defaultName;

    bool useNativeDialog = true;
#ifdef Q_OS_MAC
    int versionMac = qMacVersion();
    if (versionMac == QSysInfo::MV_Unknown || versionMac >= 11){ // version 11 is MacOSX 10.9 Mavericks
        useNativeDialog = false;
    }
#endif

    QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath, QString(), 0, useNativeDialog?(QFileDialog::Option)0:QFileDialog::DontUseNativeDialog);

    if (filename.size() == 0)
    {
        return filename;
    }

    // add extension if needed
    QFileInfo fileNameInfo(filename);
    if (fileNameInfo.suffix() != exportExtention().mid(1, exportExtention().length() - 1))
    {
        filename += exportExtention();
    }
    UBSettings::settings()->lastExportFilePath->set(QVariant(fileNameInfo.absolutePath()));
    QApplication::processEvents();

    return filename;
}