Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved s60v3() into the utility class

  • Loading branch information...
commit fa9b1d54647ae8deac6133730faf9e15b983a110 1 parent 41f30d3
@lawand authored
Showing with 23 additions and 21 deletions.
  1. +10 −19 mainwindow.cpp
  2. +0 −1  mainwindow.h
  3. +12 −1 util.cpp
  4. +1 −0  util.h
View
29 mainwindow.cpp
@@ -43,7 +43,6 @@
#include <QMovie>
#include <QInputDialog>
#include <QMenu>
-#include <QSysInfo>
#include <QDateTime>
#include <QFileDialog>
#include <QDesktopServices>
@@ -87,7 +86,7 @@ MainWindow::MainWindow(
ui->setupUi(this);
setCurrentPage(ui->signInPage);
setupActions();
- if(! s60v3())
+ if(! Util::s60v3())
{
ui->mainPage->layout()->setMargin(0);
}
@@ -129,7 +128,7 @@ MainWindow::~MainWindow()
void MainWindow::resizeEvent(QResizeEvent *resizeEvent)
{
- if(! s60v3())
+ if(! Util::s60v3())
{
if(toolButtonsLayout != 0)
{
@@ -217,7 +216,7 @@ void MainWindow::resizeEvent(QResizeEvent *resizeEvent)
void MainWindow::keyPressEvent(QKeyEvent *event)
{
- if(s60v3())
+ if(Util::s60v3())
{
if(ui->stackedWidget->currentWidget() == ui->mainPage)
{
@@ -257,17 +256,9 @@ void MainWindow::attemptSignIn()
}
}
-bool MainWindow::s60v3()
-{
- return (
- QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 ||
- QSysInfo::s60Version() == QSysInfo::SV_S60_3_2
- );
-}
-
void MainWindow::setupActions()
{
- if(! s60v3())
+ if(! Util::s60v3())
{
// create tool buttons
upToolButton = new QToolButton(ui->mainPage);
@@ -330,7 +321,7 @@ void MainWindow::setupActions()
connect(aboutAction, SIGNAL(triggered()), SLOT(about()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
- if(! s60v3())
+ if(! Util::s60v3())
{
// tool buttons initialization
@@ -380,7 +371,7 @@ void MainWindow::setupActions()
ui->accountInfoPage->addAction(backAction);
connect(backAction, SIGNAL(triggered()), SLOT(back()));
- if(s60v3())
+ if(Util::s60v3())
{
QAction *currentFolderMenuAction = new QAction(
"Current Folder",
@@ -534,7 +525,7 @@ void MainWindow::on_filesAndFoldersListWidget_itemActivated(
QListWidgetItem *
)
{
- if(s60v3())
+ if(Util::s60v3())
{
showContextMenu(
ui->filesAndFoldersListWidget->geometry().center()
@@ -546,7 +537,7 @@ void MainWindow::on_filesAndFoldersListWidget_itemDoubleClicked(
QListWidgetItem *item
)
{
- if(! s60v3())
+ if(! Util::s60v3())
{
navigateItem(item);
}
@@ -556,7 +547,7 @@ void MainWindow::on_filesAndFoldersListWidget_customContextMenuRequested(
QPoint point
)
{
- if(! s60v3())
+ if(! Util::s60v3())
{
showContextMenu(
ui->filesAndFoldersListWidget->viewport()->mapToGlobal(point)
@@ -1670,7 +1661,7 @@ void MainWindow::handleDirectoryListing(QNetworkReply *networkReply)
}
}
- if(s60v3())
+ if(Util::s60v3())
{
if(ui->filesAndFoldersListWidget->count() != 0)
ui->filesAndFoldersListWidget->setCurrentRow(0);
View
1  mainwindow.h
@@ -73,7 +73,6 @@ private slots:
// initialization
void attemptSignIn();
// misc
- bool s60v3();
void setupActions();
void setCurrentPage(QWidget *page);
void showContextMenu(QPoint point);
View
13 util.cpp
@@ -25,6 +25,9 @@
// corresponding headers
#include "util.h"
+// implementation-specific
+#include <QSysInfo>
+
QString Util::bytesToString(int bytes)
{
qreal size = (qreal)bytes;
@@ -45,5 +48,13 @@ QString Util::bytesToString(int bytes)
return QString("%1%2")
.arg(size, 0, 'f', 1)
.arg(unit)
- ;
+ ;
+}
+
+bool Util::s60v3()
+{
+ return (
+ QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 ||
+ QSysInfo::s60Version() == QSysInfo::SV_S60_3_2
+ );
}
View
1  util.h
@@ -32,6 +32,7 @@ class Util
{
public:
static QString bytesToString(int bytes);
+ static bool s60v3();
};
#endif // UTIL_H
Please sign in to comment.
Something went wrong with that request. Please try again.