Skip to content
Browse files

added file dumping

  • Loading branch information...
1 parent 7f4450c commit 4e91f6dc586e80e70554325d97c083412e802caa @gnuvince committed Feb 24, 2011
View
72 SimpleIMDB/SimpleIMDB/SimpleIMDB.pro.user
@@ -43,74 +43,6 @@
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt in PATH Debug</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/u/foleybov/Documents/IFT2905/TP1/SimpleIMDB/SimpleIMDB-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt in PATH Release</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/u/foleybov/Documents/IFT2905/TP1/SimpleIMDB/SimpleIMDB-build-desktop</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
- </valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
- <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
- </valuemap>
- <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
- <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
- <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
- <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
- <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
- <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
- <value type="QString">clean</value>
- </valuelist>
- <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
- </valuemap>
- <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
- <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
- <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.7.0 OpenSource Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
@@ -119,7 +51,7 @@
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
- <valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
+ <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
@@ -153,7 +85,7 @@
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
- <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">4</value>
+ <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">SimpleIMDB</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
View
2 SimpleIMDB/SimpleIMDB/imdbScript.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# imdbScript.py
View
21 SimpleIMDB/SimpleIMDB/mainwindow.cpp
@@ -1,6 +1,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QDebug"
+#include "QFile"
#include <cmath>
MainWindow::MainWindow(QWidget *parent) :
@@ -76,6 +77,8 @@ void MainWindow::field_dispatcher(const QMap<QString, QStringList> &film, const
emit set_film_director(get_field("director", film));
emit set_film_genres(film.value("genres", QStringList()).join(QString(", ")));
emit set_film_actors(film.value("cast", QStringList()));
+
+ save_film(film);
}
void MainWindow::set_film_actors_slot(const QStringList &actors) {
@@ -88,3 +91,21 @@ void MainWindow::search_movie() {
QString title = ui->search_field->text();
emit changeFilmInternet(title);
}
+
+void MainWindow::save_film(const QMap<QString, QStringList> &film) {
+ QStringList fields = QStringList();
+ fields << "title" << "rating" << "top 250 rank" << "countries"
+ << "year" << "runtimes" << "plot outline" << "director"
+ << "genres" << "cast" << "cover url";
+ QString title = get_field("title", film).replace(QChar(' '), QChar('_'));
+ QFile out(QString("/tmp/") + title);
+ if (out.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ QTextStream stream(&out);
+ foreach (QString field, fields) {
+ stream << field << " :\n";
+ foreach (QString info, film.value(field, QStringList())) {
+ stream << '\t' << info << "\n";
+ }
+ }
+ }
+}
View
4 SimpleIMDB/SimpleIMDB/mainwindow.h
@@ -14,7 +14,9 @@ class MainWindow : public QMainWindow
public:
explicit MainWindow(QWidget *parent = 0);
- ~MainWindow();
+ ~MainWindow();
+ void save_film(const QMap<QString, QStringList> &film);
+
public slots:
void field_dispatcher(const QMap<QString,QStringList> &film, const QPixmap &image);

0 comments on commit 4e91f6d

Please sign in to comment.
Something went wrong with that request. Please try again.