comparison gui/src/FilesDockWidget.cpp @ 13537:a43ecce77eec

Introduced a central ResourceManager class.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 26 Jul 2011 19:04:07 +0200
parents 869c62c15e95
children a4b5cad8f7c6
comparison
equal deleted inserted replaced
13536:869c62c15e95 13537:a43ecce77eec
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include "ResourceManager.h"
19 #include "FilesDockWidget.h" 20 #include "FilesDockWidget.h"
20 21
21 #include <QApplication> 22 #include <QApplication>
22 #include <QFileInfo> 23 #include <QFileInfo>
23 #include <QCompleter> 24 #include <QCompleter>
24 #include <QSettings> 25 #include <QSettings>
25 #include <QProcess> 26 #include <QProcess>
26 #include <QDesktopServices>
27 27
28 FilesDockWidget::FilesDockWidget (QWidget * parent):QDockWidget (parent) 28 FilesDockWidget::FilesDockWidget (QWidget * parent):QDockWidget (parent)
29 { 29 {
30 setObjectName ("FilesDockWidget"); 30 setObjectName ("FilesDockWidget");
31 setWindowTitle (tr ("Current Folder")); 31 setWindowTitle (tr ("Current Folder"));
109 } 109 }
110 // Otherwise attempt to open it. 110 // Otherwise attempt to open it.
111 else 111 else
112 { 112 {
113 // Check if the user wants to use a custom file editor. 113 // Check if the user wants to use a custom file editor.
114 QDesktopServices desktopServices; 114 QSettings *settings = ResourceManager::instance ()->settings ();
115 QString settingsFile = 115 if (settings->value ("useCustomFileEditor").toBool ())
116 desktopServices.storageLocation (QDesktopServices::HomeLocation) +
117 "/.quint/settings.ini";
118 QSettings settings (settingsFile, QSettings::IniFormat);
119 if (settings.value ("useCustomFileEditor").toBool ())
120 { 116 {
121 QString editor = settings.value ("customFileEditor").toString (); 117 QString editor = settings->value ("customFileEditor").toString ();
122 QStringList arguments; 118 QStringList arguments;
123 arguments << fileInfo.filePath (); 119 arguments << fileInfo.filePath ();
124 QProcess::execute (editor, arguments); 120 QProcess::execute (editor, arguments);
125 } 121 }
126 else 122 else
167 } 163 }
168 164
169 void 165 void
170 FilesDockWidget::noticeSettings () 166 FilesDockWidget::noticeSettings ()
171 { 167 {
172 168 QSettings *settings = ResourceManager::instance ()->settings ();
169 m_fileTreeView->setColumnHidden (0, !settings->value ("showFilenames").toBool ());
170 m_fileTreeView->setColumnHidden (1, !settings->value ("showFileSize").toBool ());
171 m_fileTreeView->setColumnHidden (2, !settings->value ("showFileType").toBool ());
172 m_fileTreeView->setColumnHidden (3, !settings->value ("showLastModified").toBool ());
173 m_fileTreeView->setAlternatingRowColors (settings->value ("useAlternatingRowColors").toBool ());
174 //if (settings.value ("showHiddenFiles").toBool ())
173 } 175 }