[Digikam-devel] branches/stable/extragear/graphics/digikam/digikam
Tom Albers
tomalbers at kde.nl
Wed Jan 4 23:24:20 GMT 2006
SVN commit 494411 by toma:
Add a command line option to digiKam so you can start the camera dialog at a certain path. Now you can do digikam --download-from /a/path/to/camera. This can be used in conjuction with a media:/ service menu so you can automatically start digiKam and open up the camera....
CCMAIL:digikam-devel at kde.org
M +43 -9 digikamapp.cpp
M +7 -2 digikamapp.h
M +9 -8 main.cpp
--- branches/stable/extragear/graphics/digikam/digikam/digikamapp.cpp #494410:494411
@@ -76,7 +76,7 @@
#include "thumbnailsize.h"
#include "scanlib.h"
-DigikamApp::DigikamApp(bool detectCamera)
+DigikamApp::DigikamApp()
: KMainWindow( 0, "Digikam" )
{
m_instance = this;
@@ -125,14 +125,6 @@
mDcopIface = new DCOPIface(this, "camera");
connect(mDcopIface, SIGNAL(signalCameraAutoDetect()), this, SLOT(slotCameraAutoDetect()));
-
- // Auto-detect camera if requested so
- if (detectCamera)
- {
- if(mSplash)
- mSplash->message(i18n("Auto-detect camera"), AlignLeft, white);
- QTimer::singleShot(0, this, SLOT(slotCameraAutoDetect()));
- }
}
DigikamApp::~DigikamApp()
@@ -192,6 +184,32 @@
return importMenu;
}
+void DigikamApp::autoDetect()
+{
+ // Auto-detect camera if requested so
+ if(mSplash)
+ mSplash->message(i18n("Auto-detect camera"), AlignLeft, white);
+ QTimer::singleShot(0, this, SLOT(slotCameraAutoDetect()));
+}
+
+void DigikamApp::downloadFrom(const QString &cameraGuiPath)
+{
+ mCameraGuiPath=cameraGuiPath;
+
+ if (!mCameraGuiPath.isNull())
+ {
+ if(mSplash)
+ mSplash->message(i18n("Opening Download Dialog"), AlignLeft, white);
+
+ KAction *cAction = new KAction(
+ i18n("Browse %1").arg(mCameraGuiPath), 0,
+ this, SLOT(slotDownloadImages()), actionCollection() );
+ mCameraMenuAction->insert(cAction, 0);
+
+ QTimer::singleShot(0, this, SLOT(slotDownloadImages()));
+ }
+}
+
bool DigikamApp::queryClose()
{
return true;
@@ -850,6 +868,21 @@
close();
}
+void DigikamApp::slotDownloadImages()
+{
+ if (mCameraGuiPath.isNull())
+ return;
+
+ CameraUI* cgui = new CameraUI(this,
+ i18n("Images found in %1").arg(mCameraGuiPath),
+ "directory browse","Fixed", mCameraGuiPath);
+ cgui->show();
+ connect(cgui, SIGNAL(signalLastDestination(const KURL&)),
+ mView, SLOT(slotSelectAlbum(const KURL&)));
+ connect(cgui, SIGNAL(signalAlbumSettingsChanged()),
+ SLOT(slotSetupChanged()));
+}
+
void DigikamApp::slotCameraConnect()
{
CameraType* ctype = mCameraList->find(QString::fromUtf8(sender()->name()));
@@ -1140,6 +1173,7 @@
void DigikamApp::loadCameras()
{
mCameraList->load();
+
mCameraMenuAction->popupMenu()->insertSeparator();
mCameraMenuAction->insert(new KAction(i18n("Add Camera..."), 0,
this, SLOT(slotSetupCamera()),
--- branches/stable/extragear/graphics/digikam/digikam/digikamapp.h #494410:494411
@@ -68,11 +68,11 @@
public:
- DigikamApp(bool detectCamera=false);
+ DigikamApp();
~DigikamApp();
virtual void show();
-
+
static DigikamApp* getinstance();
// KIPI Actions collections access.
@@ -82,6 +82,8 @@
const QPtrList<KAction> menuImportActions();
+ void autoDetect();
+ void downloadFrom(const QString &cameraGuiPath);
void enableThumbSizePlusAction(bool val);
void enableThumbSizeMinusAction(bool val);
void enableAlbumBackwardHistory(bool enable);
@@ -125,6 +127,8 @@
SplashScreen *mSplash;
+ QString mCameraGuiPath;
+
// Album Settings
AlbumSettings *mAlbumSettings;
@@ -205,6 +209,7 @@
void slotKipiPluginPlug();
+ void slotDownloadImages();
void slotCameraConnect();
void slotCameraAdded(CameraType *ctype);
void slotCameraRemoved(CameraType *ctype);
--- branches/stable/extragear/graphics/digikam/digikam/main.cpp #494410:494411
@@ -57,6 +57,7 @@
static KCmdLineOptions options[] =
{
{ "detect-camera", I18N_NOOP("Automatically detect and open camera"), 0 },
+ { "download-from <path>", I18N_NOOP("Open camera dialog at <path>"), 0 },
KCmdLineLastOption
};
@@ -202,13 +203,6 @@
KApplication app;
- bool detectCamera = false;
- KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
- if (args && args->isSet("detect-camera"))
- {
- detectCamera = true;
- }
-
KConfig* config = KGlobal::config();
config->setGroup("General Settings");
QString version = config->readEntry("Version");
@@ -237,10 +231,17 @@
// Register image formats (especially for TIFF )
KImageIO::registerFormats();
- DigikamApp *digikam = new DigikamApp(detectCamera);
+ DigikamApp *digikam = new DigikamApp();
app.setMainWidget(digikam);
digikam->show();
+
+ KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+ if (args && args->isSet("detect-camera"))
+ digikam->autoDetect();
+ else if (args && args->isSet("download-from"))
+ digikam->downloadFrom(args->getOption("download-from"));
+
#if KDE_IS_VERSION(3,2,0)
QStringList tipsFiles;
More information about the Digikam-devel
mailing list