mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
Code clean up
This commit is contained in:
parent
bb19cfce1f
commit
0853ae4691
@ -436,13 +436,35 @@ void MainWindow::writeSettings() {
|
||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
// Splitter size
|
||||
QStringList sizes_str;
|
||||
sizes_str << QString::number(vSplitter->sizes().first());
|
||||
sizes_str << QString::number(vSplitter->sizes().last());
|
||||
settings.setValue(QString::fromUtf8("vSplitterSizes"), sizes_str);
|
||||
settings.setValue(QString::fromUtf8("vsplitterState"), vSplitter->saveState());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::readSettings() {
|
||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
const QByteArray splitterState = settings.value("vsplitterState").toByteArray();
|
||||
if(splitterState.isEmpty()) {
|
||||
// Default sizes
|
||||
vSplitter->setSizes(QList<int>() << 120 << vSplitter->width()-120);
|
||||
} else {
|
||||
vSplitter->restoreState(splitterState);
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::balloonClicked() {
|
||||
if(isHidden()) {
|
||||
show();
|
||||
if(isMinimized()) {
|
||||
showNormal();
|
||||
}
|
||||
raise();
|
||||
activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
// called when a torrent has finished
|
||||
void MainWindow::finishedTorrent(const QTorrentHandle& h) const {
|
||||
if(!TorrentPersistentData::isSeed(h.hash()))
|
||||
@ -495,36 +517,6 @@ void MainWindow::displayRSSTab() const {
|
||||
|
||||
// End of keyboard shortcuts slots
|
||||
|
||||
void MainWindow::readSettings() {
|
||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
const QStringList sizes_str = settings.value("vSplitterSizes", QStringList()).toStringList();
|
||||
// Splitter size
|
||||
QList<int> sizes;
|
||||
if(sizes_str.size() == 2) {
|
||||
sizes << sizes_str.first().toInt();
|
||||
sizes << sizes_str.last().toInt();
|
||||
} else {
|
||||
qDebug("Default splitter size");
|
||||
sizes << 120;
|
||||
sizes << vSplitter->width()-120;
|
||||
}
|
||||
vSplitter->setSizes(sizes);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::balloonClicked() {
|
||||
if(isHidden()) {
|
||||
show();
|
||||
if(isMinimized()) {
|
||||
showNormal();
|
||||
}
|
||||
raise();
|
||||
activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::askRecursiveTorrentDownloadConfirmation(const QTorrentHandle &h) {
|
||||
Preferences pref;
|
||||
if(pref.recursiveDownloadDisabled()) return;
|
||||
@ -1042,9 +1034,9 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
|
||||
NotifyNotification* notification;
|
||||
|
||||
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent"
|
||||
#if !defined(NOTIFY_VERSION_MINOR) || (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7)
|
||||
#if !defined(NOTIFY_VERSION_MINOR) || (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7)
|
||||
, 0
|
||||
#endif
|
||||
#endif
|
||||
);
|
||||
gboolean success = notify_notification_show (notification, NULL);
|
||||
g_object_unref(G_OBJECT(notification));
|
||||
|
Loading…
x
Reference in New Issue
Block a user