File indexing completed on 2025-01-05 04:25:59
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef IPHONEMOUNTPOINT_H 0018 #define IPHONEMOUNTPOINT_H 0019 0020 #include <QString> 0021 #include <QStringList> 0022 0023 0024 /** 0025 * An automatic iPhone/iPad mountpoint that tries to mount the device using ifuse in 0026 * constructor and to unmount it in destructor. 0027 */ 0028 class IphoneMountPoint 0029 { 0030 public: 0031 /** 0032 * Mount iPhone/iPad device by its 40-digit device UUID or mount any connected 0033 * iPhone/iPad if @param uuid is empty. 0034 */ 0035 explicit IphoneMountPoint( const QString &uuid ); 0036 ~IphoneMountPoint(); 0037 0038 /** 0039 * Get location where iPhone was mounted to. If empty, mounting the iPhone failed. 0040 */ 0041 QString mountPoint() const; 0042 0043 /** 0044 * Return a rather long string describing mount failure. 0045 */ 0046 QString failureDetails() const; 0047 0048 private: 0049 Q_DISABLE_COPY(IphoneMountPoint) 0050 0051 /** 0052 * Creates unique directory for mounting iPhone under temporary directory 0053 */ 0054 QString constructMountpoint( const QString &uuid ); 0055 0056 /** 0057 * Calls command, logs the call and any errors using logMessage(), returns true 0058 * if the command executed and returned successfully, false otherwise. 0059 * 0060 * @param timeout timeot of starting, waiting for process finished, etc. in milliseconds 0061 */ 0062 bool call( const QString &command, const QStringList &arguments, int timeout = 10000 ); 0063 0064 /** 0065 * Log message to debugging output and to m_messages 0066 */ 0067 void logMessage( const QString &message ); 0068 0069 QString m_mountPoint; 0070 QStringList m_messages; 0071 }; 0072 0073 #endif // IPHONEMOUNTPOINT_H