-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathratewindow.cpp
75 lines (54 loc) · 1.46 KB
/
ratewindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <fstream>
#include <string>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDialog>
#include <Qt>
#include <QSpinBox>
#include <QDesktopWidget>
#include <QApplication>
#include "ratewindow.h"
#include "mainwindow.h"
#include "newuserwindow.h"
#include "moviesearchwindow.h"
#include "movieinfo_window.h"
#include "lib/set.h"
#include <QCloseEvent>
using namespace std;
RateWindow::RateWindow(QWidget* parent,NetFlix* c)
{
this->netflix=c;
this->parent=parent;
//set up the spinbox
RateMovie_label = new QLabel(tr("Enter a value between "
"%1 and %2: to rate the movie").arg(1).arg(5));
RateScaleSpinBox = new QSpinBox;
RateScaleSpinBox->setRange(1, 5);
RateScaleSpinBox->setValue(1);
//Label
MovieRate_label = new QLabel("Movie Rating: ");
MovieRate_label->setAlignment(Qt::AlignCenter);
//Button
SaveButton= new QPushButton("&Save");
//layout
QHBoxLayout *RateWindow_layout = new QHBoxLayout;
//RateWindow_layout->addWidget(MovieRate_label);
RateWindow_layout->addWidget(RateMovie_label);
RateWindow_layout->addWidget(RateScaleSpinBox);
RateWindow_layout->addWidget(SaveButton);
connect(SaveButton, SIGNAL(clicked()),
this, SLOT(Save()));
//setlayout
setLayout(RateWindow_layout);
}
int RateWindow::rate_return()
{
return RateScaleSpinBox->value();
}
void RateWindow::Save()
{
this->hide();
netflix->return_movie(rate_return());
}