/* * instwizard.cpp * * Copyright (C) 2004-2005 Jürgen Kofler * * 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 */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include "version.h" #include "instwizard.h" #include "instwizard.moc" #ifdef HAVE_DVB #include "dvbconfig.h" #endif void InstWizard::internalWizard() { setCaption(i18n("Kaffeine %1 Installation Wizard").arg(KAFFEINE_VERSION)); resize(400,400); /************** installation check ************************/ KTextBrowser* page1 = new KTextBrowser(this); addPage(page1, i18n("Installation Check")); setNextEnabled(page1, true); setBackEnabled(page1, false); setHelpEnabled(page1, false); setFinishEnabled(page1, false); TQString infoString; TQTextStream info(&infoString, IO_WriteOnly); //KAFFEINE-PART info << "" << i18n("Kaffeine-Xine") << "...
"; KService::Ptr service = KService::serviceByDesktopName("xine_part"); if ((service) && (service->serviceTypes().contains("KaffeinePart"))) info << "" << i18n("Ok.") << ""; else info << "" << i18n("Part not found. Please check your installation!") << ""; //KAFFEINE-PART info << "

" << "TDE" << "...
"; info << i18n("Found version") << ": " << KDE::versionString() << "
"; if (KDE::version() >= TDE_MAKE_VERSION(3,2,0)) info << "" << i18n("Ok.") << ""; else info << "" << i18n("Kaffeine requires TDE >= %1.").arg("3.2") << ""; //XINE-LIB //Should engine depending stuff be here? /* info << "

" << "xine-lib" << "...
"; TQString xineVersion = xine_get_version_string(); info << i18n("Found version") << ": " << xineVersion << "
"; if (xine_check_version(1,0,0)) { int major, minor, sub; xine_get_version(&major, &minor, &sub); if (xineVersion.contains("CVS", false)) info << "" << i18n("Developer version.") << ""; if ((major == 1) && (minor == 0) && (sub == 0) && (xineVersion.contains("rc", false))) { info << "" << i18n("Kaffeine requires xine-lib >= %1. Download the latest version here:").arg("1.0") << " http://www.xinehq.de."; } else info << "" << i18n("Ok.") << ""; } else info << "" << i18n("Kaffeine requires xine-lib >= %1. Download the latest version here:").arg("1.0") << " http://www.xinehq.de."; */ //WIN32-CODECS info << "
" << i18n("WIN32 Codecs") << "...
"; TQDir d("/usr/lib/win32"); TQStringList entries = d.entryList("wmv*"); if (entries.count()) info << "" << i18n("Ok.") << ""; else info << "" << i18n("No WIN32 codecs found in /usr/lib/win32. You're not able to play Windows Media 9 files, newer Real Media files and some less common formats. Download the codecs here:") << " http://www1.mplayerhq.hu/design7/dload.html#binary_codecs."; //LIBDVDCSS info << "

" << "libdvdcss" << "...
"; bool dvdcss = false; d = TQDir("/usr/lib"); entries = d.entryList("libdvdcss.so*"); if (entries.count()) dvdcss = true; else { d = TQDir("/usr/local/lib"); entries = d.entryList("libdvdcss.so*"); if (entries.count()) dvdcss = true; else { d = TQDir("/usr/lib64"); entries = d.entryList("libdvdcss.so*"); if (entries.count()) dvdcss = true; } } if (!dvdcss) info << "" << i18n("libdvdcss not found. You're not able to play encrypted (most commercial) DVD's. You can get the library here (but using it may violate copyright regulations of your country!):") << " http://developers.videolan.org/libdvdcss."; else info << "" << i18n("Ok.") << ""; //DVD-DRIVE info << "

" << i18n("DVD Drive") << "...
"; KProcess process; process << "/sbin/hdparm" << "-d" << "/dev/dvd"; connect(&process, TQT_SIGNAL(receivedStdout(KProcess*,char*,int)), this, TQT_SLOT(slotStdout(KProcess*, char*, int))); process.start(KProcess::Block, KProcess::Stdout); if (stdout.contains('1')) info << "" << i18n("Ok.") << ""; else if (stdout.contains('0')) info << "" << i18n("DMA mode off! For smooth DVD playback run as root:") + " \"hdparm -d1 /dev/dvd\"."; else info << "" << i18n("Can't check DMA mode. Permission denied or no such device:") << " \"/dev/dvd\"."; //DVB-DEVICES #ifdef HAVE_DVB info << "

" << i18n("DVB-Device") << "...
"; if (DVBconfig::haveDvbDevice()) { info << "" << i18n("Ok.") << ""; } else { info << "" << i18n("No DVB-Devices found. The DVB related functions will be hidden.") << ""; } #endif //DISTRIBUTION info << "

" << i18n("Distribution") << "...
"; if (TQFile::exists("/etc/SuSE-release")) { TQFile file("/etc/SuSE-release"); file.open(IO_ReadOnly); TQTextStream stream(&file); info << "" << i18n("Found") << ": " << stream.readLine() << ". " << i18n("The xine-lib shipped by SuSE \"may lack certain features because of legal requirements (potential patent violation)\". You should use the packages from here:") << " http://packman.links2linux.de."; file.close(); } else info << "" << i18n("Ok.") << ""; info << "

" << i18n("RESULT") << ": "; if (infoString.contains("DarkRed")) { info << i18n("Found some problems, but nevertheless Kaffeine might work."); } else { info << i18n("All ok!"); } info << "
setText(infoString); /************** installation options **********************/ TQVBox* page2 = new TQVBox(this); page2->setSpacing(20); TQCheckBox *m_useMMSHelper = new TQCheckBox(i18n("Use Kaffeine as helper application for mms:// (Microsoft Media) streams"), page2); if (!locateLocal("services", "mms.protocol")) m_useMMSHelper->setChecked(true); TQCheckBox *m_useRTSPHelper = new TQCheckBox(i18n("Use Kaffeine as helper application for rtsp:// (Real Media and others) streams"), page2); if (!locateLocal("services", "rtsp.protocol")) m_useRTSPHelper->setChecked(true); TQCheckBox *m_createDesktopIcon = new TQCheckBox(i18n("Create a Kaffeine icon on desktop"), page2); if (!TQFile::exists( TQDir::homeDirPath() + "/Desktop/kaffeine.desktop")) m_createDesktopIcon->setChecked(true); addPage(page2, i18n("Installation Options")); setNextEnabled(page2, false); setBackEnabled(page2, true); setHelpEnabled(page2, false); setFinishEnabled(page2, true); if (exec() == TQDialog::Accepted) { kdDebug() << "WizardDialog: finished pressed" << endl; KProcess process; TQStringList dirs = KGlobal::dirs()->findDirs("data", "kaffeine"); TQString homePath = KGlobal::dirs()->localtdedir(); kdDebug() << "WizardDialog: TDE homedir: " << homePath << endl; TQString dataPath; if (dirs[0].left(homePath.length()) != homePath) /* global data path */ dataPath = dirs[0]; else dataPath = dirs[1]; if (m_useMMSHelper->isChecked()) { process << "cp" << dataPath + "mms.protocol" << locateLocal("services", "mms.protocol"); kdDebug() << "WizardDialog: cp " << dataPath + "mms.protocol" << " " << locateLocal("services", "mms.protocol") << endl; process.start(KProcess::Block); process.clearArguments(); } if (m_useRTSPHelper->isChecked()) { process << "cp" << dataPath + "rtsp.protocol" << locateLocal("services", "rtsp.protocol"); kdDebug() << "WizardDialog: cp " << dataPath + "rtsp.protocol" << " " << locateLocal("services", "rtsp.protocol") << endl; process.start(KProcess::Block); process.clearArguments(); } //dirs = KGlobal::dirs()->findDirs("apps", "Multimedia"); dirs = KGlobal::dirs()->findDirs("xdgdata-apps", "kde"); if (!dirs.isEmpty()) dataPath = dirs[0]; else kdError() << "WizardDialog: Applications path not found!" << endl; if (m_createDesktopIcon->isChecked()) { process << "cp" << dataPath + "kaffeine.desktop" << TQDir::homeDirPath() + "/Desktop/kaffeine.desktop"; kdDebug() << "WizardDialog: cp " << dataPath + "kaffeine.desktop" << " " << TQDir::homeDirPath() + "/Desktop/kaffeine.desktop" << endl; process.start(KProcess::Block); process.clearArguments(); } } } void InstWizard::slotStdout(KProcess *, char *buffer, int buflen) { TQString output = TQString::fromLatin1(buffer, buflen); kdDebug() << "WizardDialog: got from hdparm: " << output << "\n"; stdout.append(output); }