Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

修改截图默认方式

  • Loading branch information...
commit 03429177ed6256ce89c54bea03bab04b0e163633 1 parent f958916
@zhanlangsir authored
View
32 data/messagestyle/adium/Template.html
@@ -78,6 +78,22 @@
return el;
}
+ function onImageLoadDone()
+ {
+ ev = window.event;
+ var img = ev.srcElement;
+
+ if ( img_map[img.className] == null )
+ img_map[img.className] = {width:img.width, height:img.height};
+
+ width_d = img.width - (document.documentElement.clientWidth - 80);
+ if ( width_d > 0 )
+ {
+ height_scale = (img.width - width_d) / img.width;
+ img.width = document.documentElement.clientWidth - 80;
+ }
+ }
+
function replaceRealImg(id, local_path)
{
var elements = document.getElementsByClassName(id);
@@ -86,21 +102,7 @@
if ( elements[i].src != local_path )
elements[i].src=local_path;
- elements[i].onload = function()
- {
- ev = window.event;
- var img = ev.srcElement;
-
- if ( img_map[img.className] == null )
- img_map[img.className] = {width:img.width, height:img.height};
-
- width_d = img.width - (document.documentElement.clientWidth - 80);
- if ( width_d > 0 )
- {
- height_scale = (img.width - width_d) / img.width;
- img.width = document.documentElement.clientWidth - 80;
- }
- }
+ elements[i].onload = onImageLoadDone;
}
}
View
1  src/mainwindow.cpp
@@ -141,7 +141,6 @@ MainWindow::~MainWindow()
void MainWindow::snapshot()
{
KSnapshot *snap = new KSnapshot();
- snap->show();
}
void MainWindow::aboutQt()
View
63 src/snapshot/ksnapshot.cpp
@@ -109,7 +109,7 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode )
mainWidget = new KSnapshotWidget();
vbox->addWidget(mainWidget);
- connect(mainWidget->send_btn, SIGNAL(clicked()), SLOT(onSendBtnClicked()));
+ connect(mainWidget->ok_btn, SIGNAL(clicked()), SLOT(onOkBtnClicked()));
connect(mainWidget->cancel_btn, SIGNAL(clicked()), SLOT(onCancelBtnClicked()));
connect(mainWidget->save_btn, SIGNAL(clicked()), SLOT(onSaveBtnClicked()));
connect(mainWidget->help_btn, SIGNAL(clicked()), SLOT(onHelpBtnClicked()));
@@ -140,7 +140,7 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode )
mainWidget->cbIncludePointer->hide();
mainWidget->lblIncludePointer->hide();
#endif
- setMode(0);
+ setMode(KSnapshotObject::Region);
qDebug() << "Mode = " << mode;
if ( mode == KSnapshotObject::FullScreen ) {
@@ -203,7 +203,7 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode )
connect( &updateTimer, SIGNAL(timeout()), this, SLOT(updatePreview()) );
QTimer::singleShot( 0, this, SLOT(updateCaption()) );
- new QShortcut( Qt::Key_S, mainWidget->send_btn, SLOT(animateClick()));
+ new QShortcut( Qt::Key_S, mainWidget->ok_btn, SLOT(animateClick()));
new QShortcut( Qt::Key_N, mainWidget->btnNew, SLOT(animateClick()) );
new QShortcut( Qt::Key_Space, mainWidget->btnNew, SLOT(animateClick()) );
@@ -218,7 +218,7 @@ KSnapshot::~KSnapshot()
delete mainWidget;
}
-void KSnapshot::onSendBtnClicked()
+void KSnapshot::onOkBtnClicked()
{
QQChatDlg *current_chatdlg = ChatDlgManager::instance()->currentChatdlg();
if ( !current_chatdlg )
@@ -342,24 +342,35 @@ QString KSnapshot::getUnexistsFilePath(const QString &base)
void KSnapshot::slotRegionGrabbed( const QPixmap &pix )
{
- if ( !pix.isNull() )
- {
- snapshot = pix;
- updatePreview();
- modified = true;
- updateCaption();
- }
+ if ( !pix.isNull() )
+ {
+ snapshot = pix;
+ updatePreview();
+ modified = true;
+ updateCaption();
+ }
+
+ if ( snapshot.isNull() )
+ {
+ mainWidget->ok_btn->setEnabled(false);
+ mainWidget->save_btn->setEnabled(false);
+ }
+ else
+ {
+ mainWidget->ok_btn->setEnabled(true);
+ mainWidget->save_btn->setEnabled(true);
+ }
- if( mode() == KSnapshotObject::Region )
- {
- rgnGrab->deleteLater();
- }
- else if( mode() == KSnapshotObject::FreeRegion ) {
- freeRgnGrab->deleteLater();
- }
+ if( mode() == KSnapshotObject::Region )
+ {
+ rgnGrab->deleteLater();
+ }
+ else if( mode() == KSnapshotObject::FreeRegion ) {
+ freeRgnGrab->deleteLater();
+ }
- QApplication::restoreOverrideCursor();
- show();
+ QApplication::restoreOverrideCursor();
+ show();
}
void KSnapshot::slotWindowGrabbed( const QPixmap &pix )
@@ -370,6 +381,18 @@ void KSnapshot::slotWindowGrabbed( const QPixmap &pix )
updatePreview();
modified = true;
updateCaption();
+
+ }
+
+ if ( snapshot.isNull() )
+ {
+ mainWidget->ok_btn->setEnabled(false);
+ mainWidget->save_btn->setEnabled(false);
+ }
+ else
+ {
+ mainWidget->ok_btn->setEnabled(true);
+ mainWidget->save_btn->setEnabled(true);
}
QApplication::restoreOverrideCursor();
View
4 src/snapshot/ksnapshot.h
@@ -43,7 +43,7 @@ class KSnapshot : public QDialog, public KSnapshotObject
Q_OBJECT
public:
- explicit KSnapshot(QWidget *parent= 0, KSnapshotObject::CaptureMode mode = FullScreen);
+ explicit KSnapshot(QWidget *parent= 0, KSnapshotObject::CaptureMode mode = Region);
~KSnapshot();
public slots:
@@ -84,7 +84,7 @@ private slots:
int previewHeight() const;
void startUndelayedGrab();
void slotScreenshotReceived(qulonglong handle);
- void onSendBtnClicked();
+ void onOkBtnClicked();
void onCancelBtnClicked();
void onHelpBtnClicked();
void onSaveBtnClicked();
View
4 src/ui/ksnapshotwidget.ui
@@ -285,9 +285,9 @@ If &lt;i&gt;no delay&lt;/i&gt; is set, the program will wait for a mouse click b
</widget>
</item>
<item>
- <widget class="QToolButton" name="send_btn">
+ <widget class="QToolButton" name="ok_btn">
<property name="text">
- <string>Send</string>
+ <string>OK</string>
</property>
</widget>
</item>
Please sign in to comment.
Something went wrong with that request. Please try again.