-rw-r--r-- | noncore/multimedia/camera/gui/mainwindow.cpp | 120 |
1 files changed, 76 insertions, 44 deletions
diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp index 0854f0d..5da3757 100644 --- a/noncore/multimedia/camera/gui/mainwindow.cpp +++ b/noncore/multimedia/camera/gui/mainwindow.cpp | |||
@@ -44,2 +44,4 @@ | |||
44 | using namespace Opie; | 44 | using namespace Opie; |
45 | #include <opie2/oapplication.h> | ||
46 | #include <opie2/oconfig.h> | ||
45 | #include <opie2/odebug.h> | 47 | #include <opie2/odebug.h> |
@@ -108,2 +110,13 @@ CameraMainWindow::~CameraMainWindow() | |||
108 | { | 110 | { |
111 | // write back configuration | ||
112 | OConfigGroupSaver cgs( oApp->config(), "General" ); | ||
113 | cgs.config()->writeEntry( "flip", flip ); | ||
114 | cgs.config()->writeEntry( "quality", quality ); | ||
115 | cgs.config()->writeEntry( "zoom", zoom ); | ||
116 | cgs.config()->writeEntry( "captureX", captureX ); | ||
117 | cgs.config()->writeEntry( "captureY", captureY ); | ||
118 | cgs.config()->writeEntry( "captureFormat", captureFormat ); | ||
119 | cgs.config()->writeEntry( "outputTo", outputTo ); | ||
120 | cgs.config()->writeEntry( "prefix", prefix ); | ||
121 | cgs.config()->writeEntry( "appendSettings", appendSettings ); | ||
109 | } | 122 | } |
@@ -113,25 +126,31 @@ void CameraMainWindow::init() | |||
113 | { | 126 | { |
114 | // TODO: Save this stuff in config | 127 | // get values from configuration |
115 | flip = 'A'; // auto | 128 | OConfigGroupSaver cgs( oApp->config(), "General" ); |
116 | quality = 50; | 129 | flip = cgs.config()->readEntry( "flip", "A" ); |
117 | zoom = 1; | 130 | quality = cgs.config()->readNumEntry( "quality", 50 ); |
118 | captureX = 480; | 131 | zoom = cgs.config()->readNumEntry( "zoom", 1 ); |
119 | captureY = 640; | 132 | captureX = cgs.config()->readNumEntry( "captureX", 480 ); |
120 | captureFormat = "JPEG"; | 133 | captureY = cgs.config()->readNumEntry( "captureY", 640 ); |
121 | outputTo = "Documents Folder"; | 134 | captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); |
122 | prefix = "Untitled"; | 135 | outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); |
123 | appendSettings = true; | 136 | prefix = cgs.config()->readEntry( "prefix", "Untitled" ); |
124 | 137 | appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); | |
138 | |||
139 | // create action groups | ||
140 | QAction* a; | ||
125 | resog = new QActionGroup( 0, "reso", true ); | 141 | resog = new QActionGroup( 0, "reso", true ); |
126 | resog->setToggleAction( true ); | 142 | resog->setToggleAction( true ); |
127 | new QAction( " 64 x 48", 0, 0, resog, 0, true ); | 143 | new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); |
128 | new QAction( "128 x 96", 0, 0, resog, 0, true ); | 144 | new QAction( "128 x 96", 0, 0, resog, "128x96", true ); |
129 | new QAction( "192 x 144", 0, 0, resog, 0, true ); | 145 | new QAction( "192 x 144", 0, 0, resog, "192x144", true ); |
130 | new QAction( "256 x 192", 0, 0, resog, 0, true ); | 146 | new QAction( "256 x 192", 0, 0, resog, "256x192", true ); |
131 | new QAction( "320 x 240", 0, 0, resog, 0, true ); | 147 | new QAction( "320 x 240", 0, 0, resog, "320x240", true ); |
132 | new QAction( "384 x 288", 0, 0, resog, 0, true ); | 148 | new QAction( "384 x 288", 0, 0, resog, "384x288", true ); |
133 | new QAction( "448 x 336", 0, 0, resog, 0, true ); | 149 | new QAction( "448 x 336", 0, 0, resog, "448x336", true ); |
134 | new QAction( "512 x 384", 0, 0, resog, 0, true ); | 150 | new QAction( "512 x 384", 0, 0, resog, "512x384", true ); |
135 | new QAction( "576 x 432", 0, 0, resog, 0, true ); | 151 | new QAction( "576 x 432", 0, 0, resog, "576x432", true ); |
136 | ( new QAction( "640 x 480", 0, 0, resog, 0, true ) )->setOn( true ); | 152 | new QAction( "640 x 480", 0, 0, resog, "640x480", true ); |
153 | a = (QAction*) resog->child( QString().sprintf( "%dx%d", captureX>captureY ? captureX:captureY, captureX>captureY ? captureY:captureX ) ); | ||
154 | if ( a ) a->setOn( true ); | ||
155 | else owarn << "can't set resolution" << oendl; | ||
137 | 156 | ||
@@ -139,7 +158,10 @@ void CameraMainWindow::init() | |||
139 | qualityg->setToggleAction( true ); | 158 | qualityg->setToggleAction( true ); |
140 | new QAction( " 0 (&minimal)", 0, 0, qualityg, 0, true ); | 159 | new QAction( " 0 (&minimal)", 0, 0, qualityg, "0", true ); |
141 | new QAction( " 25 (&low)", 0, 0, qualityg, 0, true ); | 160 | new QAction( " 25 (&low)", 0, 0, qualityg, "25", true ); |
142 | ( new QAction( " 50 (&good)", 0, 0, qualityg, 0, true ) )->setOn( true ); | 161 | new QAction( " 50 (&good)", 0, 0, qualityg, "50", true ); |
143 | new QAction( " 75 (&better)", 0, 0, qualityg, 0, true ); | 162 | new QAction( " 75 (&better)", 0, 0, qualityg, "75", true ); |
144 | new QAction( "100 (bes&t)", 0, 0, qualityg, 0, true ); | 163 | new QAction( "100 (bes&t)", 0, 0, qualityg, "100", true ); |
164 | a = (QAction*) qualityg->child( QString().sprintf( "%d", quality ) ); | ||
165 | if ( a ) a->setOn( true ); | ||
166 | else owarn << "can't set quality" << oendl; | ||
145 | 167 | ||
@@ -147,4 +169,7 @@ void CameraMainWindow::init() | |||
147 | zoomg->setToggleAction( true ); | 169 | zoomg->setToggleAction( true ); |
148 | ( new QAction( "x 1", 0, 0, zoomg, 0, true ) )->setOn( true ); | 170 | new QAction( "x 1", 0, 0, zoomg, "1", true ); |
149 | new QAction( "x 2", 0, 0, zoomg, 0, true ); | 171 | new QAction( "x 2", 0, 0, zoomg, "2", true ); |
172 | a = (QAction*) zoomg->child( QString().sprintf( "%d", zoom ) ); | ||
173 | if ( a ) a->setOn( true ); | ||
174 | else owarn << "can't set zoom" << oendl; | ||
150 | 175 | ||
@@ -152,7 +177,10 @@ void CameraMainWindow::init() | |||
152 | flipg->setToggleAction( true ); | 177 | flipg->setToggleAction( true ); |
153 | ( new QAction( "Auto (recommended)", 0, 0, flipg, 0, true ) )->setOn( true ); | 178 | new QAction( "Auto (recommended)", 0, 0, flipg, "A", true ); |
154 | new QAction( "0 (always off)", 0, 0, flipg, 0, true ); | 179 | new QAction( "0 (always off)", 0, 0, flipg, "0", true ); |
155 | new QAction( "X (always horizontal)", 0, 0, flipg, 0, true ); | 180 | new QAction( "X (always horizontal)", 0, 0, flipg, "X", true ); |
156 | new QAction( "Y (always vertical)", 0, 0, flipg, 0, true ); | 181 | new QAction( "Y (always vertical)", 0, 0, flipg, "Y", true ); |
157 | new QAction( "* (always both)", 0, 0, flipg, 0, true ); | 182 | new QAction( "* (always both)", 0, 0, flipg, "*", true ); |
183 | a = (QAction*) flipg->child( QString().sprintf( "%s", (const char*) flip ) ); | ||
184 | if ( a ) a->setOn( true ); | ||
185 | else owarn << "can't set flip" << oendl; | ||
158 | 186 | ||
@@ -160,8 +188,10 @@ void CameraMainWindow::init() | |||
160 | outputTog->setToggleAction( true ); | 188 | outputTog->setToggleAction( true ); |
161 | new QAction( "/tmp/", 0, 0, outputTog, 0, true ); | 189 | new QAction( "/tmp/", 0, 0, outputTog, "/tmp/", true ); |
162 | new QAction( "/mnt/card/", 0, 0, outputTog, 0, true ); | 190 | new QAction( "/mnt/card/", 0, 0, outputTog, "/mnt/card/", true ); |
163 | new QAction( "/mnt/cf/", 0, 0, outputTog, 0, true ); | 191 | new QAction( "/mnt/cf/", 0, 0, outputTog, "/mnt/cf/", true ); |
164 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, 0, true ); | 192 | docfolder = new QAction( "Documents Folder", 0, 0, outputTog, "Documents Folder", true ); |
165 | docfolder->setOn( true ); | 193 | custom = new QAction( "&Custom...", 0, 0, outputTog, "custom", true ); //TODO: How to save custom!? |
166 | custom = new QAction( "&Custom...", 0, 0, outputTog, 0, true ); | 194 | a = (QAction*) outputTog->child( QString().sprintf( "%s", (const char*) outputTo ) ); |
195 | if ( a ) a->setOn( true ); | ||
196 | else owarn << "can't set outputTo" << oendl; | ||
167 | 197 | ||
@@ -169,6 +199,9 @@ void CameraMainWindow::init() | |||
169 | outputg->setToggleAction( true ); | 199 | outputg->setToggleAction( true ); |
170 | ( new QAction( "JPEG", 0, 0, outputg, 0, true ) )->setOn( true ); | 200 | new QAction( "JPEG", 0, 0, outputg, "JPEG", true ); |
171 | new QAction( "PNG", 0, 0, outputg, 0, true ); | 201 | new QAction( "PNG", 0, 0, outputg, "PNG", true ); |
172 | new QAction( "BMP", 0, 0, outputg, 0, true ); | 202 | new QAction( "BMP", 0, 0, outputg, "BMP", true ); |
173 | new QAction( "AVI", 0, 0, outputg, 0, true ); | 203 | new QAction( "AVI", 0, 0, outputg, "AVI", true ); |
204 | a = (QAction*) outputg->child( QString().sprintf( "%s", (const char*) captureFormat ) ); | ||
205 | if ( a ) a->setOn( true ); | ||
206 | else owarn << "can't set output format" << oendl; | ||
174 | 207 | ||
@@ -180,3 +213,2 @@ void CameraMainWindow::init() | |||
180 | connect( outputg, SIGNAL( selected(QAction*) ), this, SLOT( outputMenuItemClicked(QAction*) ) ); | 213 | connect( outputg, SIGNAL( selected(QAction*) ), this, SLOT( outputMenuItemClicked(QAction*) ) ); |
181 | |||
182 | } | 214 | } |